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


PHP Arrays::is方法代码示例

本文整理汇总了PHP中Arrays::is方法的典型用法代码示例。如果您正苦于以下问题:PHP Arrays::is方法的具体用法?PHP Arrays::is怎么用?PHP Arrays::is使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Arrays的用法示例。


在下文中一共展示了Arrays::is方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: format

 private function format($text = '', $parameters = array())
 {
     if (!Arrays::is($parameters) && 'NONE' == $parameters) {
         return $text;
     }
     if (!Arrays::is($parameters) && isset($this->styles[$parameters])) {
         $parameters = $this->styles[$parameters];
     }
     $codes = array();
     $fg = isAke($parameters, 'fg', null);
     $bg = isAke($parameters, 'bg', null);
     if (!empty($fg)) {
         $codes[] = $this->foreground[$fg];
     }
     if (!empty($bg)) {
         $codes[] = $this->background[$bg];
     }
     foreach ($this->options as $option => $value) {
         $paramOpt = isAke($parameters, $option, null);
         if (!empty($paramOpt)) {
             $codes[] = $value;
         }
     }
     return "[" . implode(';', $codes) . 'm' . $text . "[0m";
 }
开发者ID:schpill,项目名称:thin,代码行数:25,代码来源:Cli.php

示例2: orderBy

 public function orderBy($tab, $fieldOrder, $orderDirection = 'ASC')
 {
     $sortFunc = function ($key, $direction) {
         return function ($a, $b) use($key, $direction) {
             if ('ASC' == $direction) {
                 return $a[$key] > $b[$key];
             } else {
                 return $a[$key] < $b[$key];
             }
         };
     };
     if (Arrays::is($fieldOrder) && !Arrays::is($orderDirection)) {
         $t = array();
         foreach ($fieldOrder as $tmpField) {
             array_push($t, $orderDirection);
         }
         $orderDirection = $t;
     }
     if (!Arrays::is($fieldOrder) && Arrays::is($orderDirection)) {
         $orderDirection = Arrays::first($orderDirection);
     }
     if (Arrays::is($fieldOrder) && Arrays::is($orderDirection)) {
         for ($i = 0; $i < count($fieldOrder); $i++) {
             usort($tab, $sortFunc($fieldOrder[$i], $orderDirection[$i]));
         }
     } else {
         usort($tab, $sortFunc($fieldOrder, $orderDirection));
     }
     return $tab;
 }
开发者ID:schpill,项目名称:standalone,代码行数:30,代码来源:services.php

示例3: keys

 public function keys($pattern)
 {
     $keys = $this->session->getKeys();
     if (!empty($keys)) {
         $seg = isAke($keys, sha1($pattern));
         if (!empty($seg)) {
             return $seg;
         }
     }
     $this->call('keys', array("pattern" => $pattern));
     $tab = json_decode($this->response, true);
     $res = isAke($tab, 'message');
     $collection = array();
     if (Arrays::is($res)) {
         if (count($res)) {
             foreach ($res as $row) {
                 array_push($collection, $row);
             }
         }
     }
     if (empty($keys)) {
         $keys = array();
     }
     $keys[sha1($pattern)] = $collection;
     $this->session->setKeys($keys);
     return $collection;
 }
开发者ID:schpill,项目名称:thin,代码行数:27,代码来源:Bucket.php

示例4: __call

 public function __call($method, $args)
 {
     if (true === $this->__has($method)) {
         return $this->__fire($method, $args);
     }
     $reverse = strrev($method);
     $last = $reverse[0];
     if ('s' == $last) {
         if (!count($args)) {
             return isAke($this->values, $method);
         } else {
             $this->values[$method] = !Arrays::is($this->values[$method]) ? array() : $this->values[$method];
             foreach ($args as $arg) {
                 array_push($this->values[$method], $arg);
             }
         }
         return $this;
     } else {
         $method .= 's';
         if (!count($args)) {
             $val = isAke($this->values, $method);
             return count($val) ? Arrays::first($val) : null;
         } else {
             $this->values[$method] = !Arrays::is($this->values[$method]) ? array() : $this->values[$method];
             foreach ($args as $arg) {
                 array_push($this->values[$method], $arg);
             }
         }
         return $this;
     }
 }
开发者ID:schpill,项目名称:thin,代码行数:31,代码来源:Conf.php

示例5: send

 public static function send($arguments = array())
 {
     $response = static::request('messages/send', $arguments);
     if (false !== $response && Arrays::is($response)) {
         $response = Arrays::first($response);
         return $response['status'] == 'sent' ? true : $response['status'];
     }
     return false;
 }
开发者ID:noikiy,项目名称:inovi,代码行数:9,代码来源:Mandrill.php

示例6: getHeader

 public function getHeader()
 {
     $this->rewind();
     $current = $this->current();
     if (Arrays::is($current)) {
         return $current;
     }
     return array();
 }
开发者ID:schpill,项目名称:thin,代码行数:9,代码来源:Csv.php

示例7: make

 public function make(array $array)
 {
     $return = array();
     foreach ($array as $k => $v) {
         if (Arrays::is($v)) {
             $o = new self();
             $return[$k] = $o->populate($v);
         } else {
             $return[$k] = $v;
         }
     }
     return $return;
 }
开发者ID:noikiy,项目名称:inovi,代码行数:13,代码来源:Container.php

示例8: clean

 public static function clean($data)
 {
     if (Arrays::is($data)) {
         foreach ($data as $key => $value) {
             unset($data[$key]);
             $data[static::clean($key)] = static::clean($value);
         }
     } else {
         if (ini_get('magic_quotes_gpc')) {
             $data = stripslashes($data);
         } else {
             $data = htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
         }
     }
     return $data;
 }
开发者ID:schpill,项目名称:thin,代码行数:16,代码来源:Filter.php

示例9: add

 /**
  * Add file to the archive
  *
  * @param array/string $files
  * @param string $string
  * @return bool
  */
 public function add($files, $string = false)
 {
     if (true === $this->_enabled) {
         if (Arrays::is($files)) {
             foreach ($files as $file) {
                 $this->_addFile((string) $file);
             }
         } else {
             if (!empty($string) && is_string($string)) {
                 return $this->_zip->addFromString($files, $string);
             } else {
                 return $this->_addFile($files);
             }
         }
     }
     return false;
 }
开发者ID:schpill,项目名称:thin,代码行数:24,代码来源:Archive.php

示例10: keys

 public function keys($pattern)
 {
     $collection = $this->data($pattern);
     if (!Arrays::is($collection)) {
         $oldPattern = $pattern;
         $pattern .= '*#*';
         $pattern = repl('**', '*', $pattern);
         $files = $this->glob($this->dir . DS . $pattern);
         $collection = array();
         if (count($files)) {
             foreach ($files as $row) {
                 array_push($collection, $row);
             }
         }
         $this->setData($oldPattern, $collection);
     }
     return $collection;
 }
开发者ID:schpill,项目名称:thin,代码行数:18,代码来源:Txtdb.php

示例11: dispatch

 private static function dispatch()
 {
     $uri = str_replace(Config::get('application.base_uri'), '', isAke($_SERVER, 'REQUEST_URI', '/'));
     $method = strtolower(isAke($_SERVER, 'REQUEST_METHOD', 'get'));
     $routes = (include CONFIG_PATH . DS . 'routes.php');
     if (!empty($routes)) {
         foreach ($routes as $route) {
             $methodRoute = !isset($route->method) ? 'get' : strtolower($route->method);
             if ($route->path == $uri && $methodRoute == $method) {
                 return $route;
             }
             $match = static::match($route->path, $uri);
             if (false !== $match && $methodRoute == $method) {
                 if (!empty($match)) {
                     $args = $route->args;
                     if (Arrays::is($args)) {
                         if (count($match) == count($args)) {
                             $continue = false;
                             $i = 1;
                             foreach ($args as $key => $closure) {
                                 $val = $closure($match[$i]);
                                 if (false === $val) {
                                     $continue = true;
                                     break;
                                 }
                                 $_REQUEST[$key] = $val;
                                 $i++;
                             }
                             if (true === $continue) {
                                 continue;
                             }
                         }
                     }
                 }
                 return $route;
             }
         }
     }
     return static::route(['controller' => 'static', 'action' => 'is404']);
 }
开发者ID:schpill,项目名称:thin,代码行数:40,代码来源:Mvc.php

示例12: configs

 public static function configs($entity, $key, $value = null, $cb = null)
 {
     if (!strlen($entity)) {
         throw new Exception("An entity must be provided to use this method.");
     }
     if (!Arrays::exists($entity, static::$configs)) {
         self::$configs[$entity] = array();
     }
     if (empty($value)) {
         if (!strlen($key)) {
             throw new Exception("A key must be provided to use this method.");
         }
         return isAke(self::$configs[$entity], $key, null);
     }
     if (!strlen($key)) {
         throw new Exception("A key must be provided to use this method.");
     }
     $reverse = strrev($key);
     $last = $reverse[0];
     if ('s' == $last) {
         self::$configs[$entity][$key] = $value;
     } else {
         if (!Arrays::is(self::$configs[$entity][$key . 's'])) {
             self::$configs[$entity][$key . 's'] = array();
         }
         array_push(self::$configs[$entity][$key . 's'], $value);
     }
     return !is_callable($cb) ? true : $cb();
 }
开发者ID:noikiy,项目名称:inovi,代码行数:29,代码来源:Bucketdb.php

示例13: mime

 public static function mime($extension, $default = 'application/octet-stream')
 {
     Config::load('mimes');
     $mimes = null !== config::get('mimes') ? config::get('mimes') : [];
     if (!Arrays::exists($extension, $mimes)) {
         return $default;
     }
     return Arrays::is($mimes[$extension]) ? Arrays::first($mimes[$extension]) : $mimes[$extension];
 }
开发者ID:schpill,项目名称:thin,代码行数:9,代码来源:File.php

示例14: isMulti

 /**
  * Check if the array is a multidimensional array
  *
  * @param  Array   $array The array to check
  * @return boolean
  */
 protected function isMulti(array $array)
 {
     $first = array_shift($array);
     return Arrays::is($first);
 }
开发者ID:schpill,项目名称:thin,代码行数:11,代码来源:Cart.php

示例15: arrayMergeRecursiveReplace

 /**
  * Merges any number of arrays of any dimensions, the later overwriting
  * previous keys, unless the key is numeric, in whitch case, duplicated
  * values will not be added.
  *
  * The arrays to be merged are passed as arguments to the function.
  *
  * @return array Resulting array, once all have been merged
  */
 public function arrayMergeRecursiveReplace()
 {
     // Holds all the arrays passed
     $params = func_get_args();
     // First array is used as the base, everything else overwrites on it
     $return = array_shift($params);
     // Merge all arrays on the first array
     foreach ($params as $array) {
         foreach ($array as $key => $value) {
             // Numeric keyed values are added (unless already there)
             if (is_numeric($key) && !in_array($value, $return)) {
                 if (Arrays::is($value)) {
                     $return[] = $this->arrayMergeRecursiveReplace($return[$key], $value);
                 } else {
                     $return[] = $value;
                 }
                 // String keyed values are replaced
             } else {
                 if (isset($return[$key]) && Arrays::is($value) && Arrays::is($return[$key])) {
                     $return[$key] = $this->arrayMergeRecursiveReplace($return[$key], $value);
                 } else {
                     $return[$key] = $value;
                 }
             }
         }
     }
     return $return;
 }
开发者ID:schpill,项目名称:thin,代码行数:37,代码来源:Kernel.php


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