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


PHP Arrays::toArray方法代码示例

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


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

示例1: callFunction

 public static function callFunction($functionName, $parameters)
 {
     $db = self::getInstance();
     $bindParams = Arrays::toArray($parameters);
     $paramsQueryString = implode(',', array_pad(array(), sizeof($bindParams), '?'));
     return Arrays::first($db->query("SELECT {$functionName}({$paramsQueryString})", $parameters)->fetch());
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:7,代码来源:Db.php

示例2: __construct

 public function __construct($httpCode, $errors, $headers = array())
 {
     $this->_httpCode = $httpCode;
     $this->_errors = Arrays::toArray($errors);
     $this->_headers = $headers;
     $firstError = Arrays::first($this->_errors);
     parent::__construct($firstError->getMessage(), $firstError->getCode());
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:8,代码来源:OuzoException.php

示例3: showSuccess

function showSuccess(array $notices = array())
{
    if (Session::has('messages') || $notices) {
        $sessionMessages = Arrays::filterNotBlank(Arrays::toArray(Session::get('messages')));
        $notices = array_merge($sessionMessages, $notices);
        $noticeView = new View('success_alert');
        $noticeView->notices = $notices;
        return $noticeView->render();
    }
    return null;
}
开发者ID:letsdrink,项目名称:ouzo,代码行数:11,代码来源:ViewHelper.php

示例4: getKeyAndValueArguments

 private function getKeyAndValueArguments($args)
 {
     if (count($args) == 1 && is_array($args[0])) {
         $args = $args[0];
     }
     if (count($args) < 2) {
         throw new InvalidArgumentException('Method needs at least two arguments: key and value');
     }
     $value = array_pop($args);
     $keys = Arrays::toArray($args);
     return array($keys, $value);
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:12,代码来源:SessionObject.php

示例5: selectTag

function selectTag($name, array $items = array(), $value, array $attributes = array(), $promptOption = null)
{
    $value = Arrays::toArray($value);
    $attr = _prepareAttributes($attributes, array('name' => $name));
    $optionsString = '';
    if ($promptOption) {
        $items = array(null => $promptOption) + $items;
    }
    foreach ($items as $optionValue => $optionName) {
        $optionsString .= optionTag($optionValue, $optionName, $value);
    }
    return '<select ' . $attr . '>' . $optionsString . '</select>';
}
开发者ID:letsdrink,项目名称:ouzo,代码行数:13,代码来源:FormHelper.php

示例6: associateRelationsWithAliases

 /**
  * @param Relation[] $relations
  * @param string|string[]|null $aliases
  * @return RelationWithAlias[]
  */
 public static function associateRelationsWithAliases(array $relations, $aliases)
 {
     $aliases = Arrays::toArray($aliases);
     if (count($relations) < count($aliases)) {
         throw new InvalidArgumentException("More aliases than relations in join");
     }
     $relationWithAliases = array();
     foreach ($relations as $index => $relation) {
         $alias = Arrays::getValue($aliases, $index, Arrays::getValue($aliases, $relation->getName()));
         $relationWithAliases[] = new RelationWithAlias($relation, $alias);
     }
     return $relationWithAliases;
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:18,代码来源:ModelQueryBuilderHelper.php

示例7: revertProperty

 public function revertProperty($keys)
 {
     $keys = Arrays::toArray($keys);
     $config =& $this->_config;
     $overriddenConfig =& $this->_overriddenConfig;
     $overriddenKey = null;
     foreach ($keys as $key) {
         if (!array_key_exists($key, $overriddenConfig)) {
             throw new InvalidArgumentException('Cannot revert. No configuration override for: ' . Objects::toString($keys));
         }
         $config =& $config[$key];
         if (is_array($overriddenConfig[$key])) {
             $overriddenConfig =& $overriddenConfig[$key];
         } else {
             $overriddenKey = $key;
         }
     }
     $config = $overriddenConfig[$overriddenKey];
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:19,代码来源:ConfigRepository.php

示例8: addRoute

 private static function addRoute($method, $uri, $action, $requireAction = true, $options = array(), $isResource = false)
 {
     $methods = Arrays::toArray($method);
     if (self::$isDebug && $requireAction && self::$validate && self::existRouteRule($methods, $uri)) {
         $methods = implode(', ', $methods);
         throw new InvalidArgumentException('Route rule for method ' . $methods . ' and URI "' . $uri . '" already exists');
     }
     $elements = explode('#', $action);
     $controller = Arrays::first($elements);
     $actionToRule = Arrays::getValue($elements, 1);
     $routeRule = new RouteRule($method, $uri, $controller, $actionToRule, $requireAction, $options, $isResource);
     if ($routeRule->hasRequiredAction()) {
         throw new InvalidArgumentException('Route rule ' . $uri . ' required action');
     }
     self::$routes[] = $routeRule;
     foreach ($methods as $method) {
         self::$routeKeys[$method . $uri] = true;
     }
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:19,代码来源:Route.php

示例9: select

 /**
  * @param $columns
  * @param int $type
  * @return ModelQueryBuilder
  */
 public function select($columns, $type = PDO::FETCH_NUM)
 {
     $this->_selectModel = false;
     $this->_query->selectColumns = Arrays::toArray($columns);
     $this->_query->selectType = $type;
     return $this;
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:12,代码来源:ModelQueryBuilder.php

示例10: types

 /**
  * @return $this
  */
 private function types()
 {
     $ns = $this->builder->getNs();
     $typesElement = $this->createElement('types');
     $schemaElement = $this->createElementWithAttributes('xsd:schema', ['targetNamespace' => $ns, 'xmlns' => $ns]);
     foreach ($this->builder->getMethods() as $method) {
         $typesForParameters = $this->XMLStyle->generateTypes($this->DOMDocument, $method->getParameters(), $this->XMLSoapVersion);
         $typesForReturn = $this->XMLStyle->generateTypes($this->DOMDocument, Arrays::toArray($method->getReturn()), $this->XMLSoapVersion);
         $types = array_merge($typesForParameters, $typesForReturn);
         foreach ($types as $type) {
             $schemaElement->appendChild($type);
         }
     }
     $typesElement->appendChild($schemaElement);
     $this->definitionsRootNode->appendChild($typesElement);
     return $this;
 }
开发者ID:piotrooo,项目名称:wsdl-creator,代码行数:20,代码来源:XMLProvider.php

示例11: wrapAsNotices

 private function wrapAsNotices($messages, $url)
 {
     $array = Arrays::toArray($messages);
     return Arrays::map($array, function ($msg) use($url) {
         return new Notice($msg, $url);
     });
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:7,代码来源:Controller.php

示例12: findBySql

 /** Executes a native sql and returns an array of model objects created by passing every result row to the model constructor.
  * @param $nativeSql - database specific sql
  * @param array $params - bind parameters
  * @return Model[]
  */
 public static function findBySql($nativeSql, $params = array())
 {
     $meta = static::metaInstance();
     $results = $meta->_modelDefinition->db->query($nativeSql, Arrays::toArray($params))->fetchAll();
     return Arrays::map($results, function ($row) use($meta) {
         return $meta->newInstance($row);
     });
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:13,代码来源:Model.php

示例13: toArrayShouldReturnArrayWithOneElementForEmptyString

 /**
  * @test
  */
 public function toArrayShouldReturnArrayWithOneElementForEmptyString()
 {
     // when
     $result = Arrays::toArray('');
     // then
     $this->assertEquals(array(''), $result);
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:10,代码来源:ArraysTest.php

示例14: __construct

 public function __construct($sql, $parameters = array())
 {
     $this->sql = $sql;
     $this->values = $parameters === NULL ? array(null) : Arrays::toArray($parameters);
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:5,代码来源:SqlWhereClause.php

示例15: getControllerNamespace

 public static function getControllerNamespace()
 {
     $controllerPath = Config::getValue('namespace', 'controller');
     return $controllerPath ? Arrays::toArray($controllerPath) : array("\\Application\\Controller\\");
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:5,代码来源:AutoloadNamespaces.php


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