Exemplo n.º 1
0
 public function write(Reflector $reflector)
 {
     $data = $reflector->toArray();
     $hash = hash_file('sha256', $data['getFileName']);
     $fileSize = filesize($data['getFileName']);
     self::$config = [$data['getClassName'] => $data + ['fileSize' => $fileSize, 'fileHash' => $hash]] + self::$config;
     $this->fs->dumpFile(self::PATH . '/config.php', "<?php return " . $this->renderArray(self::$config) . "; " . PHP_EOL . '/*' . PHP_EOL . print_r(self::$config, true) . PHP_EOL . '*/' . PHP_EOL);
 }
Exemplo n.º 2
0
 /**
  * @param $className
  * @return array|ClassProviderInterface
  */
 protected function _getProviders($className)
 {
     if (isset(self::$PROVIDER_MAPPING[$className])) {
         $providers = self::$PROVIDER_MAPPING[$className];
         return $providers;
     } else {
         $providers = $this->reflector->getProviders();
         self::$PROVIDER_MAPPING[$className] = $providers;
         return $providers;
     }
 }
Exemplo n.º 3
0
 public function read(Reflector $reflector, $proxyClassName)
 {
     //        print_r('read' . PHP_EOL);
     if (!isset(self::$config[$reflector->getClassName()])) {
         print_r('read !isset' . PHP_EOL);
         return false;
     }
     $cfg = self::$config[$reflector->getClassName()];
     $file = self::PATH . '/' . $cfg['proxyClassName'] . '.php';
     if ($this->filesystem->exists($file)) {
         include $file;
         return true;
     }
     return false;
 }