本文整理汇总了PHP中Respect\Validation\Validator::intType方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::intType方法的具体用法?PHP Validator::intType怎么用?PHP Validator::intType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Respect\Validation\Validator
的用法示例。
在下文中一共展示了Validator::intType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setCityDistance
/**
* Sets the distance between two {@link City}s
* @param string $cityA name of city
* @param string $cityB name of city
* @param int $distance distance between cities
*/
public function setCityDistance($cityA, $cityB, $distance)
{
Validator::stringType()->notBlank()->check($cityA);
Validator::stringType()->notBlank()->check($cityB);
Validator::intType()->positive()->check($distance);
$this->adjacencyMatrix[$cityA][$cityB] = $distance;
$this->adjacencyMatrix[$cityB][$cityA] = $distance;
}
示例2: firstArrivesAtFloor
/**
* Returns the time when the rider arrives at the given floor for the first time.
*
* Time is represented as the number of instructions followed, starting with 1.
*
* @param ElevatorRide $ride
* @param int $floor
* @return int|null $time null if never arrived
*/
public static function firstArrivesAtFloor(ElevatorRide $ride, $floor)
{
Validator::intType()->check($floor);
$time = array_search($floor, $ride->getRide(), true);
if ($time === false) {
return false;
}
return $time;
}
示例3: ajaxPublic
function ajaxPublic($page = 0)
{
$validate_page = Validator::intType();
if (!$validate_page->validate($page)) {
return;
}
RPC::call('MovimTpl.fill', '#public_list', $this->preparePublic($page));
}
示例4: load
function load()
{
if ($this->_view == 'node') {
$this->_from = $this->get('s');
$this->_node = $this->get('n');
if (!$this->validateServerNode($this->_from, $this->_node)) {
return;
}
$pd = new \Modl\ItemDAO();
$this->_item = $pd->getItem($this->_from, $this->_node);
$this->_mode = 'group';
$this->url = Route::urlize('node', array($this->_from, $this->_node));
} elseif ($this->_view == 'tag' && $this->validateTag($this->get('t'))) {
$this->_mode = 'tag';
$this->_tag = $this->get('t');
$this->title = '#' . $this->_tag;
} else {
$this->_from = $this->get('f');
$cd = new \modl\ContactDAO();
$this->_contact = $cd->get($this->_from, true);
if (filter_var($this->_from, FILTER_VALIDATE_EMAIL)) {
$this->_node = 'urn:xmpp:microblog:0';
} else {
return;
}
$this->_mode = 'blog';
$this->url = Route::urlize('blog', $this->_from);
}
$pd = new \modl\PostnDAO();
if ($this->_id = $this->get('i')) {
if (Validator::intType()->between(0, 100)->validate($this->_id)) {
if (isset($this->_tag)) {
$this->_messages = $pd->getPublicTag($this->get('t'), $this->_id * $this->_paging, $this->_paging + 1);
} else {
$this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, $this->_id * $this->_paging, $this->_paging + 1);
}
$this->_page = $this->_id + 1;
} elseif (Validator::stringType()->length(5, 100)->validate($this->_id)) {
$this->_messages = $pd->getPublicItem($this->_from, $this->_node, $this->_id);
if (is_object($this->_messages[0])) {
$this->title = $this->_messages[0]->title;
$description = stripTags($this->_messages[0]->contentcleaned);
if (!empty($description)) {
$this->description = $description;
}
$attachements = $this->_messages[0]->getAttachements();
if ($attachements && array_key_exists('pictures', $attachements)) {
$this->image = urldecode($attachements['pictures'][0]['href']);
}
}
if ($this->_view == 'node') {
$this->url = Route::urlize('node', array($this->_from, $this->_node, $this->_id));
} else {
$this->url = Route::urlize('blog', array($this->_from, $this->_id));
}
}
} else {
$this->_page = 1;
if (isset($this->_tag)) {
$this->_messages = $pd->getPublicTag($this->get('t'), 0, $this->_paging + 1);
} else {
$this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, 0, $this->_paging + 1);
}
}
if (count($this->_messages) == $this->_paging + 1) {
array_pop($this->_messages);
}
$this->user = new User($this->_from);
$cssurl = $this->user->getDumpedConfig('cssurl');
if (isset($cssurl) && $cssurl != '' && Validator::url()->validate($cssurl)) {
$this->addrawcss($cssurl);
}
}
示例5: getInputFromFileForDay
/**
* Returns the input in `input.txt` within a given day's directory.
*
* *Example:* Providing `1` for the day will return contents in `/src/main/Day1/input.txt`
*
* @param int $day
* @return string contents of input file
*/
public function getInputFromFileForDay($day)
{
Validator::intType()->check($day);
return $this->resourceProvider->getResource("Day{$day}/input.txt");
}