Programming Language PHP
Namespace Oro\Component\PhpUtils
Class ArrayUtil
Method/Function some
Total Examples 3
3 code examples of PHP Oro\Component\PhpUtils\ArrayUtil::some extracted from open source projects
/**
* @param $type
*/
protected function typedNodesExists($type): bool
{
return ArrayUtil::some(
function ($node) use ($type) {
$exists = false;
if ($node instanceof self) {
$exists = $node->getType() === $type;
} else {
switch ($type) {
case self::TYPE_COMPUTED:
$exists = $node->isComputed();
break;
case self::TYPE_UNCOMPUTED:
$exists = !$node->isComputed();
}
}
return $exists;
},
$this->nodes
);
}
/**
* Has email entities by owner entity
*/
public function hasEmailsByOwnerEntity(object $entity, string $ownerColumnName): bool
{
return ArrayUtil::some(
function (QueryBuilder $qb) {
return (bool) $qb
->select('e.id')
->setMaxResults(1)
->getQuery()
->getArrayResult();
},
$this->createEmailsByOwnerEntityQbs($entity, $ownerColumnName)
);
}
protected function isNeedToUpdateEnumFilter(array $row, $filter): bool
{
if (!isset($filter['columnName'], $filter['criterion']['filter'])
|| $filter['criterion']['filter'] !== 'string'
) {
return false;
}
if (isset($this->fixes['filters'][$row['entity']])
&& $filter['columnName'] === $this->fixes['filters'][$row['entity']]
) {
return true;
}
return ArrayUtil::some(
function ($column) use ($filter) {
return preg_match(sprintf('/%s$/', preg_quote($column)), $filter['columnName']);
},
$this->fixes['chainFilters']
);
}