_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q260700
PodManager.createDocument
test
private function createDocument($type, $data = array(), $new = true) { $document = new Document($this->_toolbox, $type, $data, $new); $this->attachEventsToPod($document); return $this->setupModel($document, $document); }
php
{ "resource": "" }
q260701
PodManager.setupModel
test
private function setupModel(Document $pod) { $name = $this->_toolbox->formatModel($pod); $model = new $name(); if (!($model instanceof AModel)) { throw new PodManagerException("Custom models must inherit from the Paradox Model class."); } $model->loadPod($pod);...
php
{ "resource": "" }
q260702
PodManager.determinePreviouslyStored
test
private function determinePreviouslyStored($model) { $store = $this->_toolbox->getTransactionManager()->searchCommandsByActionAndObject('PodManager:store', $model); $delete = $this->_toolbox->getTransactionManager()->searchCommandsByActionAndObject('PodManager:delete', $model); $storePositi...
php
{ "resource": "" }
q260703
PodManager.addTransactionCommand
test
private function addTransactionCommand($command, $action, $object = null, $isGraph = false, $data = array()) { return $this->_toolbox->getTransactionManager()->addCommand($command, $action, $object, $isGraph, $data); }
php
{ "resource": "" }
q260704
PodManager.validateType
test
public function validateType($type) { if ($this->_toolbox->isGraph()) { if (!in_array(strtolower($type), array('edge', 'vertex'))) { return false; } } return true; }
php
{ "resource": "" }
q260705
ApiHelper.mapList
test
public static function mapList(callable $callback, array $data): array { if (!isset($data[0])) { $data = [$data]; } return array_map($callback, $data); }
php
{ "resource": "" }
q260706
AbstractCrawler.crawl
test
final protected function crawl(string $url, array $params = []): ?Crawler { if ($content = $this->connection->getPageBody($url, $params)) { return new Crawler($content); } return null; }
php
{ "resource": "" }
q260707
AbstractCrawler.parseUrl
test
final protected function parseUrl(Crawler $node, string $attr = 'href'): ?string { if (0 === $node->count()) { return null; } if ($url = $node->attr($attr)) { return preg_replace('/^\//', static::URL_PREFIX.'/', $url); } return null; }
php
{ "resource": "" }
q260708
AbstractCrawler.parseImage
test
final protected function parseImage(Crawler $node): ?Image { $src = $this->parseUrl($node, 'src'); if (!$src) { return null; } return new Image($src); }
php
{ "resource": "" }
q260709
AbstractCrawler.parseString
test
final protected function parseString(Crawler $node, bool $multiline = false): ?string { if (0 === $node->count()) { return null; } $content = $node->attr('content'); if (null === $content) { if ($multiline) { $content = $node->html(); ...
php
{ "resource": "" }
q260710
AbstractCrawler.parseDate
test
final protected function parseDate(Crawler $node): ?DateTime { $content = $this->parseString($node); if (null !== $content) { return new DateTime($content); } return null; }
php
{ "resource": "" }
q260711
Autoloader.load
test
public static function load($className) { $className = str_replace(__NAMESPACE__, '', $className); $className = str_replace("\\", DIRECTORY_SEPARATOR, $className); if (file_exists(self::$dirRoot . $className . self::EXTENSION)) { require_once self::$dirRoot . $className . self::...
php
{ "resource": "" }
q260712
CovCatcher._start
test
protected function _start() { if (!$this->_isStart && $this->_coverage) { $this->_isStart = true; $this->_coverage->start($this->_hash, true); } }
php
{ "resource": "" }
q260713
CovCatcher._initConfig
test
protected function _initConfig(array $options) { $options = array_filter($options, function ($option) { return null !== $option; }); $this->_config = new Data(array_merge($this->_default, $options)); }
php
{ "resource": "" }
q260714
Vertex.relateTo
test
public function relateTo(AModel $to, $label = null) { $edge = $this->_toolbox->getPodManager()->dispense("edge", $label); $edge->setTo($to); $edge->setFrom($this->getModel()); return $edge; }
php
{ "resource": "" }
q260715
Vertex.getInboundEdges
test
public function getInboundEdges($label = null, $aql = "", $params = array(), $placeholder = "doc") { return $this->_toolbox->getGraphManager()->getInboundEdges($this->getId(), $label, $aql, $params, $placeholder); }
php
{ "resource": "" }
q260716
Vertex.toDriverDocument
test
public function toDriverDocument() { $vertex = new \triagens\ArangoDb\Vertex; foreach ($this->_data as $key => $value) { $vertex->set($key, $value); } if ($this->_id) { $vertex->setInternalId($this->_id); } if ($this->_key) { $ve...
php
{ "resource": "" }
q260717
ApiClient.encodeUTF8
test
private function encodeUTF8($object) { if (\is_array($object)) { return array_map([$this, 'encodeUTF8'], $object); } return mb_convert_encoding((string) $object, 'UTF-8', 'auto'); }
php
{ "resource": "" }
q260718
CollectionManager.createCollection
test
public function createCollection($name) { try { return $this->_toolbox->getCollectionHandler()->create($name); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new CollectionManagerException($normalised['message'], $nor...
php
{ "resource": "" }
q260719
CollectionManager.deleteCollection
test
public function deleteCollection($name) { try { return $this->_toolbox->getCollectionHandler()->delete($name); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new CollectionManagerException($normalised['message'], $nor...
php
{ "resource": "" }
q260720
CollectionManager.renameCollection
test
public function renameCollection($collection, $newName) { try { return $this->_toolbox->getCollectionHandler()->rename($collection, $newName); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new CollectionManagerExcept...
php
{ "resource": "" }
q260721
CollectionManager.wipe
test
public function wipe($collection) { try { return $this->_toolbox->getCollectionHandler()->truncate($collection); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new CollectionManagerException($normalised['message'], $n...
php
{ "resource": "" }
q260722
CollectionManager.getCollectionInfo
test
public function getCollectionInfo($collection) { try { $collection = $this->_toolbox->getCollectionHandler()->getProperties($collection); $result = $collection->getAll(); switch ($result['type']) { case 2: $result['type'] = "documents...
php
{ "resource": "" }
q260723
CollectionManager.getCollectionStatistics
test
public function getCollectionStatistics($collection) { try { return $this->_toolbox->getCollectionHandler()->getFigures($collection); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new CollectionManagerException($norm...
php
{ "resource": "" }
q260724
CollectionManager.count
test
public function count($collection) { try { return $this->_toolbox->getCollectionHandler()->count($collection); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new CollectionManagerException($normalised['message'], $nor...
php
{ "resource": "" }
q260725
CollectionManager.loadCollection
test
public function loadCollection($collection) { try { return $this->_toolbox->getCollectionHandler()->load($collection); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new CollectionManagerException($normalised['message...
php
{ "resource": "" }
q260726
CollectionManager.unloadCollection
test
public function unloadCollection($collection) { try { return $this->_toolbox->getCollectionHandler()->unload($collection); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new CollectionManagerException($normalised['mes...
php
{ "resource": "" }
q260727
CollectionManager.getIndexInfo
test
public function getIndexInfo($collection, $indexId) { $result = $this->listIndices($collection, true); return isset($result[$collection . '/' . $indexId]) ? $result[$collection . '/' . $indexId] : null; }
php
{ "resource": "" }
q260728
CollectionManager.getGeoFieldsForAQL
test
public function getGeoFieldsForAQL($collection) { $indices = $this->_toolbox->getCollectionManager()->listIndices($collection, true); foreach ($indices as $index => $info) { //If this is the first geo index we encounter if ($info['type'] == "geo1" || $info['type'] == "geo2"...
php
{ "resource": "" }
q260729
Finder.any
test
public function any($type) { if ($this->_toolbox->getTransactionManager()->hasTransaction()) { $this->_toolbox->getTransactionManager()->addReadCollection($type); $this->_toolbox->getTransactionManager()->addCommand("db.$type.any();" , "Finder:any", null, false, array('type' => $type...
php
{ "resource": "" }
q260730
Finder.getCollectionName
test
private function getCollectionName($type) { if ($this->_toolbox->isGraph()) { if (!$this->_toolbox->getPodManager()->validateType($type)) { throw new FinderException("When finding documents in graphs, only the types 'vertex' and 'edge' are allowed."); } ...
php
{ "resource": "" }
q260731
Server.deleteUser
test
public function deleteUser($username) { try { $this->_toolbox->getUserHandler()->removeUser($username); return true; } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new ServerException($normalised['message...
php
{ "resource": "" }
q260732
Server.getUserInfo
test
public function getUserInfo($username) { try { $details = $this->_toolbox->getUserHandler()->get($username); $result = array(); $result['username'] = $details->get('user'); $result['active'] = $details->get('active'); $result['data'] = $details->g...
php
{ "resource": "" }
q260733
Server.deleteAQLFunctionsByNamespace
test
public function deleteAQLFunctionsByNamespace($namespace) { try { $userFunction = new AqlUserFunction($this->_toolbox->getConnection()); $userFunction->unregister($namespace, true); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions...
php
{ "resource": "" }
q260734
Server.listAQLFunctions
test
public function listAQLFunctions($namespace = null) { try { $userFunction = new AqlUserFunction($this->_toolbox->getConnection()); $functions = $userFunction->getRegisteredUserFunctions($namespace); $result = array(); foreach ($functions as $function) { ...
php
{ "resource": "" }
q260735
Server.getVersion
test
public function getVersion() { try { return $this->_toolbox->getAdminHandler()->getServerVersion(); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new ServerException($normalised['message'], $normalised['code']); ...
php
{ "resource": "" }
q260736
Server.getServerInfo
test
public function getServerInfo() { try { return $this->_toolbox->getAdminHandler()->getServerVersion(true); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new ServerException($normalised['message'], $normalised['code']...
php
{ "resource": "" }
q260737
Server.getTime
test
public function getTime() { try { return $this->_toolbox->getAdminHandler()->getServerTime(); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new ServerException($normalised['message'], $normalised['code']); } ...
php
{ "resource": "" }
q260738
Document.set
test
public function set($key, $value) { if (in_array($key, $this->getReservedFields())) { throw new PodException("You cannot set the property $key. This is reserved for system use."); } $this->_changed = true; $this->_data[$key] = $value; }
php
{ "resource": "" }
q260739
Document.remove
test
public function remove($key) { if (in_array($key, $this->getReservedFields())) { throw new PodException("You cannot set the property $key. This is reserved for system use."); } $this->_changed = true; unset($this->_data[$key]); }
php
{ "resource": "" }
q260740
Document.get
test
public function get($key) { if (in_array($key, $this->getReservedFields())) { throw new PodException("You cannot get the system property '$key'. Use the appropriate getter for it."); } return isset($this->_data[$key]) ? $this->_data[$key] : null; }
php
{ "resource": "" }
q260741
Document.setId
test
public function setId($id) { if ($this->_id !== null && $this->_id != $id) { throw new PodException('Cannot update the id of an existing document'); } if (!preg_match('/^\w+\/\w+$/', $id)) { throw new PodException('Invalid format for document id'); } ...
php
{ "resource": "" }
q260742
Document.setDistanceInfo
test
public function setDistanceInfo($latitude, $longitude, $podId = null) { if (isset($this->_distance) || isset($this->_referenceCoordinates) || isset($this->_referencePodId)) { throw new PodException("Cannot update the distance info from an existing query."); } $this->_distance = ...
php
{ "resource": "" }
q260743
Document.resetMeta
test
public function resetMeta() { $this->_new = true; $this->_changed = true; $this->_id = null; $this->_key = null; $this->_rev = null; }
php
{ "resource": "" }
q260744
Document.toArray
test
public function toArray() { $result = array('_id' => $this->getId(), '_key' => $this->getKey(), '_rev' => $this->getRevision()); return array_merge($result, $this->_data); }
php
{ "resource": "" }
q260745
Document.toJSON
test
public function toJSON() { $result = array('_id' => $this->getId(), '_key' => $this->getKey(), '_rev' => $this->getRevision()); return json_encode(array_merge($result, $this->_data), JSON_FORCE_OBJECT); }
php
{ "resource": "" }
q260746
Document.toTransactionJSON
test
public function toTransactionJSON() { $result = array('_rev' => $this->getRevision()); return json_encode(array_merge($result, $this->_data), JSON_FORCE_OBJECT); }
php
{ "resource": "" }
q260747
Document.toDriverDocument
test
public function toDriverDocument() { $document = new \triagens\ArangoDb\Document; foreach ($this->_data as $key => $value) { $document->set($key, $value); } if ($this->_id) { $document->setInternalId($this->_id); } if ($this->_key) { ...
php
{ "resource": "" }
q260748
Document.loadFromDriver
test
public function loadFromDriver(\triagens\ArangoDb\Document $driverDocument) { $values = $driverDocument->getAll(array('_includeInternals' => true)); foreach ($values as $key => $value) { if (!in_array($key, array('_id', '_key', '_rev'))) { $this->_data[$key] = $value; ...
php
{ "resource": "" }
q260749
Document.loadFromArray
test
public function loadFromArray($data) { foreach ($data as $property => $value) { switch ($property) { case "_id": $this->setId($value); break; case "_key": break; case "_rev": ...
php
{ "resource": "" }
q260750
Document.onEvent
test
public function onEvent(Event $eventObject) { if ($eventObject->getObject() === $this) { switch ($eventObject->getEvent()) { case 'after_dispense': $this->getModel()->afterDispense(); break; case 'after_open': ...
php
{ "resource": "" }
q260751
Edge.setTo
test
public function setTo(AModel $to) { $this->_to = $to; $this->setInternalTo($to->getPod()->getId()); }
php
{ "resource": "" }
q260752
Edge.getToId
test
public function getToId() { if (isset($this->_to)) { return $this->_to->getPod()->getId(); } elseif (isset($this->_data['_to'])) { return $this->_data['_to']; } else { return null; } }
php
{ "resource": "" }
q260753
Edge.setFrom
test
public function setFrom(AModel $from) { $this->_from = $from; $this->setInternalFrom($from->getPod()->getId()); }
php
{ "resource": "" }
q260754
Edge.getFromId
test
public function getFromId() { if (isset($this->_from)) { return $this->_from->getPod()->getId(); } elseif (isset($this->_data['_from'])) { return $this->_data['_from']; } else { return null; } }
php
{ "resource": "" }
q260755
Edge.toDriverDocument
test
public function toDriverDocument() { $edge = new \triagens\ArangoDb\Edge; foreach ($this->_data as $key => $value) { $edge->set($key, $value); } if ($this->_id) { $edge->setInternalId($this->_id); } if ($this->_key) { $edge->setI...
php
{ "resource": "" }
q260756
TransactionManager.begin
test
public function begin() { if ($this->_activeTransaction) { throw new TransactionManagerException("An active transaction already exists."); } $this->_activeTransaction = true; $this->_transactionPaused = false; return true; }
php
{ "resource": "" }
q260757
TransactionManager.commit
test
public function commit() { if (!$this->_activeTransaction) { throw new TransactionManagerException("There is no active transaction to commit."); } if (empty($this->_commands)) { throw new TransactionManagerException("There is no transaction operations to commit."); ...
php
{ "resource": "" }
q260758
TransactionManager.clearTransactionInfo
test
private function clearTransactionInfo() { $this->_activeTransaction = false; $this->_transactionPaused = true; $this->_collections = array('write' => array(), 'read' => array()); $this->_commands = array(); $this->_registeredResults = array(); }
php
{ "resource": "" }
q260759
TransactionManager.addReadCollection
test
public function addReadCollection($collection) { if (!$this->_activeTransaction) { throw new TransactionManagerException("There is no active transaction."); } if (!in_array($collection, $this->_collections['read'])) { $this->_collections['read'][] = $collection; ...
php
{ "resource": "" }
q260760
TransactionManager.addWriteCollection
test
public function addWriteCollection($collection) { if (!$this->_activeTransaction) { throw new TransactionManagerException("There is no active transaction."); } if (!in_array($collection, $this->_collections['write'])) { $this->_collections['write'][] = $collection; ...
php
{ "resource": "" }
q260761
TransactionManager.pause
test
public function pause() { if (!$this->_activeTransaction) { throw new TransactionManagerException("There is no active transaction."); } if ($this->_transactionPaused) { throw new TransactionManagerException("The transaction is already paused."); } $t...
php
{ "resource": "" }
q260762
TransactionManager.resume
test
public function resume() { if (!$this->_activeTransaction) { throw new TransactionManagerException("There is no active transaction."); } if (!$this->_transactionPaused) { throw new TransactionManagerException("The transaction is not paused."); } $thi...
php
{ "resource": "" }
q260763
TransactionManager.addCommand
test
public function addCommand($command, $action, $object = null, $isGraph = false, $data = array()) { if (!$this->_activeTransaction) { throw new TransactionManagerException("There is no active transaction."); } $id = $this->random(); $this->_commands[$id] = array('command'...
php
{ "resource": "" }
q260764
TransactionManager.searchCommandsByActionAndObject
test
public function searchCommandsByActionAndObject($action, $object) { $position = 0; $length = count($this->_commands); foreach (array_reverse($this->_commands) as $id => $command) { if ($command['action'] == $action && $command['object'] === $object) { return arra...
php
{ "resource": "" }
q260765
TransactionManager.random
test
private function random() { $characters = 'abcdefghijklmnopqrstuvwxyz'; $id = ''; while (strlen($id) < 7 || in_array($id, array_keys($this->_commands))) { $id .= $characters[rand(0, strlen($characters) - 1)]; } return $id; }
php
{ "resource": "" }
q260766
GraphManager.createGraph
test
public function createGraph($name) { try { $graph = new \triagens\ArangoDb\Graph($name); $graph->setVerticesCollection($name . 'VertexCollection'); $graph->setEdgesCollection($name . 'EdgeCollection'); return $this->_toolbox->getGraphHandler()->createGraph($g...
php
{ "resource": "" }
q260767
GraphManager.deleteGraph
test
public function deleteGraph($name) { try { $graphHandler = $this->_toolbox->getGraphHandler(); return $graphHandler->dropGraph($name); } catch (\Exception $e) { $normalised = $this->_toolbox->normaliseDriverExceptions($e); throw new GraphManagerExcept...
php
{ "resource": "" }
q260768
GraphManager.getGraphInfo
test
public function getGraphInfo($name) { $graphHandler = $this->_toolbox->getGraphHandler(); $graph = $graphHandler->getGraph($name); if(!$graph){ throw new GraphManagerException("Graph does not exist"); } $result = array(); $result['id'] = $graph->getKey...
php
{ "resource": "" }
q260769
GraphManager.getOutboundEdges
test
public function getOutboundEdges($model, $label = null, $aql = "", $params = array(), $placeholder = "doc") { $id = $this->getVertexId($model); if (!$id) { return array(); } $collectionParameter = $this->_toolbox->generateBindingParameter('@collection', $params); ...
php
{ "resource": "" }
q260770
ListFilterHelper.getFilters
test
public function getFilters() { if ($this->_filters) { return $this->_filters; } elseif (isset($this->_View->viewVars['filters'])) { return $this->_View->viewVars['filters']; } return []; }
php
{ "resource": "" }
q260771
ListFilterHelper.renderFilterbox
test
public function renderFilterbox($filters = null) { if ($filters) { $this->_filters = $filters; } $filterBox = $this->openContainer(); $filterBox .= $this->openForm(); $filterBox .= $this->renderAll(); $filterBox .= $this->closeForm(); $filterBox ....
php
{ "resource": "" }
q260772
ListFilterHelper.renderAll
test
public function renderAll() { $widgets = []; foreach ($this->getFilters() as $field => $options) { $w = $this->filterWidget($field, $options, false); if ($w) { $widgets = array_merge($widgets, $w); } } // FIXME allow column-layout ...
php
{ "resource": "" }
q260773
ListFilterHelper.openContainer
test
public function openContainer() { $classes = $this->config('containerClasses'); $title = __d('list_filter', 'list_filter.filter_fieldset_title'); if ($this->filterActive()) { $classes .= ' opened'; } else { $classes .= ' closed'; } $ret = $t...
php
{ "resource": "" }
q260774
ListFilterHelper.closeContainer
test
public function closeContainer() { $ret = $this->templater()->format('contentEnd', []); $ret .= $this->templater()->format('containerEnd', []); return $ret; }
php
{ "resource": "" }
q260775
ListFilterHelper.openForm
test
public function openForm() { $options = Hash::merge(['url' => $this->here], $this->config('formOptions')); $ret = $this->Form->create('Filter', $options); return $ret; }
php
{ "resource": "" }
q260776
ListFilterHelper.closeForm
test
public function closeForm($includeFilterButton = true, $includeResetButton = true) { $buttons = ''; if ($includeFilterButton) { $buttons .= $this->filterButton(); } if ($includeResetButton) { $buttons .= ' ' . $this->resetButton(); } $ret = $th...
php
{ "resource": "" }
q260777
ListFilterHelper.filterActive
test
public function filterActive() { $filterActive = (isset($this->_View->viewVars['filterActive']) && $this->_View->viewVars['filterActive'] === true); return $filterActive; }
php
{ "resource": "" }
q260778
ListFilterHelper.filterButton
test
public function filterButton($title = null, array $options = []) { if (!$title) { $title = __d('list_filter', 'list_filter.search'); } $options = Hash::merge($this->config('filterButtonOptions'), $options); return $this->Form->button($title, $options); }
php
{ "resource": "" }
q260779
ListFilterHelper.resetButton
test
public function resetButton($title = null, array $options = []) { if (!$title) { $title = __d('list_filter', 'list_filter.reset'); } $params = $this->_View->request->query; if (!empty($params)) { foreach ($params as $field => $value) { if (subs...
php
{ "resource": "" }
q260780
ListFilterHelper.backToListButton
test
public function backToListButton($title = null, array $url = null, array $options = []) { if (empty($url)) { $url = [ 'action' => 'index' ]; } $options = Hash::merge([ 'class' => 'btn btn-default btn-xs', 'escape' => false, ...
php
{ "resource": "" }
q260781
ListFilterComponent._getPersistendStorageKey
test
protected function _getPersistendStorageKey($key) { if (!isset($this->config[$key]['namespace'])) { $namespace = 'ListFilter'; } else { $namespace = $this->config[$key]['namespace']; } $sessionKey = [ 'namespace' => $namespace, 'plugin'...
php
{ "resource": "" }
q260782
ListFilterComponent.filterUrlParameterStatus
test
public function filterUrlParameterStatus() { foreach ($this->_controller->request->query as $arg => $value) { if (substr($arg, 0, 7) == 'Filter-') { return true; } } return false; }
php
{ "resource": "" }
q260783
ListFilterComponent._getFulltextSearchConditions
test
protected function _getFulltextSearchConditions($conditionField, $value, array $options) { $searchTerms = explode(' ', $value); $searchTerms = array_map('trim', $searchTerms); $searchTerms = array_map('mb_strtolower', $searchTerms); if (isset($options['termsCallback']) && is_callabl...
php
{ "resource": "" }
q260784
ListFilterComponent._flattenValueOptions
test
protected function _flattenValueOptions(array $options) { $flatOptions = $options; if (is_array(current($options))) { $flatOptions = []; foreach ($options as $group => $valueGroup) { $flatOptions = $flatOptions + $valueGroup; } } r...
php
{ "resource": "" }
q260785
ListFilterComponent.getFilters
test
public function getFilters() { $filters = []; if (method_exists($this->_controller, 'getListFilters')) { $filters = $this->_controller->getListFilters($this->_controller->request->action); } elseif (isset($this->_controller->listFilters) && !empty($this->_controller->listFilters[...
php
{ "resource": "" }
q260786
ListFilterComponent.getRedirectUrlFromPostData
test
public function getRedirectUrlFromPostData(array $postData) { $urlParams = []; foreach ($postData['Filter'] as $model => $fields) { foreach ($fields as $field => $value) { if (is_array($value) && isset($value['year'])) { $value = "{$value['year']}-{$va...
php
{ "resource": "" }
q260787
ListFilterComponent.addListFilterParams
test
public function addListFilterParams(array $url) { foreach ($this->request->query as $key => $value) { if (substr($key, 0, 7) == 'Filter-' || in_array($key, ['page', 'sort', 'direction'])) { $url[$key] = $value; } } return $url; }
php
{ "resource": "" }
q260788
ListFilterComponent.defaultFilters
test
public function defaultFilters($filters = []) { if (empty($filters)) { return false; } foreach ($filters as $key => $value) { $filterName = 'Filter-' . str_replace('.', '-', $key); $explodedFilterName = explode('-', $filterName); if (count($exp...
php
{ "resource": "" }
q260789
Query.build
test
public static function build($pdo, $sql, array $params) { $bind_values = []; $sql = strtr($sql, "\n", ' '); $sql = preg_replace_callback( '/'.Query::RE_HOLDER.'/', function ($m) use ($pdo, $params, &$bind_values) { $key = $m['key']; $t...
php
{ "resource": "" }
q260790
AggregationTrait.reduce
test
public function reduce(callable $callback, $initial = null) { return i\iterable_reduce($this->iterable, $callback, $initial); }
php
{ "resource": "" }
q260791
TypeHandlingTrait.typeCheck
test
public function typeCheck($type, ?\Throwable $throwable = null) { return $this->then(i\iterable_type_check, $type, $throwable); }
php
{ "resource": "" }
q260792
TypeHandlingTrait.typeCast
test
public function typeCast(string $type, ?\Throwable $throwable = null) { return $this->then(i\iterable_type_cast, $type, $throwable); }
php
{ "resource": "" }
q260793
Silex2ServiceProvider.register
test
public function register(Container $app) { $app['bugsnag.resolver'] = function () { return new SilexResolver(); }; $app['bugsnag'] = function () use ($app) { return $this->makeClient($app); }; $app['bugsnag.notifier'] = function() use ($app) { ...
php
{ "resource": "" }
q260794
AbstractServiceProvider.makeClient
test
protected function makeClient(Application $app) { try { $config = $app['bugsnag.options']; } catch (InvalidArgumentException $e) { $config = []; } $key = isset($config['api_key']) ? $config['api_key'] : getenv('BUGSNAG_API_KEY'); $guzzle = Client::ma...
php
{ "resource": "" }
q260795
AbstractServiceProvider.setupUserDetection
test
protected function setupUserDetection(Client $client, Application $app) { try { $tokens = $app['security.token_storage']; $checker = $app['security.authorization_checker']; } catch (InvalidArgumentException $e) { return; } $client->registerCallbac...
php
{ "resource": "" }
q260796
AbstractServiceProvider.setupPaths
test
protected function setupPaths(Client $client, $strip, $project) { if ($strip) { $client->setStripPath($strip); if (!$project) { $client->setProjectRoot("{$strip}/src"); } return; } $base = realpath(__DIR__.'/../../../../'); ...
php
{ "resource": "" }
q260797
PipelineBuilder.stub
test
public function stub(string $name): self { $hasStub = i\iterable_has_any($this->steps, function ($step) use ($name) { return $step[0] instanceof Stub && $step[0]->getName() === $name; }); if ($hasStub) { throw new \BadMethodCallException("Pipeline builder already has...
php
{ "resource": "" }
q260798
PipelineBuilder.unstub
test
public function unstub(string $name, callable $callable, ...$args): self { $index = i\iterable_find_key($this->steps, function ($step) use ($name) { return $step[0] instanceof Stub && $step[0]->getName() === $name; }); if ($index === null) { throw new \BadMethodCallE...
php
{ "resource": "" }
q260799
PipelineBuilder.with
test
public function with(iterable $iterable): Pipeline { $pipeline = new Pipeline($iterable); foreach ($this->steps as [$callback, $args]) { $pipeline = $pipeline->then($callback, ...$args); } return $pipeline; }
php
{ "resource": "" }