You are here

public function FlowControllerPerBundle::getType in CMS Content Sync 2.1.x

Return value

null|string

Overrides IFlowController::getType

File

src/Controller/FlowControllerPerBundle.php, line 225

Class

FlowControllerPerBundle

Namespace

Drupal\cms_content_sync\Controller

Code

public function getType() {
  static $has_push = null;
  static $has_pull = null;
  if (null === $has_push || null === $has_pull) {
    foreach ($this
      ->getEntityTypeConfig() as $bundles) {
      foreach ($bundles 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 Flow::TYPE_BOTH;
    }
    return Flow::TYPE_PUSH;
  }
  if ($has_pull) {
    return Flow::TYPE_PULL;
  }
  return null;
}