Exemplo n.º 1
0
 /**
  * Converts a associative array of key,value pairs to SQL query comparisons.
  * ie: ['a' => 4, 'b' => 'open'] -> [0 => "a=`4`", 1 => "b=`open`"]
  *
  * @param array $array
  *
  * @return array|null
  */
 static function make_compare_list(array $array)
 {
     $list = [];
     if (Arr::is_assoc($array)) {
         foreach ($array as $key => $value) {
             $list[] = $key . '=`' . $value . '`';
         }
         return $list;
     }
     return NULL;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * 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);
 }