Esempio n. 1
0
 public function testHasOnlyInts()
 {
     $this->assertTrue(ArrayUtils::hasOnlyInts([1]));
     $this->assertTrue(ArrayUtils::hasOnlyInts(['1']));
     $this->assertFalse(ArrayUtils::hasOnlyInts([1.1]));
     $this->assertFalse(ArrayUtils::hasOnlyInts(['1.1']));
     $this->assertFalse(ArrayUtils::hasOnlyInts([1, '']));
 }
Esempio n. 2
0
 /**
  * @param null $where
  * @param null $params
  * @param null $columns
  * @return Collection
  */
 private function all($where = null, $params = null, $columns = null)
 {
     $select = $this->table()->select();
     if ($where) {
         if (is_numeric($where)) {
             $select->where($this->getPrimaryKey() . ' = ' . $where);
         } elseif (is_array($where) && ArrayUtils::hasOnlyInts($where)) {
             $select->where($this->getPrimaryKey() . ' IN (' . implode(', ', $where) . ')');
         } else {
             call_user_func_array([$select, 'where'], func_get_args());
         }
     }
     if (!$columns) {
         $select->select($this->getDefaultSelectColumns());
     }
     $collectionClassName = $this->collectionClassName;
     return new $collectionClassName($select, $this);
 }