for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace mav3rick177\RapidPagination\Base;
class ArrayProcessor extends AbstractProcessor
{
/**
* Return comparable value from a row.
*
* @param mixed $row
* @param string $column
* @return int|string
*/
protected function field($row, $column)
return is_object($row) && !$row instanceof \ArrayAccess ? $row->$column : $row[$column];
}
* Return the n-th element of collection.
* Must return null if not exists.
* @param array $rows
* @param int $offset
* @return mixed
protected function offset($rows, $offset)
return isset($rows[$offset]) ? $rows[$offset] : null;
* Slice rows, like PHP function array_slice().
* @param null|int $length
* @return array
protected function slice($rows, $offset, $length = null)
return array_slice($rows, $offset, $length);
* Count rows, like PHP function count().
* @return int
protected function count($rows)
return count($rows);
* Reverse rows, like PHP function array_reverse().
protected function reverse($rows)
return array_reverse($rows);