Пример #1
0
 protected function matchesCriteria(ScribbleFile $scribble, Criteria $criteria)
 {
     if (!$scribble) {
         return false;
     }
     if ($criteria->getSlug() !== null) {
         if ($scribble->getSlug() !== $criteria->getSlug()) {
             return false;
         }
     }
     // unpublished scribbles only
     if ($criteria->getMode() === Criteria::MODE_UNPUBLISHED) {
         if ($scribble->isPublished()) {
             return false;
         }
     } else {
         if ($criteria->getMode() === Criteria::MODE_ALL) {
         } else {
             if (!$scribble->isPublished()) {
                 return false;
             }
         }
     }
     foreach ($criteria->getTags() as $key => $tag) {
         if (!$scribble->getTags()->containsKey($key)) {
             return false;
         }
     }
     if ($criteria->getFind() && !$scribble->find($criteria->getFind())) {
         return false;
     }
     return true;
 }
Пример #2
0
 public function testSlug()
 {
     $criteria = new Criteria();
     $criteria->setSlug('abc*""def');
     $this->assertSame('abcdef', $criteria->getSlug());
 }