/**
  * @inheritdoc
  */
 public function isValid($data, $field = '', array $extra = [])
 {
     if (is_array($data) && is_array($field)) {
         $userName = reset($field);
         $userId = next($field);
         return !empty($data[$userId]) && $this->integerValidationRule->isValid($data[$userId]) || !empty($data[$userName]);
     }
     return false;
 }
Пример #2
0
 /**
  * @param bool         $customUris
  * @param array|string $page
  * @param int          $pageNumber
  * @param int          $currentIndex
  *
  * @return bool
  */
 protected function isCurrentPage($customUris, $page, $pageNumber, $currentIndex)
 {
     if ($customUris === true) {
         if (is_array($page) === true && $page['uri'] === $this->router->route($this->request->getQuery()) || $this->router->route($this->request->getQuery()) === $this->router->route($this->request->getFullPath()) && $currentIndex == 0) {
             return true;
         }
     } elseif ($this->integerValidationRule->isValid($this->request->getParameters()->get('page')) === false && $currentIndex === 0 || $this->request->getParameters()->get('page') === $pageNumber) {
         return true;
     }
     return false;
 }