當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Filesystem::getRequire方法代碼示例

本文整理匯總了PHP中Illuminate\Filesystem\Filesystem::getRequire方法的典型用法代碼示例。如果您正苦於以下問題:PHP Filesystem::getRequire方法的具體用法?PHP Filesystem::getRequire怎麽用?PHP Filesystem::getRequire使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Filesystem\Filesystem的用法示例。


在下文中一共展示了Filesystem::getRequire方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire(Filesystem $files)
 {
     $langDirectory = base_path('resources' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR);
     $diff = [];
     foreach (ModulesLoader::getRegisteredModules() as $module) {
         if (!is_dir($module->getLocalePath()) or !$module->isPublishable()) {
             continue;
         }
         $locale = $this->input->getOption('locale');
         foreach ($files->directories($module->getLocalePath()) as $localeDir) {
             foreach ($files->allFiles($localeDir) as $localeFile) {
                 $vendorFileDir = $module->getKey() . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFile->getFilename();
                 $vendorFilePath = $langDirectory . $vendorFileDir;
                 if (file_exists($vendorFilePath)) {
                     $localArray = $files->getRequire($localeFile->getRealPath());
                     $vendorArray = $files->getRequire($vendorFilePath);
                     $array = array_keys_exists_recursive($localArray, $vendorArray);
                     $arrayDiff = '';
                     foreach (array_dot($array) as $key => $value) {
                         $arrayDiff .= "{$key}: {$value}\n";
                     }
                     if (empty($arrayDiff)) {
                         continue;
                     }
                     $diff[] = ['modules' . DIRECTORY_SEPARATOR . $vendorFileDir, 'vendor' . DIRECTORY_SEPARATOR . $vendorFileDir];
                     $diff[] = new TableSeparator();
                     $diff[] = [$arrayDiff, var_export(array_merge_recursive($array, $vendorArray), true)];
                     $diff[] = new TableSeparator();
                 }
             }
         }
     }
     $this->table($this->headers, $diff);
 }
開發者ID:KodiComponents,項目名稱:module-core,代碼行數:39,代碼來源:ModuleLocaleDiffCommand.php

示例2: save

 public function save($item, $value, $environment, $group, $namespace = null)
 {
     $path = DIR_APPLICATION . '/config/generated_overrides';
     if (!$this->files->exists($path)) {
         $this->files->makeDirectory($path, 0777);
     } elseif (!$this->files->isDirectory($path)) {
         $this->files->delete($path);
         $this->files->makeDirectory($path, 0777);
     }
     if ($namespace) {
         $path = "{$path}/{$namespace}";
         if (!$this->files->exists($path)) {
             $this->files->makeDirectory($path, 0777);
         } elseif (!$this->files->isDirectory($path)) {
             $this->files->delete($path);
             $this->files->makeDirectory($path, 0777);
         }
     }
     $file = "{$path}/{$group}.php";
     $current = array();
     if ($this->files->exists($file)) {
         $current = $this->files->getRequire($file);
     }
     array_set($current, $item, $value);
     $renderer = new Renderer($current);
     return $this->files->put($file, $renderer->render()) !== false;
 }
開發者ID:meixelsberger,項目名稱:concrete5-5.7.0,代碼行數:27,代碼來源:FileSaver.php

示例3: handle

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     $roles = $this->file->getRequire(base_path(config('trust.permissions')));
     $this->call('trust:permissions');
     $all = Permission::all(['id', 'slug']);
     $create = 0;
     $update = 0;
     foreach ($roles as $slug => $attributes) {
         $role = $this->findRole($slug);
         if ($role) {
             if ($this->option('force')) {
                 ++$update;
                 $role->update($attributes + compact('slug'));
             }
         } else {
             ++$create;
             $role = Role::create($attributes + compact('slug'));
         }
         $permissions = array_reduce(Arr::get($attributes, 'permissions', []), function (Collection $result, string $name) use($all) {
             if (hash_equals('*', $name)) {
                 return $all->pluck('id');
             }
             if ($all->count() === $result->count()) {
                 return $result;
             }
             $filtered = $all->filter(function (Permission $permission) use($name) {
                 return Str::is($name, $permission->slug);
             })->pluck('id');
             return $result->merge($filtered);
         }, new Collection());
         $role->permissions()->sync($permissions->toArray());
     }
     $total = $create + $update;
     $this->line("Installed {$total} roles. <info>({$create} new roles, {$update} roles synced)</info>");
 }
開發者ID:znck,項目名稱:trust,代碼行數:40,代碼來源:InstallRolesCommand.php

示例4: loadPath

 /**
  * Load a locale from a given path.
  *
  * @param  string  $path
  * @param  string  $locale
  * @param  string  $group
  * @return array
  */
 protected function loadPath($path, $locale, $group)
 {
     if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) {
         return $this->files->getRequire($full);
     }
     return array();
 }
開發者ID:shinichi81,項目名稱:laravel4demo,代碼行數:15,代碼來源:FileLoader.php

示例5: findExtensions

 /**
  * Find the extensions.
  *
  * @param  array $paths
  * @return array
  */
 public function findExtensions(array $paths)
 {
     $files = array();
     // Iterate over the paths.
     foreach ($paths as $path) {
         // Find the extension files.
         $found = $this->filesystem->glob($path . '/*/*/extension.php');
         // Check if we found some files.
         if (is_array($found)) {
             // Merge the files.
             $files = array_merge($files, $found);
         }
     }
     $extensions = array();
     // Iterate over the files.
     foreach ($files as $file) {
         // Get the extension attributes.
         $attributes = $this->filesystem->getRequire($file);
         // Check if the attributes are valid.
         if (is_array($attributes) && isset($attributes['slug'])) {
             // Initialise the extension class.
             $extensions[$attributes['slug']] = new Extension(dirname($file), $attributes);
         }
     }
     return $extensions;
 }
開發者ID:maclof,項目名稱:extensions,代碼行數:32,代碼來源:ExtensionFinder.php

示例6: get

 /**
  * @param string $locale
  * @param string $group
  * @return array
  */
 public function get($locale, $group)
 {
     if ($this->fs->exists($path = $this->path . "/{$locale}/{$group}.php")) {
         return $this->fs->getRequire($path);
     }
     return [];
 }
開發者ID:bweston92,項目名稱:laravel-language-overrides,代碼行數:12,代碼來源:FileWriter.php

示例7: getRequire

 public function getRequire($fullPath)
 {
     if (!$this->filesystem->exists($fullPath)) {
         return null;
     }
     return $this->filesystem->getRequire($fullPath);
 }
開發者ID:Junyue,項目名稱:zidisha2,代碼行數:7,代碼來源:TranslationService.php

示例8: get

 public function get($path, array $data = array())
 {
     $filename = $this->files->name($path) . '.' . $this->files->extension($path);
     $compile_path = \Config::get('view.compiled') . DIRECTORY_SEPARATOR . $filename;
     $template_last_modified = $this->files->lastModified($path);
     $cache_last_modified = $this->files->isFile($compile_path) ? $this->files->lastModified($compile_path) : $template_last_modified;
     $view = $this->files->get($path);
     $app = app();
     // $m = new Mustache_Engine($app['config']->get('handlelars'));
     // Configuration
     $cache_disabled = false;
     $helpers = \Config::get('handlelars.helpers');
     // Precompile templates to view cache when necessary
     $compile = $template_last_modified >= $cache_last_modified || $cache_disabled;
     if ($compile) {
         $tpl = LightnCandy::compile($view, compact('helpers'));
         $this->files->put($compile_path, $tpl);
     }
     if (isset($data['__context']) && is_object($data['__context'])) {
         $data = $data['__context'];
     } else {
         $data = array_map(function ($item) {
             return is_object($item) && method_exists($item, 'toArray') ? $item->toArray() : $item;
         }, $data);
     }
     $renderer = $this->files->getRequire($compile_path);
     return $renderer($data);
 }
開發者ID:truemedia,項目名稱:handlelars,代碼行數:28,代碼來源:MustacheEngine.php

示例9: load

 /**
  * Load the settings from the cache.
  *
  * @param string $env
  *
  * @return array|false
  */
 public function load($env)
 {
     try {
         return $this->files->getRequire($this->path($env));
     } catch (Exception $e) {
         return false;
     }
 }
開發者ID:aksalj,項目名稱:Cachet,代碼行數:15,代碼來源:Cache.php

示例10: load

 /**
  * 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();
     }
     return array_dot($this->files->getRequire($path));
 }
開發者ID:rodrigopbel,項目名稱:ong,代碼行數:16,代碼來源:FileEnvironmentVariablesLoader.php

示例11: loadManifest

 /**
  * Load the service provider manifest JSON file.
  *
  * @return array|null
  */
 public function loadManifest()
 {
     // 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($this->manifestPath)) {
         $manifest = $this->files->getRequire($this->manifestPath);
         return array_merge(['when' => []], $manifest);
     }
 }
開發者ID:saj696,項目名稱:pipe,代碼行數:15,代碼來源:ProviderRepository.php

示例12: __construct

 private function __construct()
 {
     $this->_http = new Http();
     // Инициализация конфигов
     $fileSystem = new Filesystem();
     $files = $fileSystem->allFiles('config');
     foreach ($files as $file) {
         if (is_array($fileSystem->getRequire($file))) {
             $this->setConfig($fileSystem->getRequire($file), $fileSystem->name($file));
         }
     }
 }
開發者ID:ArmSALArmy,項目名稱:Banants,代碼行數:12,代碼來源:App.php

示例13: getById

 /**
  * Get a user by its ID.
  *
  * @param  mixed  $id
  * @return \Stidges\LaravelDbNormalizer\Entity
  */
 public function getById($id)
 {
     $users = $this->files->getRequire($this->path);
     $result = [];
     foreach ($users as $user) {
         if ($user['id'] == $id) {
             $result = $user;
             break;
         }
     }
     return $this->normalizer->normalize($result);
 }
開發者ID:dhaval48,項目名稱:laravel-db-normalizer,代碼行數:18,代碼來源:FileUserRepository.php

示例14: addNamespaceOverrides

 /**
  * Add namespace overrides to configuration.
  *
  * @param $namespace
  * @param $directory
  */
 public function addNamespaceOverrides($namespace, $directory)
 {
     if (!$this->files->isDirectory($directory)) {
         return;
     }
     /* @var SplFileInfo $file */
     foreach ($this->files->allFiles($directory) as $file) {
         $key = trim(str_replace($directory, '', $file->getPath()) . DIRECTORY_SEPARATOR . $file->getBaseName('.php'), DIRECTORY_SEPARATOR);
         // Normalize key slashes.
         $key = str_replace('\\', '/', $key);
         $this->config->set($namespace . '::' . $key, array_replace($this->config->get($namespace . '::' . $key, []), $this->files->getRequire($file->getPathname())));
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:19,代碼來源:Configurator.php

示例15: loadExtensions

 /**
  * Load extensions in memory
  *
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 public function loadExtensions()
 {
     $extensions = $this->filesystem->directories($this->path);
     foreach ($extensions as $extension) {
         $name = basename($extension);
         $class = $this->extensionClass($name);
         $this->filesystem->getRequire($extension . '/start.php');
         $extensionInstance = new $class($extension, $name);
         if (in_array($name, $this->settings->get('extensions', []))) {
             $extensionInstance->setActive();
         }
         $this->extensions->push($extensionInstance);
     }
 }
開發者ID:vjaykoogu,項目名稱:smile-media-laravel,代碼行數:19,代碼來源:Manager.php


注:本文中的Illuminate\Filesystem\Filesystem::getRequire方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。