当前位置: 首页>>代码示例>>PHP>>正文


PHP Validator::intType方法代码示例

本文整理汇总了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;
 }
开发者ID:hamdrew,项目名称:adventofcode,代码行数:14,代码来源:CityMap.php

示例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;
 }
开发者ID:hamdrew,项目名称:adventofcode,代码行数:18,代码来源:ElevatorRideAnalyser.php

示例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));
 }
开发者ID:Hywan,项目名称:movim,代码行数:8,代码来源:Contact.php

示例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);
     }
 }
开发者ID:christine-ho-dev,项目名称:movim,代码行数:73,代码来源:Blog.php

示例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");
 }
开发者ID:hamdrew,项目名称:adventofcode,代码行数:13,代码来源:InputProvider.php


注:本文中的Respect\Validation\Validator::intType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。