/** * Get a property of the PageArray * * These map to functions form the array and are here for convenience. * Properties include count, total, start, limit, last, first, keys, values, * These can also be accessed by direct reference. * * @param string $property * @return mixed * */ public function getProperty($property) { static $properties = array('total' => 'getTotal', 'start' => 'getStart', 'limit' => 'getLimit'); if (!in_array($property, $properties)) { return parent::getProperty($property); } $func = $properties[$property]; return $this->{$func}(); }
/** * Enables this WireArray to behave like the first item (for getting properties) * * @param string $property * @return mixed|null * */ public function getProperty($property) { if (SelectableOption::isProperty($property)) { if ($this->count()) { $option = $this->first(); return $option->{$property}; } return null; } return parent::getProperty($property); }