/** * Returns value if it is a valid integer value, FALSE otherwise. * * @param mixed $key * @return mixed */ public function testInt($key) { if (!$this->keyExists($key)) { return false; } if (Zend_Filter::isInt($this->_source[$key])) { return $this->_source[$key]; } return FALSE; }
/** * Returns value if it is a valid integer value, FALSE otherwise. * * @param mixed $key * @return mixed */ public function testInt($key) { if (Zend_Filter::isInt($this->_source[$key])) { return $this->_source[$key]; } return FALSE; }
/** * Validate Tag Search Options * * @param array $options */ protected function _validateTagSearch($options) { $valid_options = array('api_key', 'method', 'user_id', 'per_page', 'page', 'extras', 'min_upload_date', 'min_taken_date', 'max_upload_date', 'max_taken_date', 'tag_mode', 'tags'); if (!is_array($options)) { return; } $this->_compareOptions($options, $valid_options); if (!Zend_Filter::isBetween($options['per_page'], 1, 500, true)) { throw new Zend_Service_Exception($options['per_page'] . ' is not valid for the "per_page" option'); } if (!Zend_Filter::isInt($options['page'])) { throw new Zend_Service_Exception($options['page'] . ' is not valid for the "page" option'); } // validate extras, which are delivered in csv format if ($options['extras']) { $extras = explode(',', $options['extras']); $valid_extras = array('license', 'date_upload', 'date_taken', 'owner_name', 'icon_server'); foreach ($extras as $extra) { /** * @todo The following does not do anything [yet], so it is commented out. */ //in_array(trim($extra), $valid_extras); } } }
/** * @deprecated since 0.8.0 * @return void */ public function testisInt() { $this->assertTrue(Zend_Filter::isInt(100), '100 is a valid integer'); $this->assertFalse(Zend_Filter::isInt(1.23), '1.2e3 is not a valid integer'); }
/** * Returns value if it is a valid integer value, FALSE otherwise. * * @param mixed $key * @return mixed */ public function isInt($key) { return Zend_Filter::isInt($this->_source[$key]); }
/** * Returns value if it is a valid integer value, FALSE otherwise. * * @param mixed $key * @return mixed */ public function testInt($key = null) { if (!($value = $this->keyExists($key))) { return false; } if (Zend_Filter::isInt($value)) { return $value; } return FALSE; }