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


PHP Arrays::isArray方法代码示例

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


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

示例1: prepareCmdArgs

 /**
  * @param string|array $args
  * @return string
  */
 private function prepareCmdArgs($args)
 {
     if (!Arrays::isArray($args)) {
         return (string) $args;
     }
     $result = '';
     foreach ($args as $arg => $value) {
         if (!is_int($arg)) {
             $arg = (string) $arg;
             $result .= " -{$arg}";
         }
         $value = (string) $value;
         $result .= " {$value}";
     }
     return trim($result);
 }
开发者ID:schpill,项目名称:thin,代码行数:20,代码来源:Shell.php

示例2: query

 public function query($condition)
 {
     $this->firstQuery = false;
     Data::_incQueries(Data::_getTime());
     $queryKey = sha1(serialize($condition) . 'QueryData');
     $cache = Data::cache($this->type, $queryKey);
     if (!empty($cache) && true === $this->cache) {
         return $cache;
     }
     $this->wheres[] = $condition;
     if (is_string($condition)) {
         $res = Data::query($this->type, $condition);
         $collection = array();
         if (count($res)) {
             foreach ($res as $row) {
                 if (is_string($row)) {
                     $tab = explode(DS, $row);
                     $id = repl(".data", '', Arrays::last($tab));
                 } else {
                     if (is_object($row)) {
                         $id = $row->id;
                     }
                 }
                 $collection[] = $id;
             }
         }
     } else {
         if (Arrays::isArray($condition)) {
             $collection = $condition;
         } else {
             $collection = array();
         }
     }
     $cache = Data::cache($this->type, $queryKey, $collection);
     return $collection;
 }
开发者ID:schpill,项目名称:thin,代码行数:36,代码来源:Querydata.php

示例3: isRoute

 public function isRoute($routeName)
 {
     $routes = container()->getMapRoutes();
     if (Arrays::isArray($routes)) {
         if (ake($routeName, $routes)) {
             $route = $routes[$routeName];
             $actualRoute = $this->getRoute();
             return $actualRoute === $route;
         }
     }
     return false;
 }
开发者ID:noikiy,项目名称:inovi,代码行数:12,代码来源:Container.php

示例4: mergeOptions

 public static function mergeOptions(array $array1, $array2 = null)
 {
     if (Arrays::is($array2)) {
         foreach ($array2 as $key => $val) {
             if (Arrays::is($array2[$key])) {
                 $array1[$key] = Arrays::exists($key, $array1) && Arrays::isArray($array1[$key]) ? static::mergeOptions($array1[$key], $array2[$key]) : $array2[$key];
             } else {
                 $array1[$key] = $val;
             }
         }
     }
     return $array1;
 }
开发者ID:schpill,项目名称:thin,代码行数:13,代码来源:Utils.php

示例5: _formatCalledArgument

 /**
  * Format argument in called method
  *
  * @param mixed $arg
  */
 protected static function _formatCalledArgument($arg)
 {
     $out = '';
     if (is_object($arg)) {
         $out .= sprintf("&%s#%s#", get_class($arg), spl_object_hash($arg));
     } else {
         if (is_resource($arg)) {
             $out .= '#[' . get_resource_type($arg) . ']';
         } else {
             if (Arrays::isArray($arg)) {
                 $isAssociative = false;
                 $args = array();
                 foreach ($arg as $k => $v) {
                     if (!is_numeric($k)) {
                         $isAssociative = true;
                     }
                     $args[$k] = static::_formatCalledArgument($v);
                 }
                 if ($isAssociative) {
                     $arr = array();
                     foreach ($args as $k => $v) {
                         $arr[] = static::_formatCalledArgument($k) . ' => ' . $v;
                     }
                     $out .= 'array(' . join(', ', $arr) . ')';
                 } else {
                     $out .= 'array(' . join(', ', $args) . ')';
                 }
             } else {
                 if (is_null($arg)) {
                     $out .= 'NULL';
                 } else {
                     if (is_numeric($arg) || is_float($arg)) {
                         $out .= $arg;
                     } else {
                         if (is_string($arg)) {
                             if (strlen($arg) > static::$argLength) {
                                 $arg = substr($arg, 0, static::$argLength) . "...";
                             }
                             $arg = strtr($arg, array("\t" => '\\t', "\r" => '\\r', "\n" => '\\n', "'" => '\\\''));
                             $out .= "'" . $arg . "'";
                         } else {
                             if (is_bool($arg)) {
                                 $out .= $arg === true ? 'true' : 'false';
                             }
                         }
                     }
                 }
             }
         }
     }
     return $out;
 }
开发者ID:schpill,项目名称:thin,代码行数:57,代码来源:Debug.php

示例6: processKey

 /**
  * Process a key.
  *
  * @param  string $key
  * @param  string $value
  * @param  array  $config
  * @return array
  * @throws Exception
  */
 protected function processKey($key, $value, array &$config)
 {
     if (strpos($key, $this->nestSeparator) !== false) {
         $pieces = explode($this->nestSeparator, $key, 2);
         if (!strlen($pieces[0]) || !strlen($pieces[1])) {
             throw new Exception(sprintf('Invalid key "%s"', $key));
         } elseif (!isset($config[$pieces[0]])) {
             if ($pieces[0] === '0' && !empty($config)) {
                 $config = array($pieces[0] => $config);
             } else {
                 $config[$pieces[0]] = array();
             }
         } elseif (!Arrays::isArray($config[$pieces[0]])) {
             throw new Exception(sprintf('Cannot create sub-key for "%s", as key already exists', $pieces[0]));
         }
         $this->processKey($pieces[1], $value, $config[$pieces[0]]);
     } else {
         if ($key === '@include') {
             if ($this->directory === null) {
                 throw new Exception('Cannot process @include statement for a string config');
             }
             $reader = clone $this;
             $include = $reader->fromFile($this->directory . '/' . $value);
             $config = array_replace_recursive($config, $include);
         } else {
             $config[$key] = $value;
         }
     }
 }
开发者ID:schpill,项目名称:thin,代码行数:38,代码来源:Ini.php

示例7: update

 /**
  * Update the quantity of one row of the cart
  *
  * @param  string        $rowId       The rowid of the item you want to update
  * @param  integer|Array $attribute   New quantity of the item|Array of attributes to update
  * @return boolean
  */
 public function update($rowId, $attribute)
 {
     if (!$this->hasRowId($rowId)) {
         throw new Exception('This cart does not contain this row.');
     }
     if (Arrays::isArray($attribute)) {
         return $this->updateAttribute($rowId, $attribute);
     }
     return $this->updateQty($rowId, $attribute);
 }
开发者ID:schpill,项目名称:thin,代码行数:17,代码来源:Cart.php

示例8: query

 public static function query($entity, $conditions = '', $offset = 0, $limit = 0, $orderField = null, $orderDirection = 'ASC')
 {
     $dataClass = static::$_dataClass;
     static::_exec('_incQueries', array(static::_exec('_getTime', array())));
     $queryKey = sha1(serialize(func_get_args()));
     if (true === $dataClass::$_buffer) {
         $buffer = static::_exec('_buffer', array($queryKey));
         if (false !== $buffer) {
             return $buffer;
         }
     }
     $results = array();
     $resultsAnd = array();
     $resultsOr = array();
     $resultsXor = array();
     $fields = static::fields($entity);
     if (!Arrays::isArray($orderField)) {
         if (null !== $orderField && !ake($orderField, $fields)) {
             $fields[$orderField] = array();
         }
     } else {
         foreach ($orderField as $tmpField) {
             if (null !== $tmpField && !ake($tmpField, $fields)) {
                 $fields[$tmpField] = array();
             }
         }
     }
     $datas = static::getAll($entity);
     if (!count($datas)) {
         return $results;
     }
     if (!strlen($conditions)) {
         $conditionsAnd = array();
         $conditionsOr = array();
         $conditionsXor = array();
         $results = $datas;
     } else {
         $conditionsAnd = explode(' && ', $conditions);
         $conditionsOr = explode(' || ', $conditions);
         $conditionsXor = explode(' XOR ', $conditions);
     }
     if (count($conditionsOr) == count($conditionsAnd)) {
         if (current($conditionsOr) == current($conditionsAnd)) {
             $conditionsAnd = array();
         }
     }
     if (count($conditionsXor) == count($conditionsOr)) {
         if (current($conditionsXor) == current($conditionsOr)) {
             $conditionsXor = array();
         }
     }
     if (count($conditionsAnd)) {
         foreach ($conditionsAnd as $condition) {
             foreach ($datas as $tmpObject) {
                 $object = static::_exec('getObject', array($tmpObject, 'eavrecord'));
                 if (!is_object($object)) {
                     continue;
                 }
                 $object = $object->getData()->setId($object->getId());
                 $condition = repl('NOT LIKE', 'NOTLIKE', $condition);
                 $condition = repl('NOT IN', 'NOTIN', $condition);
                 list($field, $op, $value) = explode(' ', $condition, 3);
                 $continue = true;
                 if (null !== $object->{$field}) {
                     $continue = static::_exec('analyze', array($object->{$field}, $op, $value));
                 } else {
                     $continue = false;
                 }
                 if (true === $continue) {
                     if (!count($resultsAnd)) {
                         array_push($resultsAnd, $tmpObject);
                     } else {
                         $tmpResult = array($tmpObject);
                         $resultsAnd = array_intersect($resultsAnd, $tmpResult);
                     }
                 }
             }
         }
         if (!count($results)) {
             $results = $resultsAnd;
         } else {
             $results = array_intersect($results, $resultsAnd);
         }
     }
     if (count($conditionsOr)) {
         foreach ($conditionsOr as $condition) {
             foreach ($datas as $tmpObject) {
                 $object = static::_exec('getObject', array($tmpObject, 'eavrecord'));
                 if (!is_object($object)) {
                     continue;
                 }
                 $object = $object->getData()->setId($object->getId());
                 $condition = repl('NOT LIKE', 'NOTLIKE', $condition);
                 $condition = repl('NOT IN', 'NOTIN', $condition);
                 list($field, $op, $value) = explode(' ', $condition, 3);
                 if (!isset($object->{$field})) {
                     $continue = false;
                 } else {
                     if (null !== $object->{$field}) {
                         $continue = static::_exec('analyze', array($object->{$field}, $op, $value));
//.........这里部分代码省略.........
开发者ID:schpill,项目名称:thin,代码行数:101,代码来源:Eavdata.php

示例9: stringify

 /**
  * Make a string version of a value.
  *
  * @param mixed $value
  * @return string
  */
 private static function stringify($value)
 {
     if (is_bool($value)) {
         return $value ? '<TRUE>' : '<FALSE>';
     }
     if (is_scalar($value)) {
         $val = (string) $value;
         if (strlen($val) > 100) {
             $val = substr($val, 0, 97) . '...';
         }
         return $val;
     }
     if (Arrays::isArray($value)) {
         return '<ARRAY>';
     }
     if (is_object($value)) {
         return get_class($value);
     }
     if (is_resource($value)) {
         return '<RESOURCE>';
     }
     if ($value === null) {
         return '<NULL>';
     }
     return 'unknown';
 }
开发者ID:noikiy,项目名称:inovi,代码行数:32,代码来源:Assertion.php

示例10: nulls

 /**
  * Filter empty values to be treated as nulls
  *
  * @param mixed $keys
  * @param array $data
  *
  * @return array
  */
 public static function nulls(array $data, $keys = null)
 {
     if ($keys === null) {
         $keys = array_keys($data);
     }
     if (!Arrays::isArray($keys)) {
         $keys = array($keys);
     }
     foreach ($keys as $key) {
         if (array_key_exists($key, $data) && empty($data[$key])) {
             $data[$key] = null;
         }
     }
     return $data;
 }
开发者ID:appcia,项目名称:utils,代码行数:23,代码来源:Val.php

示例11: getConfigData

 public function getConfigData($key)
 {
     if (null === $this->_classConfigs) {
         $file = APPLICATION_PATH . DS . 'config' . DS . 'moneris.php';
         if (File::exists($file)) {
             $this->_classConfigs = (include $file);
         }
     }
     if (Arrays::isArray($this->_classConfigs)) {
         if (Arrays::exists($key, $this->_classConfigs)) {
             return $this->_classConfigs[$key];
         }
     }
     return null;
 }
开发者ID:schpill,项目名称:thin,代码行数:15,代码来源:Moneris.php

示例12: varIsObject

 function varIsObject($var)
 {
     $var_ser = serialize($var);
     array_push($this->arrHistory, $var_ser);
     $this->makeTableHeader("object", "object");
     if (is_object($var)) {
         $arrObjVars = get_object_vars($var);
         foreach ($arrObjVars as $key => $value) {
             $value = !is_object($value) && !Arrays::isArray($value) && trim($value) == "" ? "[empty string]" : $value;
             $this->makeTDHeader("object", $key);
             //check for recursion
             if (is_object($value) || Arrays::isArray($value)) {
                 $var_ser = serialize($value);
                 if (Arrays::inArray($var_ser, $this->arrHistory, TRUE)) {
                     $value = is_object($value) ? "*RECURSION* -> \$" . get_class($value) : "*RECURSION*";
                 }
             }
             if (Arrays::inArray(gettype($value), $this->arrType)) {
                 $this->checkType($value);
             } else {
                 echo $value;
             }
             echo $this->closeTDRow();
         }
         $arrObjMethods = get_class_methods(get_class($var));
         foreach ($arrObjMethods as $key => $value) {
             $this->makeTDHeader("object", $value);
             echo "[function]" . $this->closeTDRow();
         }
     } else {
         echo "<tr><td>" . $this->error("object") . $this->closeTDRow();
     }
     array_pop($this->arrHistory);
     echo "</table><hr class=thinDebugHr />";
 }
开发者ID:schpill,项目名称:thin,代码行数:35,代码来源:Info.php

示例13: __

 public static function __($value, $lng = null)
 {
     if (null === $lng) {
         $lng = getLanguage();
         if (null === $lng) {
             $lng = static::getOption('default_language');
         }
     }
     if (Arrays::isArray($value)) {
         if (Arrays::exists($lng, $value)) {
             return $value[$lng];
         }
     }
     return '';
 }
开发者ID:schpill,项目名称:thin,代码行数:15,代码来源:Cms.php

示例14: attach

 public function attach($path)
 {
     // if not array...
     if (!Arrays::isArray($path)) {
         // add
         $this->attachments[] = $path;
     } else {
         // spin array...
         foreach ($path as $p) {
             // add
             $this->attachments[] = $p;
         }
     }
     return $this;
 }
开发者ID:schpill,项目名称:thin,代码行数:15,代码来源:Smtp.php

示例15: order

 public static function order($type, $results, $field = 'date_create', $orderDirection = 'ASC')
 {
     $fields = static::getModel($type);
     $fields['id'] = array();
     $fields['date_create'] = array();
     if (!Arrays::isArray($field)) {
         if (null !== $field && !ake($field, $fields)) {
             $fields[$field] = array();
         }
     } else {
         foreach ($field as $tmpField) {
             if (null !== $tmpField && !ake($tmpField, $fields)) {
                 $fields[$tmpField] = array();
             }
         }
     }
     $sort = array();
     foreach ($results as $object) {
         $path = static::makePath($type, $object);
         $objectCreated = static::getObject($path, $type);
         foreach ($fields as $key => $infos) {
             $value = isset($objectCreated->{$key}) ? $objectCreated->{$key} : null;
             $sort[$key][] = $value;
         }
     }
     $asort = array();
     foreach ($sort as $key => $rows) {
         for ($i = 0; $i < count($rows); $i++) {
             if (empty(${$key}) || is_string(${$key})) {
                 ${$key} = array();
             }
             $asort[$i][$key] = $rows[$i];
             array_push(${$key}, $rows[$i]);
         }
     }
     if (Arrays::isArray($field) && Arrays::isArray($orderDirection)) {
         if (count($field) == 2) {
             $first = current($field);
             $second = end($field);
             if ('ASC' == Inflector::upper(current($orderDirection)) && 'ASC' == Inflector::upper(end($orderDirection))) {
                 array_multisort(${$first}, SORT_ASC, ${$second}, SORT_ASC, $asort);
             } elseif ('DESC' == Inflector::upper(current($orderDirection)) && 'ASC' == Inflector::upper(end($orderDirection))) {
                 array_multisort(${$first}, SORT_DESC, ${$second}, SORT_ASC, $asort);
             } elseif ('DESC' == Inflector::upper(current($orderDirection)) && 'DESC' == Inflector::upper(end($orderDirection))) {
                 array_multisort(${$first}, SORT_DESC, ${$second}, SORT_DESC, $asort);
             } elseif ('ASC' == Inflector::upper(current($orderDirection)) && 'DESC' == Inflector::upper(end($orderDirection))) {
                 array_multisort(${$first}, SORT_ASC, ${$second}, SORT_DESC, $asort);
             }
         }
     } else {
         if ('ASC' == Inflector::upper($orderDirection)) {
             array_multisort(${$field}, SORT_ASC, $asort);
         } else {
             array_multisort(${$field}, SORT_DESC, $asort);
         }
     }
     $collection = array();
     foreach ($asort as $key => $row) {
         $tmpId = $row['id'];
         $tmpObject = static::getById($type, $tmpId);
         array_push($collection, $tmpObject);
     }
     return $collection;
 }
开发者ID:schpill,项目名称:thin,代码行数:64,代码来源:Datacloud.php


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