/** * {@inheritDoc} */ public function read($sessionId) { if ($this->files->exists($path = $this->path . DS . $sessionId)) { return $this->files->get($path); } return ''; }
/** * Find the given view in the list of paths. * * @param string $name * @param array $paths * @return string * * @throws \InvalidArgumentException */ protected function findViewFile($name) { foreach ($this->getPossibleViewFiles($name) as $file) { if ($this->files->exists($file)) { return $file; } } }
/** * Write the completed stub to disk. * * @param string $stub * @param string $controller * @param string $path * @return void */ protected function writeFile($stub, $controller, $path) { if (str_contains($controller, '\\')) { $this->makeDirectory($controller, $path); } $controller = str_replace('\\', DS, $controller); if (!$this->files->exists($fullPath = $path . DS . $controller . '.php')) { return $this->files->put($fullPath, $stub); } }
/** * Execute the console command. * * @return void */ public function fire() { $destination = $this->getPath() . DS . 'Reminders.php'; if (!$this->files->exists($destination)) { $this->files->copy(__DIR__ . DS . 'stubs' . DS . 'controller.stub', $destination); $this->info('Password reminders controller created successfully!'); $this->comment("Route: Route::controller('password', 'RemindersController');"); } else { $this->error('Password reminders controller already exists!'); } }
/** * Load the environment variables for the given environment. * * @param string $environment * @return array */ public function load($environment = null) { if ($environment == 'production') { $environment = null; } if (!$this->files->exists($path = $this->getFile($environment))) { return array(); } else { return $this->files->getRequire($path); } }
/** * Remove an item from the cache. * * @param string $key * @return void */ public function forget($key) { $file = $this->path($key); if ($this->files->exists($file)) { $this->files->delete($file); } }
/** * generate the console command. * * @return mixed */ protected function generate() { foreach ($this->listFiles as $key => $file) { $filePath = $this->makeFilePath($this->listFolders[$key], $this->container['name']); $this->resolveByPath($filePath); $file = $this->formatContent($file); $find = basename($filePath); $filePath = strrev(preg_replace(strrev("/{$find}/"), '', strrev($filePath), 1)); $filePath = $filePath . $file; if ($this->files->exists($filePath)) { return $this->error($this->type . ' already exists!'); } $this->makeDirectory($filePath); foreach ($this->signOption as $option) { if ($this->option($option)) { $stubFile = $this->listStubs[$option][$key]; $this->resolveByOption($this->option($option)); break; } } if (!isset($stubFile)) { $stubFile = $this->listStubs['default'][$key]; } $this->files->put($filePath, $this->getStubContent($stubFile)); } return $this->info($this->type . ' created successfully.'); }
/** * Load the service provider manifest PHP file. * * @return array */ public function loadManifest() { // The service manifest is a file containing a representation of every // service provided by the application and whether its provider is using // deferred loading or should be eagerly loaded on each request to us. if ($this->files->exists($this->manifestPath)) { $manifest = $this->files->getRequire($this->manifestPath); return array_merge(array('when' => array()), $manifest); } }
/** * Load the service provider manifest JSON file. * * @return array */ public function loadManifest() { $path = $this->manifestPath . '/services.json'; // The service manifest is a file containing a JSON representation of every // service provided by the application and whether its provider is using // deferred loading or should be eagerly loaded on each request to us. if ($this->files->exists($path)) { $manifest = json_decode($this->files->get($path), true); return array_merge($this->default, $manifest); } }