Ejemplo n.º 1
0
 /**
  * Returns a registered object by its dot-notated path.
  */
 public static function get($dotpath)
 {
     if (false === strpos($dotpath, '.')) {
         return isset(static::$data[$dotpath]) ? static::$data[$dotpath] : null;
     }
     return \Phpf\Util\Arr::dotGet(static::$data, $dotpath);
 }
Ejemplo n.º 2
0
/**
 * Pluck a certain field out of each object in a list by reference.
 * This will change the values of the original array/object list.
 *
 * @param array $list A list of objects or arrays
 * @param int|string $field A field from the object to place instead of the
 * entire object
 * @return array
 */
function list_pluck_ref(&$list, $field)
{
    return \Phpf\Util\Arr::pluckRef($list, $field);
}