コード例 #1
0
ファイル: BladeCompiler.php プロジェクト: anctemarry27/cogs
 /**
  * Compile Blade statements that start with "@".
  *
  * @param  string  $value
  * @return mixed
  */
 protected function compileStatements($value)
 {
     $callback = function ($match) {
         if (method_exists($this, $method = 'compile' . ucfirst($match[1]))) {
             $match[0] = $this->{$method}(Arr::get(3, $match));
         } elseif (isset($this->customDirectives[$match[1]])) {
             $match[0] = call_user_func($this->customDirectives[$match[1]], Arr::get(3, $match));
         }
         return isset($match[3]) ? $match[0] : $match[0] . $match[2];
     };
     return preg_replace_callback('/\\B@(\\w+)([ \\t]*)(\\( ( (?>[^()]+) | (?3) )* \\))?/x', $callback, $value);
 }
コード例 #2
0
 /**
  * Remove values from an array that match entries marked as immutable in the collection.
  *
  * @param $vars
  *
  * @return mixed
  */
 protected function filter_immutables($vars)
 {
     $candidates = [];
     foreach ($vars as $key => $value) {
         if (array_key_exists($key, $this->read_only)) {
             $candidates[] = $key;
         }
     }
     Arr::forget($candidates, $vars);
     return $vars;
 }
コード例 #3
0
ファイル: ArrayUtilities.php プロジェクト: anctemarry27/cogs
 /**
  * Locate a value by `$key`, return `$default` if not found.
  *
  * @param string|array $key
  * @param mixed        $default
  *
  * @return mixed
  */
 function search($key, $default = NULL)
 {
     return Arr::search($key, $this->storage, $default);
 }
コード例 #4
0
 /**
  * Get the Rackspace Cloud Files container.
  *
  * @param  \OpenCloud\Rackspace $client
  * @param  array                $config
  *
  * @return \OpenCloud\ObjectStore\Resource\Container
  */
 protected function getRackspaceContainer(Rackspace $client, array $config)
 {
     $urlType = Arr::get($config, 'url_type');
     $store = $client->objectStoreService('cloudFiles', $config['region'], $urlType);
     return $store->getContainer($config['container']);
 }
コード例 #5
0
ファイル: Collection.php プロジェクト: anctemarry27/cogs
 /**
  * Merges an array of symbols with the container.
  * Note: This method strips immutable variables from the symbols array before merging.
  *
  * @param $symbols
  *
  * @return $this|void
  */
 public function merge($symbols)
 {
     $symbols = $this->normalize($symbols);
     # strip immutable symbols as they are, well, immutable.
     $symbols = $this->filter_immutables($symbols);
     if (!Arr::is_assoc($symbols)) {
         $symbols = Arr::transform_array_hash($symbols);
     }
     $this->storage = array_merge($this->storage, $symbols);
     return $this;
 }
コード例 #6
0
ファイル: Arr.php プロジェクト: anctemarry27/cogs
 /**
  * Merges any number of arrays of any dimensions, the later overwriting
  * previous keys, unless the key is numeric, in which case, duplicated
  * values will not be added. The arrays to be merged are passed as
  * arguments to the function.
  *
  * @package SupportLoader
  * @module  arrays
  *
  * @param null $key
  * @param null $value
  *
  * @return array - Resulting array, once all have been merged
  */
 static function merge_recursive_replace($key, $value)
 {
     // Holds all the arrays passed
     $params = func_get_args();
     // First array is used as the base, everything else overwrites on it
     $return = array_shift($params);
     // Merge all arrays on the first array
     foreach ($params as $array) {
         foreach ($array as $key => $value) {
             if (isset($return[$key]) && is_array($value) && is_array($return[$key])) {
                 $return[$key] = Arr::merge_recursive_replace($return[$key], $value);
             } else {
                 $return[$key] = $value;
             }
         }
     }
     return $return;
 }
コード例 #7
0
ファイル: BaseCollection.php プロジェクト: anctemarry27/cogs
 /**
  * Merge a single key, value pair.
  *
  * @param   string $name
  * @param null     $value
  *
  * @return static
  */
 public function with($name, $value = NULL)
 {
     Arr::is_assoc($name) ? $this->merge($name) : ($this->storage[$name] = $value);
 }