You are here

public function Flow::getType in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Flow.php \Drupal\cms_content_sync\Entity\Flow::getType()

Return value

null|string

File

src/Entity/Flow.php, line 115

Class

Flow
Defines the "Content Sync - Flow" entity.

Namespace

Drupal\cms_content_sync\Entity

Code

public function getType() {
  if (empty($this->sync_entities)) {
    return null;
  }
  $has_push = false;
  $has_pull = false;
  foreach ($this
    ->getEntityTypeConfig() as $config) {
    if (PushIntent::PUSH_DISABLED != $config['export']) {
      $has_push = true;
      if ($has_pull) {
        break;
      }
    }
    if (PullIntent::PULL_DISABLED != $config['import']) {
      $has_pull = true;
      if ($has_push) {
        break;
      }
    }
  }
  if ($has_push) {
    if ($has_pull) {
      return self::TYPE_BOTH;
    }
    return self::TYPE_PUSH;
  }
  if ($has_pull) {
    return self::TYPE_PULL;
  }
  return null;
}