本文整理汇总了PHP中Ouzo\Utilities\Arrays::filterNotBlank方法的典型用法代码示例。如果您正苦于以下问题:PHP Arrays::filterNotBlank方法的具体用法?PHP Arrays::filterNotBlank怎么用?PHP Arrays::filterNotBlank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ouzo\Utilities\Arrays
的用法示例。
在下文中一共展示了Arrays::filterNotBlank方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildWhereKeys
private static function _buildWhereKeys($params)
{
$keys = array();
foreach ($params as $column => $value) {
$keys[] = self::_buildWhereKey($column, $value);
}
return Arrays::filterNotBlank($keys);
}
示例2: 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;
}
示例3: parse
public static function parse($data)
{
$array = array();
$items = Arrays::filterNotBlank(explode(',', $data));
foreach ($items as $item) {
$elements = explode(';', $item);
$media = Arrays::first($elements);
$params = array_slice($elements, 1);
list($type, $subtype) = Arrays::map(explode('/', $media), Functions::trim());
$q = Arrays::getValue(self::extractParams($params), 'q');
$array[] = array('type' => $type, 'subtype' => $subtype, 'q' => $q);
}
usort($array, '\\Ouzo\\Http\\AcceptHeaderParser::_compare');
return Arrays::toMap($array, function ($input) {
return $input['type'] . '/' . $input['subtype'];
}, function ($input) {
return $input['q'];
});
}
示例4: filterNotBlank
public function filterNotBlank()
{
$this->_array = Arrays::filterNotBlank($this->_array);
return $this;
}
示例5: shouldFilterNotBlank
/**
* @test
*/
public function shouldFilterNotBlank()
{
//given
$array = array(0 => 'foo', 1 => false, 2 => -1, 3 => null, 4 => '');
//when
$filtered = Arrays::filterNotBlank($array);
//then
Assert::thatArray($filtered)->hasSize(2)->contains('foo', -1);
}
示例6: getClassNamespace
public function getClassNamespace()
{
$parts = explode('\\', $this->namespace);
$parts = Arrays::map($parts, 'ucfirst');
$modelNamespace = trim(AutoloadNamespaces::getModelNamespace(), '\\');
if (!Strings::startsWith($this->namespace, $modelNamespace)) {
$parts = array_merge(array($modelNamespace), $parts);
}
$parts = Arrays::filterNotBlank($parts);
return implode('\\', $parts);
}
示例7: getValueRecursively
/**
* @param mixed $object
* @param string $names
* @param null|mixed $default
* @param bool $accessPrivate
* @return mixed|null
*/
public static function getValueRecursively($object, $names, $default = null, $accessPrivate = false)
{
$fields = Arrays::filterNotBlank(explode('->', $names));
foreach ($fields as $field) {
$object = self::getValueOrCallMethod($object, $field, null, $accessPrivate);
if ($object === null) {
return $default;
}
}
return $object;
}
示例8: buildWhereQuery
public static function buildWhereQuery($whereClauses)
{
$parts = FluentArray::from($whereClauses)->filter(WhereClause::isNotEmptyFunction())->map('\\Ouzo\\Db\\Dialect\\DialectUtil::buildWhereQueryPart')->toArray();
return implode(' AND ', Arrays::filterNotBlank($parts));
}