/** * Get the migration stub file. * * @param string $table * @return void */ protected function getStub($table, $create) { if (is_null($table)) { return $this->files->get($this->getStubPath() . '/blank.php'); } else { $stub = $create ? 'create.php' : 'update.php'; return $this->files->get($this->getStubPath() . "/{$stub}"); } }
/** * Get all of the method stubs for the given options. * * @param array $options * @return array */ protected function getMethodStubs($options) { $stubs = array(); // Each stub is conveniently kept in its own file so we can just grab the ones // we need from disk to build the controller file. Once we have them all in // an array we will return this list of methods so they can be joined up. foreach ($this->getMethods($options) as $method) { $stubs[] = $this->files->get(__DIR__ . "/stubs/{$method}.php"); } return $stubs; }
/** * Get the stub for a ServiceProvider. * * @param bool $plain * @return string */ protected function getProviderStub($plain) { if ($plain) { return $this->files->get(__DIR__ . '/stubs/plain.provider.php'); } else { return $this->files->get(__DIR__ . '/stubs/provider.php'); } }
/** * 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)) { return json_decode($this->files->get($path), true); } }
/** * Retrieve an item from the cache by key. * * @param string $key * @return mixed */ protected function retrieveItem($key) { $path = $this->path($key); // If the file doesn't exists, we obviously can't return the cache so we will // just return null. Otherwise, we'll get the contents of the file and get // the expiration UNIX timestamps from the start of the file's contents. if (!$this->files->exists($path)) { return null; } $contents = $this->files->get($path); $expiration = substr($contents, 0, 10); // If the current time is greater than expiration timestamps we will delete // the file and return null. This helps clean up the old files and keeps // this directory much cleaner for us as old files aren't hanging out. if (time() >= $expiration) { return $this->removeItem($key); } return unserialize(substr($contents, 10)); }
/** * Retrieve a session payload from storage. * * @param string $id * @return array|null */ public function retrieveSession($id) { if ($this->files->exists($path = $this->getFilePath($id))) { return unserialize($this->files->get($path)); } }