private function addRouteForController($controllerClass) { $ref = new ReflectionClass($controllerClass); $annotations = $this->reflectionHelper->getAnnotations($ref->getDocComment()); // these are used by the generated code /** @noinspection PhpUnusedLocalVariableInspection */ $container = $this->container; /** @noinspection PhpUnusedLocalVariableInspection */ $app = $this->app; $middlewareAnnotations = $annotations->getWithName('middleware'); foreach ($annotations->getWithName('route') as $ano) { $builder = new RouteBuilder(); $values = $ano->getValues(); $builder->setMethod(strtolower($values[0])); $builder->setControllerName($controllerClass); $builder->setRoute($values[1]); preg_match_all('/\\/:([a-z0-9]+)/i', $values[1], $matches); foreach ($matches[1] as $match) { $builder->addParam($match); } foreach ($middlewareAnnotations as $midAno) { $midValues = $midAno->getValues(); $builder->addMiddleware($midValues[0]); } eval($builder->render()); } }
public function __construct($directory, $extension, $namespace = NULL) { $this->extension = $extension; $this->directory = $directory; $this->namespace = empty($namespace) ? '' : $namespace; if (($systemCache = $this->extension->getApp()->getCacheRepository('system')) != NULL && is_array($controllerClassFiles = $systemCache->get($this->directory . '::fileList'))) { } else { // Make sure all PHP files in the directory are included $controllerClassFiles = DirectoryHelper::directoryToArray($this->directory, TRUE, '.php'); if ($systemCache != NULL) { $systemCache->forever($this->directory . '::fileList', $controllerClassFiles); } } foreach ($controllerClassFiles as $controllerClassFile) { include_once $controllerClassFile; $controllerClass = ReflectionHelper::createClassName($this->namespace, basename($controllerClassFile, '.php')); $this->controllerClasses[] = $controllerClass; $controller = new $controllerClass($this->extension); $rclass = new \ReflectionClass($controller); if ($rclass->isSubclassOf('\\MABI\\ModelController')) { /** * @var $controller \MABI\ModelController */ $this->overriddenModelClasses[] = $controller->getModelClass(); } $this->controllers[] = $controller; } }
public function loadModels() { foreach ($this->modelClassFiles as $modelClassFile) { $this->modelClasses[] = ReflectionHelper::createClassName($this->namespace, basename($modelClassFile, '.php')); } return $this->modelClasses; }
/** * Tests the JImage::__construct method. * * @return void * * @since 11.4 */ public function testConstructor() { // Create a image handle of the correct size. $imageHandle = imagecreatetruecolor(100, 100); $filter = new JImageFilterBrightness($imageHandle); $this->assertEquals(ReflectionHelper::getValue($filter, 'handle'), $imageHandle); }
/** * @dataProvider dataProviderForTestGetMemoryLimitInKB * * @param string $memoryLimitFormatted * @param float $expectedMemoryLimitInKB * @return void */ public function testGetMemoryLimitInKB($memoryLimitFormatted, $expectedMemoryLimitInKB) { /** @var CachingStrategyFactory|\PHPUnit_Framework_MockObject_MockObject $factoryStub */ $factoryStub = $this->getMockBuilder('\\Box\\Spout\\Reader\\XLSX\\Helper\\SharedStringsCaching\\CachingStrategyFactory')->disableOriginalConstructor()->setMethods(['getMemoryLimitFromIni'])->getMock(); $factoryStub->method('getMemoryLimitFromIni')->willReturn($memoryLimitFormatted); $memoryLimitInKB = \ReflectionHelper::callMethodOnObject($factoryStub, 'getMemoryLimitInKB'); $this->assertEquals($expectedMemoryLimitInKB, $memoryLimitInKB); }
public static function doInit() { include implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'library', 'redbean', 'rb.php']); $dsn = "mysql:host=" . Config::$dbHost . ";dbname=" . Config::$dbName; $username = Config::$dbUser; $password = Config::$dbPassword; R::setup($dsn, $username, $password, true); ReflectionHelper::loadClasses(__DIR__ . DIRECTORY_SEPARATOR . 'Models'); }
/** * @dataProvider dataProviderForTestFormatNumericCellValueWithNumbers * * @param int|float|string $value * @param int|float $expectedFormattedValue * @param string $expectedType * @return void */ public function testFormatNumericCellValueWithNumbers($value, $expectedFormattedValue, $expectedType) { $styleHelperMock = $this->getMockBuilder('Box\\Spout\\Reader\\XLSX\\Helper\\StyleHelper')->disableOriginalConstructor()->getMock(); $styleHelperMock->expects($this->once())->method('shouldFormatNumericValueAsDate')->will($this->returnValue(false)); $formatter = new CellValueFormatter(null, $styleHelperMock); $formattedValue = \ReflectionHelper::callMethodOnObject($formatter, 'formatNumericCellValue', $value, 0); $this->assertEquals($expectedFormattedValue, $formattedValue); $this->assertEquals($expectedType, gettype($formattedValue)); }
/** * Resets any static vars that were set to their * original values (to not screw up later unit test runs). * * @return void */ public static function reset() { foreach (self::$privateVarsToReset as $class => $valueNames) { foreach ($valueNames as $valueName => $originalValue) { self::setStaticValue($class, $valueName, $originalValue, $saveOriginalValue = false); } } self::$privateVarsToReset = array(); }
public function test_safe_anchor() { $safe_anchor = ReflectionHelper::getPrivateMethodInvoker($this->obj, 'safe_anchor'); $actual = $safe_anchor('news/local/123', 'My News', array('title' => 'The best news!')); $expected = '<a href="http://localhost/index.php/news/local/123" title="The best news!">My News</a>'; $this->assertEquals($expected, $actual); $actual = $safe_anchor('news/local/123', '<s>abc</s>', array('<s>name</s>' => '<s>val</s>')); $expected = '<a href="http://localhost/index.php/news/local/123" <s>name</s>="<s>val</s>"><s>abc</s></a>'; $this->assertEquals($expected, $actual); }
/** * @return void */ public function testExtractSharedStringsShouldCreateTempFileWithSharedStrings() { $this->sharedStringsHelper->extractSharedStrings(); $tempFolder = \ReflectionHelper::getValueOnObject($this->sharedStringsHelper, 'tempFolder'); $filesInTempFolder = $this->getFilesInFolder($tempFolder); $this->assertEquals(1, count($filesInTempFolder), 'One temp file should have been created in the temp folder.'); $tempFileContents = file_get_contents($filesInTempFolder[0]); $tempFileContentsPerLine = explode(PHP_EOL, $tempFileContents); $this->assertEquals('s1--A1', $tempFileContentsPerLine[0]); $this->assertEquals('s1--E5', $tempFileContentsPerLine[24]); }
public function getReturnType() { if ($this->getDocblock()->hasTag('return')) { $return = $this->getDocblock()->getTag('return'); /* @var $return \Zend\Reflection\Docblock\Tag\ReturnTag */ $type = $return->getType(); ReflectionHelper::processReturnCollection($this, $type); } else { $type = $this->detectReturn(); } return $type; }
public function setUp() { $twig = new Twig(); $loader = new Twig_Loader_Array(['base_url' => '{{ base_url(\'"><s>abc</s><a name="test\') }}', 'site_url' => '{{ site_url(\'"><s>abc</s><a name="test\') }}', 'anchor' => '{{ anchor(uri, title, attributes) }}']); $setLoader = ReflectionHelper::getPrivateMethodInvoker($twig, 'setLoader'); $setLoader($loader); $resetTwig = ReflectionHelper::getPrivateMethodInvoker($twig, 'resetTwig'); $resetTwig(); $addFunctions = ReflectionHelper::getPrivateMethodInvoker($twig, 'addFunctions'); $addFunctions(); $this->obj = $twig; $this->twig = $twig->getTwig(); }
public function process(array $documents, &$context) { Database::delete('usermedia', ['user_id' => $context->user->id]); $context->user->cool = false; foreach (Media::getConstList() as $media) { $key = $media == Media::Anime ? self::URL_ANIMELIST : self::URL_MANGALIST; $isPrivate = strpos($documents[$key]->content, 'This list has been made private by the owner') !== false; $key = $media == Media::Anime ? self::URL_ANIMEINFO : self::URL_MANGAINFO; $doc = $documents[$key]; $dom = self::getDOM($doc); $xpath = new DOMXPath($dom); if ($xpath->query('//myinfo')->length == 0) { throw new BadProcessorDocumentException($doc, 'myinfo block is missing'); } if (strpos($doc->content, '</myanimelist>') === false) { throw new BadProcessorDocumentException($doc, 'list is only partially downloaded'); } $nodes = $xpath->query('//anime | //manga'); $data = []; foreach ($nodes as $root) { $mediaMalId = Strings::makeInteger(self::getNodeValue($xpath, 'series_animedb_id | series_mangadb_id', $root)); $score = Strings::makeInteger(self::getNodeValue($xpath, 'my_score', $root)); $startDate = Strings::makeDate(self::getNodeValue($xpath, 'my_start_date', $root)); $finishDate = Strings::makeDate(self::getNodeValue($xpath, 'my_finish_date', $root)); $status = Strings::makeEnum(self::getNodeValue($xpath, 'my_status', $root), [1 => UserListStatus::Completing, 2 => UserListStatus::Finished, 3 => UserListStatus::OnHold, 4 => UserListStatus::Dropped, 6 => UserListStatus::Planned], UserListStatus::Unknown); $finishedEpisodes = null; $finishedChapters = null; $finishedVolumes = null; switch ($media) { case Media::Anime: $finishedEpisodes = Strings::makeInteger(self::getNodeValue($xpath, 'my_watched_episodes', $root)); break; case Media::Manga: $finishedChapters = Strings::makeInteger(self::getNodeValue($xpath, 'my_read_chapters', $root)); $finishedVolumes = Strings::makeInteger(self::getNodeValue($xpath, 'my_read_volumes', $root)); break; default: throw new BadMediaException(); } $data[] = ['user_id' => $context->user->id, 'mal_id' => $mediaMalId, 'media' => $media, 'score' => $score, 'start_date' => $startDate, 'end_date' => $finishDate, 'finished_episodes' => $finishedEpisodes, 'finished_chapters' => $finishedChapters, 'finished_volumes' => $finishedVolumes, 'status' => $status]; } Database::insert('usermedia', $data); $dist = RatingDistribution::fromEntries(ReflectionHelper::arraysToClasses($data)); $daysSpent = Strings::makeFloat(self::getNodeValue($xpath, '//user_days_spent_watching')); $user =& $context->user; $user->{Media::toString($media) . '_days_spent'} = $daysSpent; $user->{Media::toString($media) . '_private'} = $isPrivate; $user->cool |= ($dist->getRatedCount() >= 50 and $dist->getStandardDeviation() >= 1.5); R::store($user); } }
public function toArray($instance) { $ref = new ReflectionClass($instance); $fields = $ref->getProperties(); $result = array(); foreach ($fields as $field) { if ($this->reflectionHelper->hasAnnotation($field->getDocComment(), 'jsonIgnore')) { continue; } if ($this->reflectionHelper->hasAnnotation($field->getDocComment(), 'calculatedBy')) { $annotations = $this->reflectionHelper->getAnnotations($field->getDocComment()); $calculatedByAnnotations = $annotations->getWithName('calculatedBy'); $values = $calculatedByAnnotations[0]->getValues(); $instance->{$values}[0](); } $field->setAccessible(true); $value = $field->getValue($instance); if (!is_null($value)) { $result[$field->getName()] = $this->getValue($value); } } return $result; }
public function getDocJSON(Parser $parser) { $doc = parent::getDocJSON($parser); $rClass = new \ReflectionClass(get_called_class()); if (in_array('show-model', ReflectionHelper::getDocDirective($rClass->getDocComment(), 'docs'))) { /** * @var $model \MABI\Model */ $model = call_user_func($this->modelClass . '::init', $this->getApp()); if (empty($doc['models'])) { $doc['models'] = array(); } array_unshift($doc['models'], $model->getDocOutput($parser)); } return $doc; }
/** * @return void */ public function testGetStringAtIndexWithFileBasedStrategy() { // force the file-based strategy by setting no memory limit $originalMemoryLimit = ini_get('memory_limit'); ini_set('memory_limit', '-1'); $resourcePath = $this->getResourcePath('sheet_with_lots_of_shared_strings.xlsx'); $sharedStringsHelper = new SharedStringsHelper($resourcePath); $sharedStringsHelper->extractSharedStrings(); $sharedString = $sharedStringsHelper->getStringAtIndex(0); $this->assertEquals('str', $sharedString); $sharedString = $sharedStringsHelper->getStringAtIndex(CachingStrategyFactory::MAX_NUM_STRINGS_PER_TEMP_FILE + 1); $this->assertEquals('str', $sharedString); $usedCachingStrategy = \ReflectionHelper::getValueOnObject($sharedStringsHelper, 'cachingStrategy'); $this->assertTrue($usedCachingStrategy instanceof FileBasedStrategy); $sharedStringsHelper->cleanup(); ini_set('memory_limit', $originalMemoryLimit); }
public static function init() { $dir = implode(DIRECTORY_SEPARATOR, ['src', 'ControllerModules']); $classNames = ReflectionHelper::loadClasses($dir); foreach ($classNames as $className) { $pos = strpos($className, 'Controller'); $controllerClassName = substr($className, 0, $pos + 10); if (!isset(self::$modules[$controllerClassName])) { self::$modules[$controllerClassName] = []; } self::$modules[$controllerClassName][] = $className; } foreach (self::$modules as $controllerClassName => &$classNames) { uasort($classNames, function ($a, $b) { return $a::getOrder() - $b::getOrder(); }); } }
/** * Should be in the format (all required): * static $SAMPLE_ERROR_KEY = array( * 'message' => 'sample error message', * 'httpcode' => '401', * 'code' => 1); // optional */ function __construct() { $rClass = new \ReflectionClass(get_called_class()); $rProperties = $rClass->getProperties(\ReflectionProperty::IS_STATIC); $defaultProps = $rClass->getDefaultProperties(); foreach ($rProperties as $rProperty) { $ignoreAnnotation = ReflectionHelper::getDocDirective($rProperty->getDocComment(), 'ignore'); if (!empty($ignoreAnnotation) || !is_array($defaultProps[$rProperty->getName()]) || empty($defaultProps[$rProperty->getName()])) { continue; } $propertyKeys = array_keys($defaultProps[$rProperty->getName()]); $key = $propertyKeys[0]; $errorResponseArray = $defaultProps[$rProperty->getName()][$key]; if (empty($errorResponseArray['message']) || empty($errorResponseArray['httpcode'])) { continue; } $this->errorResponses[$key] = ErrorResponse::FromArray($errorResponseArray); } }
public function __construct($modelClasses, $extension) { $this->extension = $extension; $this->modelClasses = $modelClasses; foreach ($this->modelClasses as $modelClass) { $rClass = new \ReflectionClass($modelClass); $properties = ReflectionHelper::getDocDirective($rClass->getDocComment(), 'model'); if (!in_array('NoController', $properties)) { /** * @var $controller Controller */ $controller = RESTModelController::generate($modelClass, $this->extension); // Load the middleware that's specified in the Model $middlewares = ReflectionHelper::getDocDirective($rClass->getDocComment(), 'middleware'); foreach ($middlewares as $middlewareClass) { $controller->addMiddlewareByClass($middlewareClass); } $this->controllers[] = $controller; } } }
/** * Tests the JDatabase::quoteName method. * * @return void * * @since 11.4 */ public function testQuoteName() { $this->assertThat($this->db->quoteName('test'), $this->equalTo('[test]'), 'Tests the left-right quotes on a string.'); $this->assertThat($this->db->quoteName('a.test'), $this->equalTo('[a].[test]'), 'Tests the left-right quotes on a dotted string.'); $this->assertThat($this->db->quoteName(array('a', 'test')), $this->equalTo(array('[a]', '[test]')), 'Tests the left-right quotes on an array.'); $this->assertThat($this->db->quoteName(array('a.b', 'test.quote')), $this->equalTo(array('[a].[b]', '[test].[quote]')), 'Tests the left-right quotes on an array.'); $this->assertThat($this->db->quoteName(array('a.b', 'test.quote'), array(null, 'alias')), $this->equalTo(array('[a].[b]', '[test].[quote] AS [alias]')), 'Tests the left-right quotes on an array.'); $this->assertThat($this->db->quoteName(array('a.b', 'test.quote'), array('alias1', 'alias2')), $this->equalTo(array('[a].[b] AS [alias1]', '[test].[quote] AS [alias2]')), 'Tests the left-right quotes on an array.'); $this->assertThat($this->db->quoteName((object) array('a', 'test')), $this->equalTo(array('[a]', '[test]')), 'Tests the left-right quotes on an object.'); ReflectionHelper::setValue($this->db, 'nameQuote', '/'); $this->assertThat($this->db->quoteName('test'), $this->equalTo('/test/'), 'Tests the uni-quotes on a string.'); }
<?php chdir('..'); require_once 'src/core.php'; $dir = implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'src', 'Controllers']); $classNames = ReflectionHelper::loadClasses($dir); $classNames = array_filter($classNames, function ($className) { return substr_compare($className, 'Controller', -10, 10) === 0; }); $controllerContext = new ControllerContext(); $controllerContext->cache->bypass(!empty($_GET['bypass-cache'])); $viewContext = new ViewContext(); $logger = new Logger(__FILE__); if (!empty(Config::$maintenanceMessage)) { $viewContext->viewName = 'maintenance'; $viewContext->layoutName = 'layout-headerless'; View::render($viewContext); } elseif (isset($_GET['e'])) { try { $viewContext->viewName = 'error-' . $_GET['e']; View::render($viewContext); } catch (Exception $e) { $viewContext->viewName = 'error-404'; View::render($viewContext); } } else { try { $url = $_SERVER['REQUEST_URI']; if (!empty($_SERVER['HTTP_HOST']) and !empty(Config::$enforcedDomain) and $_SERVER['HTTP_HOST'] != Config::$enforcedDomain) { $fixedUrl = 'https://' . Config::$enforcedDomain . '/' . trim($_SERVER['REQUEST_URI'], '/'); HttpHeadersHelper::setCurrentHeader('Location', $fixedUrl);
public static function doInit() { include implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'lib', 'redbean', 'RedBean', 'redbean.inc.php']); ReflectionHelper::loadClasses(__DIR__ . DIRECTORY_SEPARATOR . 'Models'); self::loadDatabase('media.sqlite'); }
public function getDocOutput(Parser $parser) { $fieldDocs = array(); $rClass = new \ReflectionClass($this); $rProperties = $rClass->getProperties(\ReflectionProperty::IS_PUBLIC); foreach ($rProperties as $rProperty) { /* * Ignores writing any model property with 'internal' or 'system' options */ if (in_array('internal', ReflectionHelper::getDocDirective($rProperty->getDocComment(), 'field')) || in_array('system', ReflectionHelper::getDocDirective($rProperty->getDocComment(), 'field'))) { continue; } $varType = 'unknown'; // Pulls out the type following the pattern @var <TYPE> from the doc comments of the property $varDocs = ReflectionHelper::getDocDirective($rProperty->getDocComment(), 'var'); if (!empty($varDocs)) { $varType = $varDocs[0]; } $fieldDoc = array('name' => $rProperty->getName(), 'type' => $varType, 'doc' => $parser->parse(ReflectionHelper::getDocText($rProperty->getDocComment()))); $fieldDocs[] = $fieldDoc; } return array('name' => get_called_class(), 'fielddocs' => $fieldDocs); }
/** * @deprecated Use ReflectionHelper::readPrivateProperty() * @param object $object * @param string $property * @param string|null $class * @return mixed */ public static function readPrivateProperty($object, $property, $class = null) { return ReflectionHelper::readPrivateProperty($object, $property, $class); }
/** * @return void */ public function testAddRowShouldNotCreateNewSheetsIfMaxRowsReachedAndOptionTurnedOff() { $fileName = 'test_add_row_should_not_create_new_sheets_if_max_rows_reached_and_option_turned_off.xlsx'; $dataRows = [['xlsx--sheet1--11', 'xlsx--sheet1--12'], ['xlsx--sheet1--21', 'xlsx--sheet1--22', 'xlsx--sheet1--23'], ['xlsx--sheet1--31', 'xlsx--sheet1--32']]; // set the maxRowsPerSheet limit to 2 \ReflectionHelper::setStaticValue('\\Box\\Spout\\Writer\\XLSX\\Internal\\Workbook', 'maxRowsPerWorksheet', 2); $writer = $this->writeToXLSXFile($dataRows, $fileName, true, $shouldCreateSheetsAutomatically = false); $this->assertEquals(1, count($writer->getSheets()), 'Only 1 sheet should have been created.'); $this->assertInlineDataWasNotWrittenToSheet($fileName, 1, 'xlsx--sheet1--31'); \ReflectionHelper::reset(); }
public function getFriends() { $query = 'SELECT * FROM userfriend' . ' WHERE user_id = ?' . ' ORDER BY name COLLATE NOCASE ASC'; $rows = R::getAll($query, [$this->id]); return ReflectionHelper::arraysToClasses($rows); }
/** * @dataProvider dataProviderForTestConvertURIToUseRealPath * * @param string $URI * @param string $expectedConvertedURI * @return void */ public function testConvertURIToUseRealPath($URI, $expectedConvertedURI) { $tempFolder = sys_get_temp_dir(); touch($tempFolder . '/test.xlsx'); $xmlReader = new XMLReader(); $convertedURI = \ReflectionHelper::callMethodOnObject($xmlReader, 'convertURIToUseRealPath', $URI); $this->assertEquals($expectedConvertedURI, $convertedURI); unlink($tempFolder . '/test.xlsx'); }
/** * @dataProvider dataProviderForTestFileExistsWithinZip * * @param string $innerFilePath * @param bool $expectedResult * @return void */ public function testFileExistsWithinZip($innerFilePath, $expectedResult) { $resourcePath = $this->getResourcePath('one_sheet_with_inline_strings.xlsx'); $zipStreamURI = 'zip://' . $resourcePath . '#' . $innerFilePath; $xmlReader = new XMLReader(); $isZipStream = \ReflectionHelper::callMethodOnObject($xmlReader, 'fileExistsWithinZip', $zipStreamURI); $this->assertEquals($expectedResult, $isZipStream); }
/** * todo: docs * * @param Parser $parser * * @endpoint ignore * @return array */ public function getDocJSON(Parser $parser) { $myClass = get_called_class(); $rClass = new \ReflectionClass($myClass); $this->configureMiddlewares($this->middlewares); $doc = array(); $doc['name'] = $this->documentationName; $doc['description'] = $parser->parse(ReflectionHelper::getDocText($rClass->getDocComment())); // Adding documentation for custom controller actions $rMethods = $rClass->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($rMethods as $rMethod) { // If there is a '@endpoint ignore' property, the function is not served as an endpoint if (in_array('ignore', ReflectionHelper::getDocDirective($rMethod->getDocComment(), 'endpoint'))) { continue; } $methodDoc = array(); $methodDoc['InternalMethodName'] = $rMethod->name; if (strpos($rMethod->name, 'get', 0) === 0) { $methodDoc['MethodName'] = substr($rMethod->name, 3); $methodDoc['HTTPMethod'] = 'GET'; } elseif (strpos($rMethod->name, 'put', 0) === 0) { $methodDoc['MethodName'] = substr($rMethod->name, 3); $methodDoc['HTTPMethod'] = 'PUT'; } elseif (strpos($rMethod->name, 'post', 0) === 0) { $methodDoc['MethodName'] = substr($rMethod->name, 4); $methodDoc['HTTPMethod'] = 'POST'; } elseif (strpos($rMethod->name, 'delete', 0) === 0) { $methodDoc['MethodName'] = substr($rMethod->name, 6); $methodDoc['HTTPMethod'] = 'DELETE'; } else { continue; } $action = strtolower($methodDoc['MethodName']); $methodDoc['URI'] = "/{$this->base}" . (empty($action) ? '' : "/{$action}"); $methodDoc['Synopsis'] = $parser->parse(ReflectionHelper::getDocText($rMethod->getDocComment())); $methodDoc['parameters'] = $this->getDocParameters($rMethod); if (empty($methodDoc['MethodName'])) { $methodDoc['MethodName'] = ucwords($this->base); } // Allow controller middlewares to modify the documentation for this method if (!empty($this->middlewares)) { $middleware = reset($this->middlewares); $middleware->documentMethod($rClass, $rMethod, $methodDoc); } if (!empty($methodDoc)) { $doc['methods'][] = $methodDoc; } } foreach (ReflectionHelper::getDocDirective($rClass->getDocComment(), 'docs-attach-model') as $includeModelClass) { /** * @var $model \MABI\Model */ $model = call_user_func($includeModelClass . '::init', $this->getApp()); $doc['models'][] = $model->getDocOutput($parser); } return $doc; }
public function getModelClasses() { $modelClasses = array(); foreach ($this->extensions as $extension) { $modelClasses = array_merge($modelClasses, $extension->getModelClasses()); } foreach ($this->modelLoaders as $modelLoader) { $loadModelClasses = $modelLoader->loadModels(); foreach ($loadModelClasses as $modelClass) { // allow model overrides foreach ($modelClasses as $k => $overriddenModel) { if (ReflectionHelper::stripClassName($modelClass) == ReflectionHelper::stripClassName($overriddenModel)) { unset($modelClasses[$k]); break; } } $modelClasses[] = $modelClass; } } return $modelClasses; }