Пример #1
0
 public function newController($path, $controller)
 {
     $namespace = $this->utils->dosPath($this->utils->dirname($controller));
     $class = $this->utils->filename($controller);
     if ($this->writer->write($path, ['namespace' => $namespace === '.' ? '' : "\\{$namespace}", 'class' => $class])) {
         require_once $path;
     }
 }
Пример #2
0
 public function write($path, $replacements = [], $info = null)
 {
     @mkdir($this->utils->dirname($path), 0777, true);
     if ($result = file_put_contents($path, $this->readData($replacements))) {
         $this->logger->info(($info ?? "Written file") . ": " . realpath($path));
         return $path;
     }
     throw new \Error("Cannot write file: {$path}");
 }