Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Remove usage of Timber\PostCollection in Repository
Browse files Browse the repository at this point in the history
- See gihub issues #53 & #54
  • Loading branch information
perruche authored and titouanmathis committed Jul 14, 2021
1 parent ee87eb9 commit c465e4b
Showing 1 changed file with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

namespace Studiometa\Repositories;

use Timber\PostCollection;

/** Class */
abstract class Repository {
/**
Expand Down Expand Up @@ -39,28 +37,6 @@ public function first() {
return isset( $local_array[0] ) ? $local_array[0] : null;
}

/**
* Returns a slice of the collection starting at the given index.
* Similar to Laravel's slice().
*
* @param int $start Start index.
*
* @return array
*/
public function slice( $start ) {
$local_array = $this->get();

if ( count( $local_array ) < 1 ) {
return array();
}

if ( is_object( $local_array ) && $local_array instanceof PostCollection ) {
$local_array = $local_array->getArrayCopy();
}

return array_slice( $local_array, (int) $start );
}

/**
* Runs a query.
*
Expand Down

0 comments on commit c465e4b

Please sign in to comment.