/** * getContent() * * @param \Zend\Tool\Project\Context $context * @param string $method * @param mixed $parameters */ public function getContent(Context $context, $method, $parameters) { $streamUri = $this->_storage->getStreamUri($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.phtml'); ob_start(); include $streamUri; $content = ob_get_clean(); return $content; }
/** * getContent() * * @param \Zend\Tool\Project\Context $context * @param string $method * @param mixed $parameters * @return string */ public function getContent(Context $context, $method, $parameters) { $streamUri = $this->_storage->getStreamUri($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.php'); if (method_exists($context, 'getCodeGenerator')) { $codeGenerator = $context->getCodeGenerator(); } else { $codeGenerator = new FileGenerator(); } $codeGenerator = (include $streamUri); if (!$codeGenerator instanceof AbstractGenerator) { throw new Exception\RuntimeException('Custom file at ' . $streamUri . ' did not return the $codeGenerator object.'); } return $codeGenerator->generate(); }
/** * Enter description here... * * @param \Zend\Tool\Project\Context $context * @return \Zend\Tool\Project\Context\Repository */ public function addContext(Context $context) { $isSystem = $context instanceof System; $isTopLevel = $context instanceof System\TopLevelRestrictable; $isOverwritable = !$context instanceof System\NotOverwritable; $index = count($this->_contexts) ? max(array_keys($this->_contexts)) + 1 : 1; $normalName = $this->_normalizeName($context->getName()); if (isset($this->_shortContextNames[$normalName]) && $this->_contexts[$this->_shortContextNames[$normalName]]['isOverwritable'] === false) { throw new Exception('Context ' . $context->getName() . ' is not overwriteable.'); } $this->_shortContextNames[$normalName] = $index; $this->_contexts[$index] = array('isTopLevel' => $isTopLevel, 'isSystem' => $isSystem, 'isOverwritable' => $isOverwritable, 'normalName' => $normalName, 'context' => $context); return $this; }