findLast() public static method

public static findLast ( Posts $post ) : Phalcon\Mvc\Model\ResultsetInterface | Phalcon\Mvc\Model\Resultset\Simple
$post Posts
return Phalcon\Mvc\Model\ResultsetInterface | Phalcon\Mvc\Model\Resultset\Simple
Beispiel #1
0
 public function getDifference()
 {
     $history = PostsHistory::findLast($this);
     if (!$history->valid()) {
         return false;
     }
     if ($history->count() > 1) {
         $history = $history->offsetGet(1);
     } else {
         $history = $history->getFirst();
     }
     /** @var PostsHistory $history */
     $b = explode("\n", $history->content);
     $diff = new Diff($b, explode("\n", $this->content), []);
     $difference = $diff->render(new SideBySide());
     return $difference;
 }