You are here

public function Flow::getType in CMS Content Sync 2.0.x

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

Return value

null|string

File

src/Entity/Flow.php, line 120

Class

Flow
Defines the "Content Sync - Flow" entity.

Namespace

Drupal\cms_content_sync\Entity

Code

public function getType() {
  static $has_push = null;
  static $has_pull = null;
  if (null === $has_push || null === $has_pull) {
    if (empty($this->sync_entities)) {
      return null;
    }
    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;
}