Example #1
0
 /**
  * GetPosts
  *
  * @param \Silex\Application $app    Application current Instance
  * @param integer            $limit  Maximun size of post
  * @param integer            $offset Start element
  *
  * @return array
  *
  * @throws \NachoNerd\MarkdownBlog\Exceptions\FileNotFound
  */
 protected function getPosts(Application $app, $limit = 10, $offset = 0)
 {
     try {
         $files = $app->parserYaml("posts.yml");
     } catch (\NachoNerd\MarkdownBlog\Exceptions\WrongConfig $e) {
         throw new \NachoNerd\MarkdownBlog\Exceptions\FileNotFound("Not Found Any Post", 12);
     }
     if (count($files) <= 0) {
         throw new \NachoNerd\MarkdownBlog\Exceptions\FileNotFound("Not Found Any Post", 12);
     }
     return array_slice($files, $offset, $limit, true);
 }