first() public method

If the element is array, ArrayObject is returned, else StringObject is returned.
public first ( ) : StringObject | ArrayObject | StdObjectWrapper
return Webiny\Component\StdLib\StdObject\StringObject\StringObject | ArrayObject | StdObjectWrapper The first element in the array.
Example #1
0
 /**
  * @dataProvider arraySet1
  */
 public function testFirst($array)
 {
     $a = new ArrayObject($array);
     $last = $a->first();
     $firstValue = reset($array);
     $this->assertSame($firstValue, $last->val());
 }