protected function generateConfigs($target) { $before = get_declared_classes(); $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($target, $flags)) as $fileInfo) { /** * @var \SplFileInfo $fileInfo */ if ($fileInfo->isFile() && preg_match('/\\.(php[0-9.]*|inc)$/', $fileInfo->getFilename())) { include_once $fileInfo->getPathname(); } } $after = get_declared_classes(); $new = array_diff($after, $before); $config = array(); foreach ($new as $class) { $config[$class] = $this->driver->getConfig($class); } return $config; }
/** * @return JsonAnnotationDriver */ public function getJsonDriverInstance() { if (!isset($this->_jsonDriver)) { $driver = new JsonAnnotationDriver($this->getAnnotationReaderFactoryInstance()); $driver->setAnnotationNamespace('\\Weasel\\JsonMarshaller\\Config\\DoctrineAnnotations'); $this->_autowire($driver); $this->_jsonDriver = $driver; } return $this->_jsonDriver; }
public function __construct(LoggerInterface $logger = null, IAnnotationReaderFactory $annotationReaderFactory = null) { parent::__construct($logger, $annotationReaderFactory); $this->setCache(new ArrayCache()); }
function addConfig($class, &$config, \Weasel\JsonMarshaller\Config\AnnotationDriver $provider) { $config[ltrim($class, '\\')] = $provider->getConfig($class); }