Return the workflow definition cache component used by this workflow source or NULL
if no cache is used.

@throws InvalidConfigException
@return NULL|yii\caching\Cache
325285
public function getDefinitionCache()
	{
		if( !isset($this->definitionCache)) {
			return null;
		}
		if( ! isset($this->_dc)) {
			if( is_string($this->definitionCache)) {
				$this->_dc = Yii::$app->get($this->definitionCache);
			} elseif( is_array($this->definitionCache)) {
				$this->_dc = Yii::createObject($this->definitionCache);
			}  elseif( is_object($this->definitionCache)) {
				$this->_dc = $this->definitionCache;
			}  else {
				throw new InvalidConfigException('invalid "definitionCache" attribute : string or object expected');
			}
			if( ! $this->_dc instanceof yii\caching\Cache ) {
				throw new InvalidConfigException('the workflow definition cache must implement the yii\caching\Cache interface');
			}
		}
		return $this->_dc;
	}
934505
public function getFrontEndDataObject()
    {
        $obj = null;
        $ba = $this->BaseAction();

        if ($ba->hasMethod('getFrontEndDataObject')) {
            $obj = $ba->getFrontEndDataObject();
        } else {
            $obj = $this->Workflow()->getTarget();
        }

        return $obj;
    }
818134
public function getEmailHash()
	{
		if ($this->_emailHash !== null) {
			return $this->_emailHash;
		} elseif ($this->email === null) {
			throw new InvalidConfigException('No email specified for Gravatar image Widget.');
		}
		return $this->_emailHash = md5(strtolower(trim($this->email)));
	}
261049
public function getDefinitionsFor($object)
    {

        // Retrieve the main workflow definition.

        $default = $this->getDefinitionFor($object);
        if ($default) {
            // Merge the additional workflow definitions.

            return array_merge(array(
                $default
            ), $object->AdditionalWorkflowDefinitions()->toArray());
        }
        return null;
    }
29185
protected function sectionCaching()
	{
		$ret = [];
		foreach (Yii::$app->components as $id=>$component) {
			$instance = Yii::$app->{$id};
			if (!($instance instanceof Cache)) continue;

			$title = $this->valueCode($id);

			ob_start();
			ActiveForm::begin();
			echo $this->valueCode($instance->className());
			echo $this->valueModal('Cache ' . $id, $this->valueVarDump($instance), 'Show config');
			echo Html::hiddenInput('flush-cache', $id);
			echo Html::submitButton('Flush', [
				'class'=>'btn btn-xs btn-danger',
				'data'=>['confirm'=>'Are you sure?'],
			]);
			ActiveForm::end();

			$ret[$title] = ob_get_clean();
		}

		return $ret;
	}
952072
public function getStateCode()
    {
        $code = $this->isOnline(true) ? '1' : '0';
        $code .= null !== $this->_workflow_state
            ? '_'.$this->_workflow_state->getCode()
            : ''
        ;

        return $code;
    }
135921
public function get($id, bool $throwException = true)
    {
        if (!$this->_container->has($id)) {
            if ($throwException) {
                throw new InvalidConfigException("Unknown component ID: $id");
            }
            return null;
        }

        return $this->_container->get($id);
    }
1158142
protected function proxy() {
        if (!$this->context) {
            $this->context = new WorkflowContext(
                $this->version,
                $this->solution['workspaceSid'],
                $this->solution['sid']
            );
        }

        return $this->context;
    }
165123
protected function getSubService($serviceName)
    {
        if ($this->_subService[$serviceName] instanceof Service) {
            return $this->_subService[$serviceName];
        } elseif (!isset($this->_subService[$serviceName])) {
            throw new InvalidConfigException("The {$this->getId()}Service required sub service component `{$serviceName}` is not found.");
        } else {
            $uniqueName = $this->getId() . '/' . $serviceName;
            $this->_subService[$serviceName] = Yii::createObject(array_merge($this->_subService[$serviceName], [
                'service' => $this,
            ]));
            if (!$this->_subService[$serviceName] instanceof Service) {
                throw new InvalidConfigException("The required sub service component `{$uniqueName}` must return
                    an object extends `\\wocenter\\core\\Service`.");
            }
            
            Yii::trace('Loading sub service: ' . $uniqueName, __METHOD__);
            
            return $this->_subService[$serviceName];
        }
    }
340810
public function configureWorkflow($workflowName)
    {
        $this->workflowName = $workflowName;

        $this->workflow = $this->container->getParameter('free_agent_workflow.workflows.'.$this->workflowName, null);

        if (is_null($this->workflow)) {
            throw new WorkflowException('The workflow "'.$this->workflowName.'" does not exist');
        }

        $defaultStep = $this->workflow['default_step'];
        if (!array_key_exists($defaultStep, $this->workflow['steps'])) {
            throw new WorkflowException('The default step of "'.$this->workflowName.'" does not exist');
        }

        foreach ($this->workflow['steps'] as $stepName => $stepConfiguration) {
            $this->steps->offsetSet($stepName, new Step($stepName, $stepConfiguration));
        }

        $this->defaultStep = new Step($defaultStep, $this->workflow['steps'][$defaultStep]);
        $this->actions     = array_key_exists('actions', $this->workflow) ? $this->workflow['actions'] : array();
        $this->validations = array_key_exists('validations', $this->workflow) ? $this->workflow['validations'] : array();

        return $this->getSteps();
    }
939674
public function init() {
		parent::init();
		if( $this->parser === null ) {
			$this->_p = Yii::createObject([
				'class' => DefaultArrayParser::className()
			]);
		} elseif( $this->parser === false) {
			$this->_p = null;
		} elseif( is_array($this->parser)) {
			$this->_p = Yii::createObject($this->parser);
		} elseif( is_string($this->parser)) {
			$this->_p = Yii::$app->get($this->parser);
		} elseif( is_object($this->parser)) {
			$this->_p = $this->parser;
		} else {
			throw new InvalidConfigException('invalid "parser" attribute : string or array expected');
		}

		if( $this->_p !== null && ! $this->_p instanceof WorkflowArrayParser ) {
			throw new InvalidConfigException('the parser component must implement the WorkflowArrayParser interface');
		}
	}
1343216
protected function getRelationApiEndpoint()
    {
        // build class name
        $class = $this->_query->modelClass;
        // fetch menu api detail from endpoint name
        $menu = Yii::$app->adminmenu->getApiDetail($class::ngRestApiEndpoint());
        
        if (!$menu) {
            throw new InvalidConfigException("Unable to find the API endpoint, maybe insufficent permission or missing admin module context (admin module prefix).");
        }
        
        // @todo what about: admin/
        return 'admin/'.$menu['permissionApiEndpoint'];
    }
169845
public function getRepositoryConfig()
    {
        // Takes configured repository as the reference, if it exists.
        // If not, the first configured repository is considered instead.
        $repositoryAlias = $this->configResolver->getParameter('repository');
        if ($repositoryAlias === null) {
            $aliases = array_keys($this->repositories);
            $repositoryAlias = array_shift($aliases);
        }

        if (empty($repositoryAlias) || !isset($this->repositories[$repositoryAlias])) {
            throw new InvalidRepositoryException(
                "Undefined repository '$repositoryAlias'. Did you forget to configure it in ezpublish_*.yml?"
            );
        }

        return array('alias' => $repositoryAlias) + $this->repositories[$repositoryAlias];
    }
405787
public function needCache(){
		// disabled from configs
		if($this->disabled){
			return false;
		}

		// is post request
		if(Yii::$app->request->isPost){
			return false;
		}

		// has request parameter `disallowHtmlCache`
		if(Yii::$app->request->get('disallowHtmlCache')){
			return false;
		}

		// checking for excluded actions
		$excluded_actions = isset($this->excluded_actions[$this->_controller->id]) ? $this->excluded_actions[$this->_controller->id] : array();
		if($excluded_actions && in_array($this->_action->id, $excluded_actions)){
			return false;
		}

		// Checking for excluded params
		$excluded_params = isset($this->excluded_params[$this->_controller->id]) ? $this->excluded_params[$this->_controller->id] : array();

		foreach($excluded_params as $param => $value){
			if(is_numeric($param)){
				$param = $value;
				$value = null;
			}
			elseif(!is_array($value)){
				$value = array($value);
			}

			if(!isset($this->_controller->{$param})){
				continue;
			}

			if(is_null($value) && $this->_controller->{$param}){
				return false;
			}
			elseif(!is_null($value) && in_array($this->_controller->{$param}, $value)){
				return false;
			}
		}

		return true;
	}
212945
protected function loadDynamicConfig()
    {
        $className = $this->dynamicConfigClass();
        if ($className) {
            $config = $this->modelFactory()->get($className);

            if ($config instanceof StorableInterface && !$config->id()) {
                $config->load(1);
            }

            return $config;
        }

        return null;
    }
745357
protected function getTable(): string
    {
        if ($this->modelClass === null && $this->table === null) {
            throw new InvalidConfigException('Either "modelClass" or "table" must be set.');
        }

        if ($this->table === null) {
            $this->table = with(new $this->modelClass())->getTable();
        }

        if (!Schema::hasTable($this->table)) {
            throw new InvalidConfigException("Table does not exist: {$this->table}");
        }

        return $this->table;
    }
275989
protected function loadCookies()
    {
        $cookies = [];
        if ($this->enableCookieValidation) {
            if ($this->cookieValidationKey == '') {
                throw new InvalidConfigException(get_class($this) . '::$cookieValidationKey must be configured with a secret key.');
            }
            foreach ($this->getCookieParams() as $name => $value) {
                if (!is_string($value)) {
                    continue;
                }
                $data = $this->app->getSecurity()->validateData($value, $this->cookieValidationKey);
                if ($data === false) {
                    continue;
                }
                $data = @unserialize($data);
                if (is_array($data) && isset($data[0], $data[1]) && $data[0] === $name) {
                    $cookies[$name] = Yii::createObject([
                        '__class' => \yii\http\Cookie::class,
                        'name' => $name,
                        'value' => $data[1],
                        'expire' => null,
                    ]);
                }
            }
        } else {
            foreach ($this->getCookieParams() as $name => $value) {
                $cookies[$name] = Yii::createObject([
                    '__class' => \yii\http\Cookie::class,
                    'name' => $name,
                    'value' => $value,
                    'expire' => null,
                ]);
            }
        }

        return $cookies;
    }