getValue() public static method

public static getValue ( mixed $object, string $field, null | mixed $default = null, boolean $accessPrivate = false ) : mixed | null
$object mixed
$field string
$default null | mixed
$accessPrivate boolean
return mixed | null
示例#1
0
 public function __get($field)
 {
     $this->_operations[] = function ($input) use($field) {
         return Objects::getValue($input, $field);
     };
     return $this;
 }
示例#2
0
 /**
  * @test
  */
 public function shouldReturnValueFormArray()
 {
     //given
     $array = array('id' => 123, 'name' => 'John');
     //when
     $value = Objects::getValue($array, 'name');
     //then
     $this->assertEquals('John', $value);
 }
示例#3
0
 public static function extractField($name, $accessPrivate = false)
 {
     return function ($object) use($name, $accessPrivate) {
         return Objects::getValue($object, $name, null, $accessPrivate);
     };
 }