Ejemplo n.º 1
0
 function __construct(Application $app)
 {
     $this->app = $app;
     foreach (get_class_methods($this) as $method) {
         if ($this->destroyed) {
             break;
         }
         if (String::startsWith($method, 'test')) {
             $this->{$method}();
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Sets a config value for the loader (i.e. permanently).
  *
  * @param  string  $key
  * @param  mixed   $value
  * @param  string  $environment
  * @return void
  */
 public function set($key, $value = null, $environment = null)
 {
     if (!isset($this->repository)) {
         throw new \RuntimeException('Repo is needed to set config.');
     }
     list($namespace, $group, $item) = $this->repository->parseKey($key);
     $environment = $environment ? $environment : $this->repository->getEnvironment();
     $path = String::remove($this->getPath($namespace), Path::canonicalize(base_path()));
     $parts = "{$environment} - {$namespace} - {$group} - {$item} - {$value}";
     $f = $this->files;
     $storPath = $this->laradicConfig['loaders.file.save_path'];
     $fileName = "global.php";
     if ($namespace) {
         $fileName = (string) \Stringy\Stringy::create($namespace)->slugify()->ensureRight('.php');
     }
     $file = Path::join($storPath, $fileName);
     $items = $f->exists($file) ? $f->getRequire($file) : [];
     $dest = "{$environment}.{$group}" . (isset($item) ? ".{$item}" : '');
     array_set($items, $dest, $value);
     $this->files->put($file, "<?php \n return " . var_export($items, true) . ';');
 }