repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.getByPosition
public function getByPosition($pos) { switch ($pos) { case 0: return $this->getId(); break; case 1: return $this->getName(); break; case 2: return $this->getStreet(); break; ...
php
public function getByPosition($pos) { switch ($pos) { case 0: return $this->getId(); break; case 1: return $this->getName(); break; case 2: return $this->getStreet(); break; ...
[ "public", "function", "getByPosition", "(", "$", "pos", ")", "{", "switch", "(", "$", "pos", ")", "{", "case", "0", ":", "return", "$", "this", "->", "getId", "(", ")", ";", "break", ";", "case", "1", ":", "return", "$", "this", "->", "getName", ...
Retrieves a field from the object by Position as specified in the xml schema. Zero-based. @param int $pos position in xml schema @return mixed Value of field at $pos
[ "Retrieves", "a", "field", "from", "the", "object", "by", "Position", "as", "specified", "in", "the", "xml", "schema", ".", "Zero", "-", "based", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1196-L1242
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.toArray
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['Customer'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['Cus...
php
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['Customer'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['Cus...
[ "public", "function", "toArray", "(", "$", "keyType", "=", "BasePeer", "::", "TYPE_PHPNAME", ",", "$", "includeLazyLoadColumns", "=", "true", ",", "$", "alreadyDumpedObjects", "=", "array", "(", ")", ",", "$", "includeForeignObjects", "=", "false", ")", "{", ...
Exports the object as an array. You can specify the key type of the array by passing one of the class type constants. @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defau...
[ "Exports", "the", "object", "as", "an", "array", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1259-L1299
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.setByPosition
public function setByPosition($pos, $value) { switch ($pos) { case 0: $this->setId($value); break; case 1: $this->setName($value); break; case 2: $this->setStreet($value); brea...
php
public function setByPosition($pos, $value) { switch ($pos) { case 0: $this->setId($value); break; case 1: $this->setName($value); break; case 2: $this->setStreet($value); brea...
[ "public", "function", "setByPosition", "(", "$", "pos", ",", "$", "value", ")", "{", "switch", "(", "$", "pos", ")", "{", "case", "0", ":", "$", "this", "->", "setId", "(", "$", "value", ")", ";", "break", ";", "case", "1", ":", "$", "this", "-...
Sets a field from the object by Position as specified in the xml schema. Zero-based. @param int $pos position in xml schema @param mixed $value field value @return void
[ "Sets", "a", "field", "from", "the", "object", "by", "Position", "as", "specified", "in", "the", "xml", "schema", ".", "Zero", "-", "based", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1327-L1370
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.fromArray
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CustomerPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); if (array_key_exists($keys[2]...
php
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CustomerPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); if (array_key_exists($keys[2]...
[ "public", "function", "fromArray", "(", "$", "arr", ",", "$", "keyType", "=", "BasePeer", "::", "TYPE_PHPNAME", ")", "{", "$", "keys", "=", "CustomerPeer", "::", "getFieldNames", "(", "$", "keyType", ")", ";", "if", "(", "array_key_exists", "(", "$", "ke...
Populates the object using an array. This is particularly useful when populating an object from one of the request arrays (e.g. $_POST). This method goes through the column names, checking to see whether a matching key exists in populated array. If so the setByName() method is called for that column. You can specify...
[ "Populates", "the", "object", "using", "an", "array", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1389-L1406
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.buildCriteria
public function buildCriteria() { $criteria = new Criteria(CustomerPeer::DATABASE_NAME); if ($this->isColumnModified(CustomerPeer::ID)) $criteria->add(CustomerPeer::ID, $this->id); if ($this->isColumnModified(CustomerPeer::NAME)) $criteria->add(CustomerPeer::NAME, $this->name); if (...
php
public function buildCriteria() { $criteria = new Criteria(CustomerPeer::DATABASE_NAME); if ($this->isColumnModified(CustomerPeer::ID)) $criteria->add(CustomerPeer::ID, $this->id); if ($this->isColumnModified(CustomerPeer::NAME)) $criteria->add(CustomerPeer::NAME, $this->name); if (...
[ "public", "function", "buildCriteria", "(", ")", "{", "$", "criteria", "=", "new", "Criteria", "(", "CustomerPeer", "::", "DATABASE_NAME", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "CustomerPeer", "::", "ID", ")", ")", "$", "criteria...
Build a Criteria object containing the values of all modified columns in this object. @return Criteria The Criteria object containing all modified values.
[ "Build", "a", "Criteria", "object", "containing", "the", "values", "of", "all", "modified", "columns", "in", "this", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1413-L1432
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.copyInto
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setName($this->getName()); $copyObj->setStreet($this->getStreet()); $copyObj->setZip($this->getZip()); $copyObj->setCity($this->getCity()); $copyObj->setCountryId($this->getCountryId()); ...
php
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setName($this->getName()); $copyObj->setStreet($this->getStreet()); $copyObj->setZip($this->getZip()); $copyObj->setCity($this->getCity()); $copyObj->setCountryId($this->getCountryId()); ...
[ "public", "function", "copyInto", "(", "$", "copyObj", ",", "$", "deepCopy", "=", "false", ",", "$", "makeNew", "=", "true", ")", "{", "$", "copyObj", "->", "setName", "(", "$", "this", "->", "getName", "(", ")", ")", ";", "$", "copyObj", "->", "se...
Sets contents of passed object to values from current object. If desired, this method can also make copies of all associated (fkey referrers) objects. @param object $copyObj An object of Customer (or compatible) type. @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. @par...
[ "Sets", "contents", "of", "passed", "object", "to", "values", "from", "current", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1491-L1533
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.setCountry
public function setCountry(Country $v = null) { if ($v === null) { $this->setCountryId(NULL); } else { $this->setCountryId($v->getId()); } $this->aCountry = $v; // Add binding for other direction of this n:n relationship. // If this object ha...
php
public function setCountry(Country $v = null) { if ($v === null) { $this->setCountryId(NULL); } else { $this->setCountryId($v->getId()); } $this->aCountry = $v; // Add binding for other direction of this n:n relationship. // If this object ha...
[ "public", "function", "setCountry", "(", "Country", "$", "v", "=", "null", ")", "{", "if", "(", "$", "v", "===", "null", ")", "{", "$", "this", "->", "setCountryId", "(", "NULL", ")", ";", "}", "else", "{", "$", "this", "->", "setCountryId", "(", ...
Declares an association between this object and a Country object. @param Country $v @return Customer The current object (for fluent API support) @throws PropelException
[ "Declares", "an", "association", "between", "this", "object", "and", "a", "Country", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1582-L1600
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.getCountry
public function getCountry(PropelPDO $con = null, $doQuery = true) { if ($this->aCountry === null && ($this->country_id !== null) && $doQuery) { $this->aCountry = CountryQuery::create()->findPk($this->country_id, $con); /* The following can be used additionally to gua...
php
public function getCountry(PropelPDO $con = null, $doQuery = true) { if ($this->aCountry === null && ($this->country_id !== null) && $doQuery) { $this->aCountry = CountryQuery::create()->findPk($this->country_id, $con); /* The following can be used additionally to gua...
[ "public", "function", "getCountry", "(", "PropelPDO", "$", "con", "=", "null", ",", "$", "doQuery", "=", "true", ")", "{", "if", "(", "$", "this", "->", "aCountry", "===", "null", "&&", "(", "$", "this", "->", "country_id", "!==", "null", ")", "&&", ...
Get the associated Country object @param PropelPDO $con Optional Connection object. @param $doQuery Executes a query to get the object if required @return Country The associated Country object. @throws PropelException
[ "Get", "the", "associated", "Country", "object" ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1611-L1625
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.initRemoteApps
public function initRemoteApps($overrideExisting = true) { if (null !== $this->collRemoteApps && !$overrideExisting) { return; } $this->collRemoteApps = new PropelObjectCollection(); $this->collRemoteApps->setModel('RemoteApp'); }
php
public function initRemoteApps($overrideExisting = true) { if (null !== $this->collRemoteApps && !$overrideExisting) { return; } $this->collRemoteApps = new PropelObjectCollection(); $this->collRemoteApps->setModel('RemoteApp'); }
[ "public", "function", "initRemoteApps", "(", "$", "overrideExisting", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "collRemoteApps", "&&", "!", "$", "overrideExisting", ")", "{", "return", ";", "}", "$", "this", "->", "collRemoteApps...
Initializes the collRemoteApps collection. By default this just sets the collRemoteApps collection to an empty array (like clearcollRemoteApps()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting the initial array to the values ...
[ "Initializes", "the", "collRemoteApps", "collection", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1685-L1692
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.getRemoteApps
public function getRemoteApps($criteria = null, PropelPDO $con = null) { $partial = $this->collRemoteAppsPartial && !$this->isNew(); if (null === $this->collRemoteApps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteApps) { // return ...
php
public function getRemoteApps($criteria = null, PropelPDO $con = null) { $partial = $this->collRemoteAppsPartial && !$this->isNew(); if (null === $this->collRemoteApps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteApps) { // return ...
[ "public", "function", "getRemoteApps", "(", "$", "criteria", "=", "null", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collRemoteAppsPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", ...
Gets an array of RemoteApp objects which contain a foreign key that references this object. If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the...
[ "Gets", "an", "array", "of", "RemoteApp", "objects", "which", "contain", "a", "foreign", "key", "that", "references", "this", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1708-L1751
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.setRemoteApps
public function setRemoteApps(PropelCollection $remoteApps, PropelPDO $con = null) { $remoteAppsToDelete = $this->getRemoteApps(new Criteria(), $con)->diff($remoteApps); $this->remoteAppsScheduledForDeletion = $remoteAppsToDelete; foreach ($remoteAppsToDelete as $remoteAppRemoved) { ...
php
public function setRemoteApps(PropelCollection $remoteApps, PropelPDO $con = null) { $remoteAppsToDelete = $this->getRemoteApps(new Criteria(), $con)->diff($remoteApps); $this->remoteAppsScheduledForDeletion = $remoteAppsToDelete; foreach ($remoteAppsToDelete as $remoteAppRemoved) { ...
[ "public", "function", "setRemoteApps", "(", "PropelCollection", "$", "remoteApps", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "remoteAppsToDelete", "=", "$", "this", "->", "getRemoteApps", "(", "new", "Criteria", "(", ")", ",", "$", "con", "...
Sets a collection of RemoteApp objects related by a one-to-many relationship to the current object. It will also schedule objects for deletion based on a diff between old objects (aka persisted) and new objects from the given Propel collection. @param PropelCollection $remoteApps A Propel collection. @param PropelPDO ...
[ "Sets", "a", "collection", "of", "RemoteApp", "objects", "related", "by", "a", "one", "-", "to", "-", "many", "relationship", "to", "the", "current", "object", ".", "It", "will", "also", "schedule", "objects", "for", "deletion", "based", "on", "a", "diff",...
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1763-L1783
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.countRemoteApps
public function countRemoteApps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collRemoteAppsPartial && !$this->isNew(); if (null === $this->collRemoteApps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteApps)...
php
public function countRemoteApps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collRemoteAppsPartial && !$this->isNew(); if (null === $this->collRemoteApps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteApps)...
[ "public", "function", "countRemoteApps", "(", "Criteria", "$", "criteria", "=", "null", ",", "$", "distinct", "=", "false", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collRemoteAppsPartial", "&&", "!", "...
Returns the number of related RemoteApp objects. @param Criteria $criteria @param boolean $distinct @param PropelPDO $con @return int Count of related RemoteApp objects. @throws PropelException
[ "Returns", "the", "number", "of", "related", "RemoteApp", "objects", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1794-L1816
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.addRemoteApp
public function addRemoteApp(RemoteApp $l) { if ($this->collRemoteApps === null) { $this->initRemoteApps(); $this->collRemoteAppsPartial = true; } if (!in_array($l, $this->collRemoteApps->getArrayCopy(), true)) { // only add it if the **same** object is not already a...
php
public function addRemoteApp(RemoteApp $l) { if ($this->collRemoteApps === null) { $this->initRemoteApps(); $this->collRemoteAppsPartial = true; } if (!in_array($l, $this->collRemoteApps->getArrayCopy(), true)) { // only add it if the **same** object is not already a...
[ "public", "function", "addRemoteApp", "(", "RemoteApp", "$", "l", ")", "{", "if", "(", "$", "this", "->", "collRemoteApps", "===", "null", ")", "{", "$", "this", "->", "initRemoteApps", "(", ")", ";", "$", "this", "->", "collRemoteAppsPartial", "=", "tru...
Method called to associate a RemoteApp object to this object through the RemoteApp foreign key attribute. @param RemoteApp $l RemoteApp @return Customer The current object (for fluent API support)
[ "Method", "called", "to", "associate", "a", "RemoteApp", "object", "to", "this", "object", "through", "the", "RemoteApp", "foreign", "key", "attribute", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1825-L1841
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.initUserCustomerRelations
public function initUserCustomerRelations($overrideExisting = true) { if (null !== $this->collUserCustomerRelations && !$overrideExisting) { return; } $this->collUserCustomerRelations = new PropelObjectCollection(); $this->collUserCustomerRelations->setModel('UserCustomer...
php
public function initUserCustomerRelations($overrideExisting = true) { if (null !== $this->collUserCustomerRelations && !$overrideExisting) { return; } $this->collUserCustomerRelations = new PropelObjectCollection(); $this->collUserCustomerRelations->setModel('UserCustomer...
[ "public", "function", "initUserCustomerRelations", "(", "$", "overrideExisting", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "collUserCustomerRelations", "&&", "!", "$", "overrideExisting", ")", "{", "return", ";", "}", "$", "this", "...
Initializes the collUserCustomerRelations collection. By default this just sets the collUserCustomerRelations collection to an empty array (like clearcollUserCustomerRelations()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting...
[ "Initializes", "the", "collUserCustomerRelations", "collection", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1910-L1917
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.setUserCustomerRelations
public function setUserCustomerRelations(PropelCollection $userCustomerRelations, PropelPDO $con = null) { $userCustomerRelationsToDelete = $this->getUserCustomerRelations(new Criteria(), $con)->diff($userCustomerRelations); $this->userCustomerRelationsScheduledForDeletion = $userCustomerRelations...
php
public function setUserCustomerRelations(PropelCollection $userCustomerRelations, PropelPDO $con = null) { $userCustomerRelationsToDelete = $this->getUserCustomerRelations(new Criteria(), $con)->diff($userCustomerRelations); $this->userCustomerRelationsScheduledForDeletion = $userCustomerRelations...
[ "public", "function", "setUserCustomerRelations", "(", "PropelCollection", "$", "userCustomerRelations", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "userCustomerRelationsToDelete", "=", "$", "this", "->", "getUserCustomerRelations", "(", "new", "Criteri...
Sets a collection of UserCustomerRelation objects related by a one-to-many relationship to the current object. It will also schedule objects for deletion based on a diff between old objects (aka persisted) and new objects from the given Propel collection. @param PropelCollection $userCustomerRelations A Propel collect...
[ "Sets", "a", "collection", "of", "UserCustomerRelation", "objects", "related", "by", "a", "one", "-", "to", "-", "many", "relationship", "to", "the", "current", "object", ".", "It", "will", "also", "schedule", "objects", "for", "deletion", "based", "on", "a"...
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1988-L2008
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.addUserCustomerRelation
public function addUserCustomerRelation(UserCustomerRelation $l) { if ($this->collUserCustomerRelations === null) { $this->initUserCustomerRelations(); $this->collUserCustomerRelationsPartial = true; } if (!in_array($l, $this->collUserCustomerRelations->getArrayCopy(...
php
public function addUserCustomerRelation(UserCustomerRelation $l) { if ($this->collUserCustomerRelations === null) { $this->initUserCustomerRelations(); $this->collUserCustomerRelationsPartial = true; } if (!in_array($l, $this->collUserCustomerRelations->getArrayCopy(...
[ "public", "function", "addUserCustomerRelation", "(", "UserCustomerRelation", "$", "l", ")", "{", "if", "(", "$", "this", "->", "collUserCustomerRelations", "===", "null", ")", "{", "$", "this", "->", "initUserCustomerRelations", "(", ")", ";", "$", "this", "-...
Method called to associate a UserCustomerRelation object to this object through the UserCustomerRelation foreign key attribute. @param UserCustomerRelation $l UserCustomerRelation @return Customer The current object (for fluent API support)
[ "Method", "called", "to", "associate", "a", "UserCustomerRelation", "object", "to", "this", "object", "through", "the", "UserCustomerRelation", "foreign", "key", "attribute", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L2050-L2066
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.clear
public function clear() { $this->id = null; $this->name = null; $this->street = null; $this->zip = null; $this->city = null; $this->country_id = null; $this->phone = null; $this->fax = null; $this->email = null; $this->legalform = null;...
php
public function clear() { $this->id = null; $this->name = null; $this->street = null; $this->zip = null; $this->city = null; $this->country_id = null; $this->phone = null; $this->fax = null; $this->email = null; $this->legalform = null;...
[ "public", "function", "clear", "(", ")", "{", "$", "this", "->", "id", "=", "null", ";", "$", "this", "->", "name", "=", "null", ";", "$", "this", "->", "street", "=", "null", ";", "$", "this", "->", "zip", "=", "null", ";", "$", "this", "->", ...
Clears the current object and sets all attributes to their default values
[ "Clears", "the", "current", "object", "and", "sets", "all", "attributes", "to", "their", "default", "values" ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L2124-L2146
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.clearAllReferences
public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->collRemoteApps) { foreach ($this->collRemoteApps as $o) { $o->clearAllReferences($...
php
public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->collRemoteApps) { foreach ($this->collRemoteApps as $o) { $o->clearAllReferences($...
[ "public", "function", "clearAllReferences", "(", "$", "deep", "=", "false", ")", "{", "if", "(", "$", "deep", "&&", "!", "$", "this", "->", "alreadyInClearAllReferencesDeep", ")", "{", "$", "this", "->", "alreadyInClearAllReferencesDeep", "=", "true", ";", "...
Resets all references to other model objects or collections of model objects. This method is a user-space workaround for PHP's inability to garbage collect objects with circular references (even in PHP 5.3). This is currently necessary when using Propel in certain daemon or large-volume/high-memory operations. @param...
[ "Resets", "all", "references", "to", "other", "model", "objects", "or", "collections", "of", "model", "objects", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L2157-L2187
comodojo/qotd
src/Qotd.php
Qotd.getQuote
public function getQuote() { if ( is_null($this->quotes) ) return $this->no_quotes_message; return $this->quotes[rand(1,sizeof($this->quotes)-1)]; }
php
public function getQuote() { if ( is_null($this->quotes) ) return $this->no_quotes_message; return $this->quotes[rand(1,sizeof($this->quotes)-1)]; }
[ "public", "function", "getQuote", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "quotes", ")", ")", "return", "$", "this", "->", "no_quotes_message", ";", "return", "$", "this", "->", "quotes", "[", "rand", "(", "1", ",", "sizeof", "("...
Get single quote @return string
[ "Get", "single", "quote" ]
train
https://github.com/comodojo/qotd/blob/7ef890491e8d3d5d7ba05116f4277708f788ad60/src/Qotd.php#L74-L80
comodojo/qotd
src/Qotd.php
Qotd.getQuotesAsStore
public function getQuotesAsStore() { if ( is_null($this->quotes) ) return array(array('id'=>0, 'quote'=>$this->no_quotes_message)); $return = array(); foreach($this->quotes as $id=>$quote) array_push($return, array('id'=>$id, 'quote'=>$quote)); return $return; }
php
public function getQuotesAsStore() { if ( is_null($this->quotes) ) return array(array('id'=>0, 'quote'=>$this->no_quotes_message)); $return = array(); foreach($this->quotes as $id=>$quote) array_push($return, array('id'=>$id, 'quote'=>$quote)); return $return; }
[ "public", "function", "getQuotesAsStore", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "quotes", ")", ")", "return", "array", "(", "array", "(", "'id'", "=>", "0", ",", "'quote'", "=>", "$", "this", "->", "no_quotes_message", ")", ")", ...
Get all quotes as a store @return array
[ "Get", "all", "quotes", "as", "a", "store" ]
train
https://github.com/comodojo/qotd/blob/7ef890491e8d3d5d7ba05116f4277708f788ad60/src/Qotd.php#L87-L97
anime-db/world-art-filler-bundle
src/Service/Search.php
Search.search
public function search(array $data) { $name = iconv('utf-8', 'cp1251', $data['name']); $url = str_replace('#NAME#', urlencode($name), self::SEARH_URL); $url = str_replace('#SECTOR#', (isset($data['type']) ? $data['type'] : self::DEFAULT_SECTOR), $url); // get list from xpath ...
php
public function search(array $data) { $name = iconv('utf-8', 'cp1251', $data['name']); $url = str_replace('#NAME#', urlencode($name), self::SEARH_URL); $url = str_replace('#SECTOR#', (isset($data['type']) ? $data['type'] : self::DEFAULT_SECTOR), $url); // get list from xpath ...
[ "public", "function", "search", "(", "array", "$", "data", ")", "{", "$", "name", "=", "iconv", "(", "'utf-8'", ",", "'cp1251'", ",", "$", "data", "[", "'name'", "]", ")", ";", "$", "url", "=", "str_replace", "(", "'#NAME#'", ",", "urlencode", "(", ...
Search source by name. Return structure <code> [ \AnimeDb\Bundle\CatalogBundle\Plugin\Fill\Search\Item ] </code> @param array $data @return array
[ "Search", "source", "by", "name", "." ]
train
https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Search.php#L119-L174
picamator/CacheManager
src/CacheManagerSubject.php
CacheManagerSubject.save
public function save(SearchCriteriaInterface $searchCriteria, array $data) : bool { // before save event $eventBeforeName = 'beforeSave'; if ($this->hasObserver($eventBeforeName)) { $eventBefore = $this->eventBuilder ->setName($eventBeforeName) ->s...
php
public function save(SearchCriteriaInterface $searchCriteria, array $data) : bool { // before save event $eventBeforeName = 'beforeSave'; if ($this->hasObserver($eventBeforeName)) { $eventBefore = $this->eventBuilder ->setName($eventBeforeName) ->s...
[ "public", "function", "save", "(", "SearchCriteriaInterface", "$", "searchCriteria", ",", "array", "$", "data", ")", ":", "bool", "{", "// before save event", "$", "eventBeforeName", "=", "'beforeSave'", ";", "if", "(", "$", "this", "->", "hasObserver", "(", "...
{@inheritdoc} Events: beforeSave, afterSave
[ "{", "@inheritdoc", "}" ]
train
https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/CacheManagerSubject.php#L52-L83
picamator/CacheManager
src/CacheManagerSubject.php
CacheManagerSubject.attach
public function attach(string $name, ObserverInterface $observer) { $observerList = $this->getObserverList($name); $observerList->attach($observer); }
php
public function attach(string $name, ObserverInterface $observer) { $observerList = $this->getObserverList($name); $observerList->attach($observer); }
[ "public", "function", "attach", "(", "string", "$", "name", ",", "ObserverInterface", "$", "observer", ")", "{", "$", "observerList", "=", "$", "this", "->", "getObserverList", "(", "$", "name", ")", ";", "$", "observerList", "->", "attach", "(", "$", "o...
{@inheritdoc}
[ "{" ]
train
https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/CacheManagerSubject.php#L160-L164
picamator/CacheManager
src/CacheManagerSubject.php
CacheManagerSubject.detach
public function detach(string $name, ObserverInterface $observer) { $observerList = $this->getObserverList($name); $observerList->detach($observer); }
php
public function detach(string $name, ObserverInterface $observer) { $observerList = $this->getObserverList($name); $observerList->detach($observer); }
[ "public", "function", "detach", "(", "string", "$", "name", ",", "ObserverInterface", "$", "observer", ")", "{", "$", "observerList", "=", "$", "this", "->", "getObserverList", "(", "$", "name", ")", ";", "$", "observerList", "->", "detach", "(", "$", "o...
{@inheritdoc}
[ "{" ]
train
https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/CacheManagerSubject.php#L169-L173
picamator/CacheManager
src/CacheManagerSubject.php
CacheManagerSubject.notify
public function notify(EventInterface $event) { $observerList = $this->getObserverList($event->getName()); /** @var \Picamator\CacheManager\Spi\ObserverInterface $item */ foreach ($observerList as $item) { $item->update($this, $event); } }
php
public function notify(EventInterface $event) { $observerList = $this->getObserverList($event->getName()); /** @var \Picamator\CacheManager\Spi\ObserverInterface $item */ foreach ($observerList as $item) { $item->update($this, $event); } }
[ "public", "function", "notify", "(", "EventInterface", "$", "event", ")", "{", "$", "observerList", "=", "$", "this", "->", "getObserverList", "(", "$", "event", "->", "getName", "(", ")", ")", ";", "/** @var \\Picamator\\CacheManager\\Spi\\ObserverInterface $item *...
{@inheritdoc}
[ "{" ]
train
https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/CacheManagerSubject.php#L178-L185
picamator/CacheManager
src/CacheManagerSubject.php
CacheManagerSubject.getObserverList
private function getObserverList(string $name) : \SplObjectStorage { if (empty($this->observerContainer[$name])) { $this->observerContainer[$name] = new \SplObjectStorage(); } return $this->observerContainer[$name]; }
php
private function getObserverList(string $name) : \SplObjectStorage { if (empty($this->observerContainer[$name])) { $this->observerContainer[$name] = new \SplObjectStorage(); } return $this->observerContainer[$name]; }
[ "private", "function", "getObserverList", "(", "string", "$", "name", ")", ":", "\\", "SplObjectStorage", "{", "if", "(", "empty", "(", "$", "this", "->", "observerContainer", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "observerContainer", ...
Retrieve observer list. @param string $name @return \SplObjectStorage
[ "Retrieve", "observer", "list", "." ]
train
https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/CacheManagerSubject.php#L194-L201
picamator/CacheManager
src/CacheManagerSubject.php
CacheManagerSubject.hasObserver
private function hasObserver(string $name) : bool { return !empty($this->observerContainer[$name]) && $this->observerContainer[$name]->count(); }
php
private function hasObserver(string $name) : bool { return !empty($this->observerContainer[$name]) && $this->observerContainer[$name]->count(); }
[ "private", "function", "hasObserver", "(", "string", "$", "name", ")", ":", "bool", "{", "return", "!", "empty", "(", "$", "this", "->", "observerContainer", "[", "$", "name", "]", ")", "&&", "$", "this", "->", "observerContainer", "[", "$", "name", "]...
Check whatever observer container has at least one observer. @param string $name @return bool _true_ observer container has at least one observer, _false_ otherwise
[ "Check", "whatever", "observer", "container", "has", "at", "least", "one", "observer", "." ]
train
https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/CacheManagerSubject.php#L210-L213
joseph-walker/vector
src/Lib/Math.php
Math.__sum
protected static function __sum($a) { return array_reduce($a, function ($carry, $item) use ($a) { $carry += $item; return $carry; }, 0); }
php
protected static function __sum($a) { return array_reduce($a, function ($carry, $item) use ($a) { $carry += $item; return $carry; }, 0); }
[ "protected", "static", "function", "__sum", "(", "$", "a", ")", "{", "return", "array_reduce", "(", "$", "a", ",", "function", "(", "$", "carry", ",", "$", "item", ")", "use", "(", "$", "a", ")", "{", "$", "carry", "+=", "$", "item", ";", "return...
Array Sum Add all the numbers of a list together and return their sum. If the given list is empty, returns 0. @example Math::sum([1, 2, 3]); // 6 @example Math::sum([]); // 0 @type Number a => [a] -> a @param array $a List of numbers to add @return number Sum of all the elements of the list
[ "Array", "Sum" ]
train
https://github.com/joseph-walker/vector/blob/e349aa2e9e0535b1993f9fffc0476e7fd8e113fc/src/Lib/Math.php#L63-L69
joseph-walker/vector
src/Lib/Math.php
Math.__product
protected static function __product($a) { return empty($a) ? 0 : array_reduce($a, function ($carry, $item) use ($a) { $carry *= $item; return $carry; }, 1); }
php
protected static function __product($a) { return empty($a) ? 0 : array_reduce($a, function ($carry, $item) use ($a) { $carry *= $item; return $carry; }, 1); }
[ "protected", "static", "function", "__product", "(", "$", "a", ")", "{", "return", "empty", "(", "$", "a", ")", "?", "0", ":", "array_reduce", "(", "$", "a", ",", "function", "(", "$", "carry", ",", "$", "item", ")", "use", "(", "$", "a", ")", ...
Array Product Returns the product of a list of numbers, i.e. the result of multiplying every element of a list together. Returns 1 for an empty list. @example Math::product([2, 2, 3]); // 12 @example Math::product([]); // 1 @type Number a => [a] -> a @param array $a List of values to multiply @return mixed Pro...
[ "Array", "Product" ]
train
https://github.com/joseph-walker/vector/blob/e349aa2e9e0535b1993f9fffc0476e7fd8e113fc/src/Lib/Math.php#L153-L161
joseph-walker/vector
src/Lib/Math.php
Math.__range
protected static function __range($step, $first, $last) { return ($step + $first >= $last) ? [$first] : range($first, $last, $step); }
php
protected static function __range($step, $first, $last) { return ($step + $first >= $last) ? [$first] : range($first, $last, $step); }
[ "protected", "static", "function", "__range", "(", "$", "step", ",", "$", "first", ",", "$", "last", ")", "{", "return", "(", "$", "step", "+", "$", "first", ">=", "$", "last", ")", "?", "[", "$", "first", "]", ":", "range", "(", "$", "first", ...
Number Range Given two values m and n, return all values between m and n in an array, inclusive, with a step size of $step. The list of numbers will start at the first value and approach the second value. @example Math::range(1, 1, 5); // [1, 2, 3, 4, 5] @example Math::range(2, 0, -3); // [0, -2] @example Math::ran...
[ "Number", "Range" ]
train
https://github.com/joseph-walker/vector/blob/e349aa2e9e0535b1993f9fffc0476e7fd8e113fc/src/Lib/Math.php#L236-L241
CakeCMS/Core
src/Toolbar/ToolbarItemAction.php
ToolbarItemAction.fetchItem
public function fetchItem() { list ($source, $title, $action, $options) = func_get_args(); return $this->_view->Form->button($title, Hash::merge([ 'icon' => 'trash', 'data-action' => $action, 'button' => 'red lighten-2', 'class' => '...
php
public function fetchItem() { list ($source, $title, $action, $options) = func_get_args(); return $this->_view->Form->button($title, Hash::merge([ 'icon' => 'trash', 'data-action' => $action, 'button' => 'red lighten-2', 'class' => '...
[ "public", "function", "fetchItem", "(", ")", "{", "list", "(", "$", "source", ",", "$", "title", ",", "$", "action", ",", "$", "options", ")", "=", "func_get_args", "(", ")", ";", "return", "$", "this", "->", "_view", "->", "Form", "->", "button", ...
Fetch button id. @return string @SuppressWarnings("unused")
[ "Fetch", "button", "id", "." ]
train
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Toolbar/ToolbarItemAction.php#L34-L44
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.avg
public function avg($callback = null): ?float { $sum = 0; $count = 0; foreach ($this->generator as $key => $item) { if ($callback) { $item = $this->accessKey($item, $callback, $key); } $sum += $item; $count++; } ...
php
public function avg($callback = null): ?float { $sum = 0; $count = 0; foreach ($this->generator as $key => $item) { if ($callback) { $item = $this->accessKey($item, $callback, $key); } $sum += $item; $count++; } ...
[ "public", "function", "avg", "(", "$", "callback", "=", "null", ")", ":", "?", "float", "{", "$", "sum", "=", "0", ";", "$", "count", "=", "0", ";", "foreach", "(", "$", "this", "->", "generator", "as", "$", "key", "=>", "$", "item", ")", "{", ...
Get the average value of a given key. @param callable|string|null $callback @return mixed @throws \InvalidArgumentException
[ "Get", "the", "average", "value", "of", "a", "given", "key", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L69-L88
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.median
public function median($key = null): ?float { $count = 0; $set = []; foreach ($this->generator as $givenKey => $item) { if ($key) { $item = $this->accessKey($item, $key, $givenKey); } $set[] = $item; $count++; } ...
php
public function median($key = null): ?float { $count = 0; $set = []; foreach ($this->generator as $givenKey => $item) { if ($key) { $item = $this->accessKey($item, $key, $givenKey); } $set[] = $item; $count++; } ...
[ "public", "function", "median", "(", "$", "key", "=", "null", ")", ":", "?", "float", "{", "$", "count", "=", "0", ";", "$", "set", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "generator", "as", "$", "givenKey", "=>", "$", "item", ")...
Get the median of a given key. Warning: This loads the full dataset into memory @param null $key @return mixed @throws \InvalidArgumentException
[ "Get", "the", "median", "of", "a", "given", "key", ".", "Warning", ":", "This", "loads", "the", "full", "dataset", "into", "memory" ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L110-L139
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.mode
public function mode($key = null): ?array { /** @var array $result */ $result = $this->reduce(function ($carry, $value, $valueKey) use ($key) { $item = $value; if ($key) { $item = $this->accessKey($value, $key, $valueKey); } if (!isse...
php
public function mode($key = null): ?array { /** @var array $result */ $result = $this->reduce(function ($carry, $value, $valueKey) use ($key) { $item = $value; if ($key) { $item = $this->accessKey($value, $key, $valueKey); } if (!isse...
[ "public", "function", "mode", "(", "$", "key", "=", "null", ")", ":", "?", "array", "{", "/** @var array $result */", "$", "result", "=", "$", "this", "->", "reduce", "(", "function", "(", "$", "carry", ",", "$", "value", ",", "$", "valueKey", ")", "...
Get the mode of a given key. @param mixed $key @return array|null @throws \InvalidArgumentException
[ "Get", "the", "mode", "of", "a", "given", "key", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L148-L188
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.each
public function each(callable $callback): CollectionInterface { return $this->wrap(function (Iterator $data) use ($callback) { $closed = false; foreach ($data as $key => $value) { if ($callback($value, $key) === false) { $closed = true; ...
php
public function each(callable $callback): CollectionInterface { return $this->wrap(function (Iterator $data) use ($callback) { $closed = false; foreach ($data as $key => $value) { if ($callback($value, $key) === false) { $closed = true; ...
[ "public", "function", "each", "(", "callable", "$", "callback", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "callback", ")", "{", "$", "closed", "=", "f...
Execute a callback over each item. @param callable $callback @return CollectionInterface
[ "Execute", "a", "callback", "over", "each", "item", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L206-L222
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.except
public function except($keys): CollectionInterface { if (!is_callable($keys)) { if (!is_array($keys)) { $keys = func_get_args(); } $keys = function ($item, $key) use ($keys) { return in_array($key, $keys, false); }; } ...
php
public function except($keys): CollectionInterface { if (!is_callable($keys)) { if (!is_array($keys)) { $keys = func_get_args(); } $keys = function ($item, $key) use ($keys) { return in_array($key, $keys, false); }; } ...
[ "public", "function", "except", "(", "$", "keys", ")", ":", "CollectionInterface", "{", "if", "(", "!", "is_callable", "(", "$", "keys", ")", ")", "{", "if", "(", "!", "is_array", "(", "$", "keys", ")", ")", "{", "$", "keys", "=", "func_get_args", ...
Get all items except for those with the specified keys. @param mixed $keys @return CollectionInterface
[ "Get", "all", "items", "except", "for", "those", "with", "the", "specified", "keys", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L241-L259
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.filter
public function filter(callable $callback = null): CollectionInterface { if (!$callback) { $callback = function ($item) { return (bool)$item; }; } return $this->wrap(function (Iterator $data) use ($callback) { foreach ($data as $key => $it...
php
public function filter(callable $callback = null): CollectionInterface { if (!$callback) { $callback = function ($item) { return (bool)$item; }; } return $this->wrap(function (Iterator $data) use ($callback) { foreach ($data as $key => $it...
[ "public", "function", "filter", "(", "callable", "$", "callback", "=", "null", ")", ":", "CollectionInterface", "{", "if", "(", "!", "$", "callback", ")", "{", "$", "callback", "=", "function", "(", "$", "item", ")", "{", "return", "(", "bool", ")", ...
Run a filter over each of the items. @param callable|null $callback @return CollectionInterface
[ "Run", "a", "filter", "over", "each", "of", "the", "items", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L267-L282
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.when
public function when($value, callable $callback): CollectionInterface { if ($value) { $this->generator = $callback($this)->generator; } return $this; }
php
public function when($value, callable $callback): CollectionInterface { if ($value) { $this->generator = $callback($this)->generator; } return $this; }
[ "public", "function", "when", "(", "$", "value", ",", "callable", "$", "callback", ")", ":", "CollectionInterface", "{", "if", "(", "$", "value", ")", "{", "$", "this", "->", "generator", "=", "$", "callback", "(", "$", "this", ")", "->", "generator", ...
Apply the callback if the value is truthy. @param bool $value @param callable $callback @return mixed
[ "Apply", "the", "callback", "if", "the", "value", "is", "truthy", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L291-L298
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.where
public function where(array $criteria, $strict = false): CollectionInterface { return array_reduce( array_keys($criteria), function (GeneratorCollection $collection, $key) use ($criteria, $strict) { return $collection->filter(function ($item) use ($key, $criteria, $st...
php
public function where(array $criteria, $strict = false): CollectionInterface { return array_reduce( array_keys($criteria), function (GeneratorCollection $collection, $key) use ($criteria, $strict) { return $collection->filter(function ($item) use ($key, $criteria, $st...
[ "public", "function", "where", "(", "array", "$", "criteria", ",", "$", "strict", "=", "false", ")", ":", "CollectionInterface", "{", "return", "array_reduce", "(", "array_keys", "(", "$", "criteria", ")", ",", "function", "(", "GeneratorCollection", "$", "c...
Filter items by the given key value pair. @param array $criteria Returns items that match all criteria @param bool $strict @return CollectionInterface
[ "Filter", "items", "by", "the", "given", "key", "value", "pair", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L307-L322
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.whereIn
public function whereIn($key, $values, $strict = false): CollectionInterface { return $this->wrap(function (Iterator $data) use ($key, $values, $strict) { foreach ($data as $itemKey => $item) { if (in_array($item[$key], $values, $strict)) { yield $itemKey => $...
php
public function whereIn($key, $values, $strict = false): CollectionInterface { return $this->wrap(function (Iterator $data) use ($key, $values, $strict) { foreach ($data as $itemKey => $item) { if (in_array($item[$key], $values, $strict)) { yield $itemKey => $...
[ "public", "function", "whereIn", "(", "$", "key", ",", "$", "values", ",", "$", "strict", "=", "false", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "k...
Filter items by the given key value pair. @param string $key @param mixed $values @param bool $strict @return CollectionInterface
[ "Filter", "items", "by", "the", "given", "key", "value", "pair", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L332-L341
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.first
public function first(callable $callback = null, $default = null) { foreach ($this->generator as $item) { if (!$callback || $callback($item)) { return $item; } } return $default; }
php
public function first(callable $callback = null, $default = null) { foreach ($this->generator as $item) { if (!$callback || $callback($item)) { return $item; } } return $default; }
[ "public", "function", "first", "(", "callable", "$", "callback", "=", "null", ",", "$", "default", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "generator", "as", "$", "item", ")", "{", "if", "(", "!", "$", "callback", "||", "$", "call...
Get the first item from the collection. @param callable|null $callback @param mixed $default @return mixed
[ "Get", "the", "first", "item", "from", "the", "collection", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L350-L359
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.flatten
public function flatten($depth = INF): CollectionInterface { return $this->wrap(function (Iterator $data) use ($depth) { $lowerDepth = $depth === INF ? INF : $depth - 1; foreach ($data as $key => $datum) { if ($lowerDepth >= 0 && is_iterable($datum)) { ...
php
public function flatten($depth = INF): CollectionInterface { return $this->wrap(function (Iterator $data) use ($depth) { $lowerDepth = $depth === INF ? INF : $depth - 1; foreach ($data as $key => $datum) { if ($lowerDepth >= 0 && is_iterable($datum)) { ...
[ "public", "function", "flatten", "(", "$", "depth", "=", "INF", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "depth", ")", "{", "$", "lowerDepth", "=", ...
Get a flattened array of the items in the collection. @param int $depth @return CollectionInterface
[ "Get", "a", "flattened", "array", "of", "the", "items", "in", "the", "collection", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L367-L383
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.flatMap
public function flatMap(callable $callback, $depth = INF): CollectionInterface { return $this->map($callback)->flatten($depth); }
php
public function flatMap(callable $callback, $depth = INF): CollectionInterface { return $this->map($callback)->flatten($depth); }
[ "public", "function", "flatMap", "(", "callable", "$", "callback", ",", "$", "depth", "=", "INF", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "map", "(", "$", "callback", ")", "->", "flatten", "(", "$", "depth", ")", ";", "}" ]
Map then flatten @param callable $callback @param $depth @return \Buttress\Collection\CollectionInterface
[ "Map", "then", "flatten" ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L391-L394
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.flip
public function flip(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $key => $item) { yield $item => $key; } }); }
php
public function flip(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $key => $item) { yield $item => $key; } }); }
[ "public", "function", "flip", "(", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "item", ")", "{", "yield"...
Flip the items in the collection. @return CollectionInterface
[ "Flip", "the", "items", "in", "the", "collection", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L401-L408
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.forget
public function forget($keys): CollectionInterface { return $this->wrap(function (Iterator $data) use ($keys) { foreach ($data as $key => $item) { if (is_array($keys)) { if (in_array($key, $keys, false)) { continue; ...
php
public function forget($keys): CollectionInterface { return $this->wrap(function (Iterator $data) use ($keys) { foreach ($data as $key => $item) { if (is_array($keys)) { if (in_array($key, $keys, false)) { continue; ...
[ "public", "function", "forget", "(", "$", "keys", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "keys", ")", "{", "foreach", "(", "$", "data", "as", "$"...
Remove an item from the collection by key. @param string|array $keys @return CollectionInterface
[ "Remove", "an", "item", "from", "the", "collection", "by", "key", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L416-L431
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.groupBy
public function groupBy($groupBy, $preserveKeys = false, $batch = INF): CollectionInterface { return $this->wrap(function (Iterator $data) use ($preserveKeys, $batch, $groupBy) { $count = 0; $groups = []; foreach ($data as $key => $datum) { $count++; ...
php
public function groupBy($groupBy, $preserveKeys = false, $batch = INF): CollectionInterface { return $this->wrap(function (Iterator $data) use ($preserveKeys, $batch, $groupBy) { $count = 0; $groups = []; foreach ($data as $key => $datum) { $count++; ...
[ "public", "function", "groupBy", "(", "$", "groupBy", ",", "$", "preserveKeys", "=", "false", ",", "$", "batch", "=", "INF", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", ...
Group an associative array by a field or using a callback. Warning: This may require loading the entire data set into memory To reduce memory usage, provide a limited batch size @param callable|string $groupBy @param bool $preserveKeys @param int $batch The size of the batch @return \Buttress\Collection\CollectionInte...
[ "Group", "an", "associative", "array", "by", "a", "field", "or", "using", "a", "callback", ".", "Warning", ":", "This", "may", "require", "loading", "the", "entire", "data", "set", "into", "memory", "To", "reduce", "memory", "usage", "provide", "a", "limit...
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L444-L491
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.keyBy
public function keyBy($keyBy): CollectionInterface { return $this->wrap(function (Iterator $data) use ($keyBy) { foreach ($data as $key => $value) { yield $this->accessKey($value, $keyBy, $key) => $value; } }); }
php
public function keyBy($keyBy): CollectionInterface { return $this->wrap(function (Iterator $data) use ($keyBy) { foreach ($data as $key => $value) { yield $this->accessKey($value, $keyBy, $key) => $value; } }); }
[ "public", "function", "keyBy", "(", "$", "keyBy", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "keyBy", ")", "{", "foreach", "(", "$", "data", "as", "$...
Key an associative array by a field or using a callback. @param callable|string $keyBy @return CollectionInterface @throws \InvalidArgumentException
[ "Key", "an", "associative", "array", "by", "a", "field", "or", "using", "a", "callback", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L500-L507
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.implode
public function implode($value, $glue = null): string { return $this->reduce(function ($carry, $item) use ($value, $glue) { $currentGlue = $glue; if (is_string($item) && $currentGlue === null) { $currentGlue = $value; } if ($carry) { ...
php
public function implode($value, $glue = null): string { return $this->reduce(function ($carry, $item) use ($value, $glue) { $currentGlue = $glue; if (is_string($item) && $currentGlue === null) { $currentGlue = $value; } if ($carry) { ...
[ "public", "function", "implode", "(", "$", "value", ",", "$", "glue", "=", "null", ")", ":", "string", "{", "return", "$", "this", "->", "reduce", "(", "function", "(", "$", "carry", ",", "$", "item", ")", "use", "(", "$", "value", ",", "$", "glu...
Concatenate values of a given key as a string. @param string $value @param string $glue @return string
[ "Concatenate", "values", "of", "a", "given", "key", "as", "a", "string", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L516-L533
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.keys
public function keys(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $key => $value) { yield $key; } }); }
php
public function keys(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $key => $value) { yield $key; } }); }
[ "public", "function", "keys", "(", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "yield...
Get the keys of the collection items. @return CollectionInterface
[ "Get", "the", "keys", "of", "the", "collection", "items", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L540-L547
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.last
public function last(callable $callback = null, $default = null) { $collection = $callback ? $this->filter($callback) : $this; foreach ($collection->all() as $key => $value) { // Nothing needed here } return isset($value) ? $value : $default; }
php
public function last(callable $callback = null, $default = null) { $collection = $callback ? $this->filter($callback) : $this; foreach ($collection->all() as $key => $value) { // Nothing needed here } return isset($value) ? $value : $default; }
[ "public", "function", "last", "(", "callable", "$", "callback", "=", "null", ",", "$", "default", "=", "null", ")", "{", "$", "collection", "=", "$", "callback", "?", "$", "this", "->", "filter", "(", "$", "callback", ")", ":", "$", "this", ";", "f...
Return the last element @param callable|null $callback if a callback is provided, we will filter the collection using that callback @param mixed $defualt @return mixed
[ "Return", "the", "last", "element" ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L556-L565
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.pluck
public function pluck($value, $key = null): CollectionInterface { return $this->wrap(function (Iterator $data) use ($value, $key) { foreach ($data as $dataKey => $datum) { if ($key) { yield $this->accessKey($datum, $key) => $this->accessKey($datum, $value); ...
php
public function pluck($value, $key = null): CollectionInterface { return $this->wrap(function (Iterator $data) use ($value, $key) { foreach ($data as $dataKey => $datum) { if ($key) { yield $this->accessKey($datum, $key) => $this->accessKey($datum, $value); ...
[ "public", "function", "pluck", "(", "$", "value", ",", "$", "key", "=", "null", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "value", ",", "$", "key", ...
Get the values of a given key. @param string $value @param null $key @return CollectionInterface @throws \InvalidArgumentException
[ "Get", "the", "values", "of", "a", "given", "key", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L575-L586
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.accessKey
private function accessKey($mixed, $key, $givenKey = null) { // Handle callable keys, just pass in the mixed and return the result. if (is_callable($key)) { return $key($mixed, $givenKey); } // If it's a string, an array, or accessible through [] if (is_string($m...
php
private function accessKey($mixed, $key, $givenKey = null) { // Handle callable keys, just pass in the mixed and return the result. if (is_callable($key)) { return $key($mixed, $givenKey); } // If it's a string, an array, or accessible through [] if (is_string($m...
[ "private", "function", "accessKey", "(", "$", "mixed", ",", "$", "key", ",", "$", "givenKey", "=", "null", ")", "{", "// Handle callable keys, just pass in the mixed and return the result.", "if", "(", "is_callable", "(", "$", "key", ")", ")", "{", "return", "$"...
Get a value from a mixed key @param mixed $mixed @param mixed $key @param null|string $givenKey @return mixed @throws \InvalidArgumentException
[ "Get", "a", "value", "from", "a", "mixed", "key" ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L596-L615
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.map
public function map(callable $callback): CollectionInterface { return $this->wrap(function (Iterator $data) use ($callback) { foreach ($data as $key => $value) { yield $key => $callback($value, $key); } }); }
php
public function map(callable $callback): CollectionInterface { return $this->wrap(function (Iterator $data) use ($callback) { foreach ($data as $key => $value) { yield $key => $callback($value, $key); } }); }
[ "public", "function", "map", "(", "callable", "$", "callback", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "callback", ")", "{", "foreach", "(", "$", "d...
Run a map over each of the items. @param callable $callback @return CollectionInterface
[ "Run", "a", "map", "over", "each", "of", "the", "items", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L623-L630
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.mapWithKeys
public function mapWithKeys(callable $callback): CollectionInterface { return $this->wrap(function (Iterator $data) use ($callback) { foreach ($data as $key => $value) { /** @var iterable $result */ $result = $callback($value, $key); foreach ($res...
php
public function mapWithKeys(callable $callback): CollectionInterface { return $this->wrap(function (Iterator $data) use ($callback) { foreach ($data as $key => $value) { /** @var iterable $result */ $result = $callback($value, $key); foreach ($res...
[ "public", "function", "mapWithKeys", "(", "callable", "$", "callback", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "callback", ")", "{", "foreach", "(", "...
Run an associative map over each of the items. The callback should return an associative array with a single key/value pair. @param callable $callback @return CollectionInterface
[ "Run", "an", "associative", "map", "over", "each", "of", "the", "items", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L640-L652
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.max
public function max($callback = null) { return $this->reduce(function ($carry, $value, $key) use ($callback) { if ($callback === null) { $result = $value; } else { $result = $this->accessKey($value, $callback, $key); } if ($car...
php
public function max($callback = null) { return $this->reduce(function ($carry, $value, $key) use ($callback) { if ($callback === null) { $result = $value; } else { $result = $this->accessKey($value, $callback, $key); } if ($car...
[ "public", "function", "max", "(", "$", "callback", "=", "null", ")", "{", "return", "$", "this", "->", "reduce", "(", "function", "(", "$", "carry", ",", "$", "value", ",", "$", "key", ")", "use", "(", "$", "callback", ")", "{", "if", "(", "$", ...
Get the max value of a given key. @param callable|string|null $callback @return mixed @throws \InvalidArgumentException
[ "Get", "the", "max", "value", "of", "a", "given", "key", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L661-L676
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.merge
public function merge($items): CollectionInterface { return $this->wrap(function (Iterator $data) use ($items) { yield from $data; if (is_iterable($items)) { yield from $items; } elseif ($items) { yield $items; } }); ...
php
public function merge($items): CollectionInterface { return $this->wrap(function (Iterator $data) use ($items) { yield from $data; if (is_iterable($items)) { yield from $items; } elseif ($items) { yield $items; } }); ...
[ "public", "function", "merge", "(", "$", "items", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "items", ")", "{", "yield", "from", "$", "data", ";", "i...
Merge the collection with the given items. @param mixed $items @return CollectionInterface
[ "Merge", "the", "collection", "with", "the", "given", "items", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L684-L695
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.append
public function append($items, bool $preserveKeys = true): CollectionInterface { return $this->wrap(function (Iterator $data) use ($items, $preserveKeys) { $lists = [$data, self::make($items)]; foreach ($lists as $list) { foreach ($list as $key => $item) { ...
php
public function append($items, bool $preserveKeys = true): CollectionInterface { return $this->wrap(function (Iterator $data) use ($items, $preserveKeys) { $lists = [$data, self::make($items)]; foreach ($lists as $list) { foreach ($list as $key => $item) { ...
[ "public", "function", "append", "(", "$", "items", ",", "bool", "$", "preserveKeys", "=", "true", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "items", "...
Append items onto this collection @param mixed $items @param bool $preserveKeys @return \Buttress\Collection\CollectionInterface
[ "Append", "items", "onto", "this", "collection" ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L704-L719
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.combine
public function combine($values): CollectionInterface { if ($values instanceof IteratorAggregate) { $values = $values->getIterator(); } elseif (is_array($values)) { $values = new ArrayIterator($values); } return $this->wrap(function (Iterator $keys) use ($val...
php
public function combine($values): CollectionInterface { if ($values instanceof IteratorAggregate) { $values = $values->getIterator(); } elseif (is_array($values)) { $values = new ArrayIterator($values); } return $this->wrap(function (Iterator $keys) use ($val...
[ "public", "function", "combine", "(", "$", "values", ")", ":", "CollectionInterface", "{", "if", "(", "$", "values", "instanceof", "IteratorAggregate", ")", "{", "$", "values", "=", "$", "values", "->", "getIterator", "(", ")", ";", "}", "elseif", "(", "...
Create a collection by using this collection for keys and another for its values. @param mixed $values @return CollectionInterface
[ "Create", "a", "collection", "by", "using", "this", "collection", "for", "keys", "and", "another", "for", "its", "values", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L727-L741
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.nth
public function nth($step, $offset = 0): CollectionInterface { return $this->wrap(function (Iterator $data) use ($step, $offset) { while ($offset && $data->valid()) { $data->next(); $offset--; } while ($data->valid()) { yie...
php
public function nth($step, $offset = 0): CollectionInterface { return $this->wrap(function (Iterator $data) use ($step, $offset) { while ($offset && $data->valid()) { $data->next(); $offset--; } while ($data->valid()) { yie...
[ "public", "function", "nth", "(", "$", "step", ",", "$", "offset", "=", "0", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "step", ",", "$", "offset", ...
Create a new collection consisting of every n-th element. @param int $step @param int $offset @return CollectionInterface
[ "Create", "a", "new", "collection", "consisting", "of", "every", "n", "-", "th", "element", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L780-L797
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.only
public function only($keys): CollectionInterface { $args = func_get_args(); if (count($args) === 1) { $args = reset($args); } if ($args === null) { return $this; } return $this->wrap(function (Iterator $data) use ($args) { foreach...
php
public function only($keys): CollectionInterface { $args = func_get_args(); if (count($args) === 1) { $args = reset($args); } if ($args === null) { return $this; } return $this->wrap(function (Iterator $data) use ($args) { foreach...
[ "public", "function", "only", "(", "$", "keys", ")", ":", "CollectionInterface", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "if", "(", "count", "(", "$", "args", ")", "===", "1", ")", "{", "$", "args", "=", "reset", "(", "$", "args", ...
Get the items with the specified keys. @param mixed $keys @return CollectionInterface
[ "Get", "the", "items", "with", "the", "specified", "keys", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L805-L823
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.forPage
public function forPage(int $page, int $perPage): CollectionInterface { $page--; $offset = $page * $perPage; return $this->slice($offset, $perPage); }
php
public function forPage(int $page, int $perPage): CollectionInterface { $page--; $offset = $page * $perPage; return $this->slice($offset, $perPage); }
[ "public", "function", "forPage", "(", "int", "$", "page", ",", "int", "$", "perPage", ")", ":", "CollectionInterface", "{", "$", "page", "--", ";", "$", "offset", "=", "$", "page", "*", "$", "perPage", ";", "return", "$", "this", "->", "slice", "(", ...
"Paginate" the collection by slicing it into a smaller collection. @param int $page @param int $perPage @return CollectionInterface @throws \InvalidArgumentException
[ "Paginate", "the", "collection", "by", "slicing", "it", "into", "a", "smaller", "collection", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L833-L839
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.partition
public function partition($callback): array { $partitions = [[], []]; foreach ($this->generator as $key => $item) { if ($this->accessKey($item, $callback, $key)) { $partitions[0][$key] = $item; } else { $partitions[1][$key] = $item; ...
php
public function partition($callback): array { $partitions = [[], []]; foreach ($this->generator as $key => $item) { if ($this->accessKey($item, $callback, $key)) { $partitions[0][$key] = $item; } else { $partitions[1][$key] = $item; ...
[ "public", "function", "partition", "(", "$", "callback", ")", ":", "array", "{", "$", "partitions", "=", "[", "[", "]", ",", "[", "]", "]", ";", "foreach", "(", "$", "this", "->", "generator", "as", "$", "key", "=>", "$", "item", ")", "{", "if", ...
Partition the collection into two arrays using the given callback or key. @param callable|string $callback @return array [ $partition1, $partition2 ] @throws \InvalidArgumentException
[ "Partition", "the", "collection", "into", "two", "arrays", "using", "the", "given", "callback", "or", "key", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L848-L862
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.prepend
public function prepend($value, $passedKey = null): CollectionInterface { return $this->wrap(function (Iterator $data) use ($value, $passedKey) { if ($passedKey) { yield $passedKey => $value; } else { yield $value; } foreach ($...
php
public function prepend($value, $passedKey = null): CollectionInterface { return $this->wrap(function (Iterator $data) use ($value, $passedKey) { if ($passedKey) { yield $passedKey => $value; } else { yield $value; } foreach ($...
[ "public", "function", "prepend", "(", "$", "value", ",", "$", "passedKey", "=", "null", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "value", ",", "$", ...
Push an item onto the beginning of the collection. @param mixed $value @param mixed $passedKey @return CollectionInterface
[ "Push", "an", "item", "onto", "the", "beginning", "of", "the", "collection", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L882-L899
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.push
public function push($value): CollectionInterface { return $this->wrap(function (Iterator $data) use ($value) { foreach ($data as $key => $item) { yield $key => $item; } yield $value; }); }
php
public function push($value): CollectionInterface { return $this->wrap(function (Iterator $data) use ($value) { foreach ($data as $key => $item) { yield $key => $item; } yield $value; }); }
[ "public", "function", "push", "(", "$", "value", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "value", ")", "{", "foreach", "(", "$", "data", "as", "$"...
Push an item onto the end of the collection. @param mixed $value @return CollectionInterface
[ "Push", "an", "item", "onto", "the", "end", "of", "the", "collection", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L907-L916
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.put
public function put($key, $value): CollectionInterface { return $this->wrap(function (Iterator $data) use ($key, $value) { $replaced = false; foreach ($data as $dataKey => $datum) { if ($key === $dataKey) { yield $key => $value; ...
php
public function put($key, $value): CollectionInterface { return $this->wrap(function (Iterator $data) use ($key, $value) { $replaced = false; foreach ($data as $dataKey => $datum) { if ($key === $dataKey) { yield $key => $value; ...
[ "public", "function", "put", "(", "$", "key", ",", "$", "value", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "key", ",", "$", "value", ")", "{", "$"...
Put an item in the collection by key. @param mixed $key @param mixed $value @return CollectionInterface
[ "Put", "an", "item", "in", "the", "collection", "by", "key", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L925-L943
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.reduce
public function reduce(callable $callback, $initial = null) { foreach ($this->generator as $key => $value) { $initial = $callback($initial, $value, $key); } return $initial; }
php
public function reduce(callable $callback, $initial = null) { foreach ($this->generator as $key => $value) { $initial = $callback($initial, $value, $key); } return $initial; }
[ "public", "function", "reduce", "(", "callable", "$", "callback", ",", "$", "initial", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "generator", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "initial", "=", "$", "callback", "(", ...
Reduce the collection to a single value. @param callable $callback @param mixed $initial @return mixed
[ "Reduce", "the", "collection", "to", "a", "single", "value", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L952-L959
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.reject
public function reject($callback): CollectionInterface { return $this->filter(function ($item, $key) use ($callback) { if (is_callable($callback)) { return !$callback($item, $key); } if (null === $item || is_scalar($item)) { return $item !...
php
public function reject($callback): CollectionInterface { return $this->filter(function ($item, $key) use ($callback) { if (is_callable($callback)) { return !$callback($item, $key); } if (null === $item || is_scalar($item)) { return $item !...
[ "public", "function", "reject", "(", "$", "callback", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "item", ",", "$", "key", ")", "use", "(", "$", "callback", ")", "{", "if", "(", "is_callable",...
Create a collection of all elements that do not pass a given truth test. @param callable|mixed $callback @return CollectionInterface @throws \InvalidArgumentException
[ "Create", "a", "collection", "of", "all", "elements", "that", "do", "not", "pass", "a", "given", "truth", "test", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L968-L981
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.slice
public function slice($offset, $length = null): CollectionInterface { if ($length < 0) { throw new InvalidArgumentException('Negative slice lengths are not supported'); } $result = $this; if ($offset < 0) { $result = $this->take($offset); } elseif ($o...
php
public function slice($offset, $length = null): CollectionInterface { if ($length < 0) { throw new InvalidArgumentException('Negative slice lengths are not supported'); } $result = $this; if ($offset < 0) { $result = $this->take($offset); } elseif ($o...
[ "public", "function", "slice", "(", "$", "offset", ",", "$", "length", "=", "null", ")", ":", "CollectionInterface", "{", "if", "(", "$", "length", "<", "0", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Negative slice lengths are not supported'",...
Slice the underlying collection array. @param int $offset @param int $length @return CollectionInterface @throws \InvalidArgumentException
[ "Slice", "the", "underlying", "collection", "array", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L991-L1009
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.offset
private function offset($offset): CollectionInterface { return $this->wrap(function (Iterator $iterator) use ($offset) { while ($offset-- > 0 && $iterator->valid()) { $iterator->next(); } while ($iterator->valid()) { yield $iterator->key()...
php
private function offset($offset): CollectionInterface { return $this->wrap(function (Iterator $iterator) use ($offset) { while ($offset-- > 0 && $iterator->valid()) { $iterator->next(); } while ($iterator->valid()) { yield $iterator->key()...
[ "private", "function", "offset", "(", "$", "offset", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "iterator", ")", "use", "(", "$", "offset", ")", "{", "while", "(", "$", "offset", "-...
Get items past an offset @param $offset @return CollectionInterface
[ "Get", "items", "past", "an", "offset" ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1016-L1028
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.chunk
public function chunk($size): CollectionInterface { if (!($size > 0)) { return $this::make([]); } return $this->wrap(function (Iterator $data) use ($size) { $chunk = []; $count = 0; foreach ($data as $key => $item) { $chunk[$key...
php
public function chunk($size): CollectionInterface { if (!($size > 0)) { return $this::make([]); } return $this->wrap(function (Iterator $data) use ($size) { $chunk = []; $count = 0; foreach ($data as $key => $item) { $chunk[$key...
[ "public", "function", "chunk", "(", "$", "size", ")", ":", "CollectionInterface", "{", "if", "(", "!", "(", "$", "size", ">", "0", ")", ")", "{", "return", "$", "this", "::", "make", "(", "[", "]", ")", ";", "}", "return", "$", "this", "->", "w...
Chunk the underlying collection array. @param int $size @return CollectionInterface
[ "Chunk", "the", "underlying", "collection", "array", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1036-L1059
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.splice
public function splice($offset, $length = null, $replacement = []): CollectionInterface { if (!is_iterable($replacement)) { $replacement = [$replacement]; } return $this->wrap(function (Iterator $data) use ($offset, $length, $replacement) { // Handle offset ...
php
public function splice($offset, $length = null, $replacement = []): CollectionInterface { if (!is_iterable($replacement)) { $replacement = [$replacement]; } return $this->wrap(function (Iterator $data) use ($offset, $length, $replacement) { // Handle offset ...
[ "public", "function", "splice", "(", "$", "offset", ",", "$", "length", "=", "null", ",", "$", "replacement", "=", "[", "]", ")", ":", "CollectionInterface", "{", "if", "(", "!", "is_iterable", "(", "$", "replacement", ")", ")", "{", "$", "replacement"...
Splice a portion of the underlying collection array. @param int $offset @param int|null $length @param mixed $replacement @return CollectionInterface
[ "Splice", "a", "portion", "of", "the", "underlying", "collection", "array", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1069-L1105
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.sum
public function sum($callback = null): float { return $this->reduce(function ($carry, $value, $key) use ($callback) { $value = $callback === null ? $value : $this->accessKey($value, $callback, $key); return $carry + $value; }, 0); }
php
public function sum($callback = null): float { return $this->reduce(function ($carry, $value, $key) use ($callback) { $value = $callback === null ? $value : $this->accessKey($value, $callback, $key); return $carry + $value; }, 0); }
[ "public", "function", "sum", "(", "$", "callback", "=", "null", ")", ":", "float", "{", "return", "$", "this", "->", "reduce", "(", "function", "(", "$", "carry", ",", "$", "value", ",", "$", "key", ")", "use", "(", "$", "callback", ")", "{", "$"...
Get the sum of the given values. @param callable|string|null $callback @return float @throws \InvalidArgumentException
[ "Get", "the", "sum", "of", "the", "given", "values", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1114-L1120
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.take
public function take($limit): CollectionInterface { if ($limit >= 0) { return $this->takeFirst($limit); } else { return $this->takeLast(abs($limit)); } }
php
public function take($limit): CollectionInterface { if ($limit >= 0) { return $this->takeFirst($limit); } else { return $this->takeLast(abs($limit)); } }
[ "public", "function", "take", "(", "$", "limit", ")", ":", "CollectionInterface", "{", "if", "(", "$", "limit", ">=", "0", ")", "{", "return", "$", "this", "->", "takeFirst", "(", "$", "limit", ")", ";", "}", "else", "{", "return", "$", "this", "->...
Take the first or last {$limit} items. @param int $limit @return CollectionInterface
[ "Take", "the", "first", "or", "last", "{", "$limit", "}", "items", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1128-L1135
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.takeFirst
public function takeFirst(int $count) { return $this->wrap(function (Iterator $data) use ($count) { $first = true; while ($count-- && $data->valid()) { if (!$first) { $data->next(); } yield $data->key() => $data->c...
php
public function takeFirst(int $count) { return $this->wrap(function (Iterator $data) use ($count) { $first = true; while ($count-- && $data->valid()) { if (!$first) { $data->next(); } yield $data->key() => $data->c...
[ "public", "function", "takeFirst", "(", "int", "$", "count", ")", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "count", ")", "{", "$", "first", "=", "true", ";", "while", "(", "$", ...
Take items from the beginning of the collection @param int $count @return \Buttress\Collection\CollectionInterface
[ "Take", "items", "from", "the", "beginning", "of", "the", "collection" ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1143-L1157
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.takeLast
public function takeLast(int $count) { return $this->wrap(function (Iterator $data) use ($count) { // From the end of the collection $limit = max(0, $count); $chunk = []; foreach ($data as $key => $datum) { $chunk[] = [$key, $datum]; ...
php
public function takeLast(int $count) { return $this->wrap(function (Iterator $data) use ($count) { // From the end of the collection $limit = max(0, $count); $chunk = []; foreach ($data as $key => $datum) { $chunk[] = [$key, $datum]; ...
[ "public", "function", "takeLast", "(", "int", "$", "count", ")", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "count", ")", "{", "// From the end of the collection", "$", "limit", "=", "ma...
Take items from the end of the collection @param int $count @return \Buttress\Collection\CollectionInterface
[ "Take", "items", "from", "the", "end", "of", "the", "collection" ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1165-L1184
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.unique
public function unique($key = null, $strict = false): CollectionInterface { return $this->wrap(function (Iterator $data) use ($key, $strict) { $tracker = []; foreach ($data as $dataKey => $datum) { $compare = $datum; if ($key) { $c...
php
public function unique($key = null, $strict = false): CollectionInterface { return $this->wrap(function (Iterator $data) use ($key, $strict) { $tracker = []; foreach ($data as $dataKey => $datum) { $compare = $datum; if ($key) { $c...
[ "public", "function", "unique", "(", "$", "key", "=", "null", ",", "$", "strict", "=", "false", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "key", ","...
Return only unique items from the collection array. @param string|callable|null $key @param bool $strict @return CollectionInterface
[ "Return", "only", "unique", "items", "from", "the", "collection", "array", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1216-L1233
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.values
public function values(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $item) { yield $item; } }); }
php
public function values(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $item) { yield $item; } }); }
[ "public", "function", "values", "(", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "item", ")", "{", "yield", "$", "item", "...
Reset the keys on the underlying array. @return CollectionInterface
[ "Reset", "the", "keys", "on", "the", "underlying", "array", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1240-L1247
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.zip
public function zip($items): CollectionInterface { $items = array_map(function ($items) { if ($items instanceof IteratorAggregate) { return $items->getIterator(); } if (is_array($items)) { return new ArrayIterator($items); } ...
php
public function zip($items): CollectionInterface { $items = array_map(function ($items) { if ($items instanceof IteratorAggregate) { return $items->getIterator(); } if (is_array($items)) { return new ArrayIterator($items); } ...
[ "public", "function", "zip", "(", "$", "items", ")", ":", "CollectionInterface", "{", "$", "items", "=", "array_map", "(", "function", "(", "$", "items", ")", "{", "if", "(", "$", "items", "instanceof", "IteratorAggregate", ")", "{", "return", "$", "item...
Zip the collection together with one or more arrays. e.g. new Collection([1, 2, 3])->zip([4, 5, 6]); => [[1, 4], [2, 5], [3, 6]] @param mixed ...$items @return CollectionInterface
[ "Zip", "the", "collection", "together", "with", "one", "or", "more", "arrays", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1258-L1285
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.toArray
public function toArray(): array { $generator = function (Iterator $data) { foreach ($data as $key => $item) { if ($item instanceof JsonSerializable) { $item = $item->jsonSerialize(); } yield $key => $item; } ...
php
public function toArray(): array { $generator = function (Iterator $data) { foreach ($data as $key => $item) { if ($item instanceof JsonSerializable) { $item = $item->jsonSerialize(); } yield $key => $item; } ...
[ "public", "function", "toArray", "(", ")", ":", "array", "{", "$", "generator", "=", "function", "(", "Iterator", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "item", ")", "{", "if", "(", "$", "item", "instanceof...
Get the collection of items as a plain array. @return array
[ "Get", "the", "collection", "of", "items", "as", "a", "plain", "array", "." ]
train
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1292-L1304
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respond
public function respond(array $data = [], array $headers = []): JsonResponse { $meta = [ 'meta' => [ 'server_time' => time(), 'server_timezone' => date_default_timezone_get(), 'api_version' => 'v1', ], ]; return respons...
php
public function respond(array $data = [], array $headers = []): JsonResponse { $meta = [ 'meta' => [ 'server_time' => time(), 'server_timezone' => date_default_timezone_get(), 'api_version' => 'v1', ], ]; return respons...
[ "public", "function", "respond", "(", "array", "$", "data", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", ":", "JsonResponse", "{", "$", "meta", "=", "[", "'meta'", "=>", "[", "'server_time'", "=>", "time", "(", ")", ",", "'serve...
Return JSON encoded response. @param array $data @param array $headers @return \Illuminate\Http\JsonResponse
[ "Return", "JSON", "encoded", "response", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L53-L64
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondWithError
public function respondWithError($code = null, $message = null, array $data = []): JsonResponse { return $this->respond([ 'status' => [ 'type' => 'error', 'message' => $this->getDefaultMessage($code, $message), 'code' => $code, 'htt...
php
public function respondWithError($code = null, $message = null, array $data = []): JsonResponse { return $this->respond([ 'status' => [ 'type' => 'error', 'message' => $this->getDefaultMessage($code, $message), 'code' => $code, 'htt...
[ "public", "function", "respondWithError", "(", "$", "code", "=", "null", ",", "$", "message", "=", "null", ",", "array", "$", "data", "=", "[", "]", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "respond", "(", "[", "'status'", "=>", "[...
Return response with error. @param null $code @param null $message @param array $data @return JsonResponse
[ "Return", "response", "with", "error", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L75-L86
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondWithFailure
public function respondWithFailure($code = null, array $data = [], $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_BAD_REQUEST)->respond([ 'status' => [ 'type' => 'error', 'message' => $this->getDefaultMessage($code, $message)...
php
public function respondWithFailure($code = null, array $data = [], $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_BAD_REQUEST)->respond([ 'status' => [ 'type' => 'error', 'message' => $this->getDefaultMessage($code, $message)...
[ "public", "function", "respondWithFailure", "(", "$", "code", "=", "null", ",", "array", "$", "data", "=", "[", "]", ",", "$", "message", "=", "null", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "setStatusCode", "(", "IlluminateResponse", ...
Returns 400 / Bad request. @param null $code @param array $data @param null $message @return \Illuminate\Http\JsonResponse
[ "Returns", "400", "/", "Bad", "request", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L97-L108
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondUnauthorized
public function respondUnauthorized($message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_UNAUTHORIZED) ->respondWithError(ApiResponse::CODE_NOT_AUTHORIZED, $message); }
php
public function respondUnauthorized($message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_UNAUTHORIZED) ->respondWithError(ApiResponse::CODE_NOT_AUTHORIZED, $message); }
[ "public", "function", "respondUnauthorized", "(", "$", "message", "=", "null", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "setStatusCode", "(", "IlluminateResponse", "::", "HTTP_UNAUTHORIZED", ")", "->", "respondWithError", "(", "ApiResponse", "::...
Returns 401 / Unauthorized. @param string $message @return \Illuminate\Http\JsonResponse
[ "Returns", "401", "/", "Unauthorized", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L117-L121
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondForbidden
public function respondForbidden($message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_FORBIDDEN) ->respondWithError(ApiResponse::CODE_FORBIDDEN, $message); }
php
public function respondForbidden($message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_FORBIDDEN) ->respondWithError(ApiResponse::CODE_FORBIDDEN, $message); }
[ "public", "function", "respondForbidden", "(", "$", "message", "=", "null", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "setStatusCode", "(", "IlluminateResponse", "::", "HTTP_FORBIDDEN", ")", "->", "respondWithError", "(", "ApiResponse", "::", "...
Returns 403 / Forbidden. @param string $message @return \Illuminate\Http\JsonResponse
[ "Returns", "403", "/", "Forbidden", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L130-L134
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondNotFound
public function respondNotFound($code = ApiResponse::CODE_NOT_FOUND, $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_NOT_FOUND) ->respondWithError($code, $message); }
php
public function respondNotFound($code = ApiResponse::CODE_NOT_FOUND, $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_NOT_FOUND) ->respondWithError($code, $message); }
[ "public", "function", "respondNotFound", "(", "$", "code", "=", "ApiResponse", "::", "CODE_NOT_FOUND", ",", "$", "message", "=", "null", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "setStatusCode", "(", "IlluminateResponse", "::", "HTTP_NOT_FOUND...
Returns 404 / Resource not found response. @param int $code @param null $message @return \Illuminate\Http\JsonResponse
[ "Returns", "404", "/", "Resource", "not", "found", "response", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L144-L148
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondValidationError
public function respondValidationError( $code = ApiResponse::CODE_VALIDATION_ERROR, array $errors = [], $message = null ): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_UNPROCESSABLE_ENTITY) ->respond([ 'status' => [ ...
php
public function respondValidationError( $code = ApiResponse::CODE_VALIDATION_ERROR, array $errors = [], $message = null ): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_UNPROCESSABLE_ENTITY) ->respond([ 'status' => [ ...
[ "public", "function", "respondValidationError", "(", "$", "code", "=", "ApiResponse", "::", "CODE_VALIDATION_ERROR", ",", "array", "$", "errors", "=", "[", "]", ",", "$", "message", "=", "null", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "...
Returns 422 / Unprocessable entity response. @param int $code @param array $errors @param string $message @return \Illuminate\Http\JsonResponse
[ "Returns", "422", "/", "Unprocessable", "entity", "response", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L159-L174
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondInternalError
public function respondInternalError($code = ApiResponse::CODE_API_ERROR, $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_INTERNAL_SERVER_ERROR) ->respondWithError($code, $message); }
php
public function respondInternalError($code = ApiResponse::CODE_API_ERROR, $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_INTERNAL_SERVER_ERROR) ->respondWithError($code, $message); }
[ "public", "function", "respondInternalError", "(", "$", "code", "=", "ApiResponse", "::", "CODE_API_ERROR", ",", "$", "message", "=", "null", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "setStatusCode", "(", "IlluminateResponse", "::", "HTTP_INTE...
Returns 500 / Internal server error occurred. @param int $code @param null $message @return \Illuminate\Http\JsonResponse
[ "Returns", "500", "/", "Internal", "server", "error", "occurred", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L184-L188
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondWithSuccess
public function respondWithSuccess(array $data = []): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_OK)->respond([ 'status' => [ 'http_code' => $this->getStatusCode(), ], 'data' => $data, ]); }
php
public function respondWithSuccess(array $data = []): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_OK)->respond([ 'status' => [ 'http_code' => $this->getStatusCode(), ], 'data' => $data, ]); }
[ "public", "function", "respondWithSuccess", "(", "array", "$", "data", "=", "[", "]", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "setStatusCode", "(", "IlluminateResponse", "::", "HTTP_OK", ")", "->", "respond", "(", "[", "'status'", "=>", ...
Returns 200 response with data. @param array $data @return \Illuminate\Http\JsonResponse
[ "Returns", "200", "response", "with", "data", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L197-L205
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondCreated
public function respondCreated($code = ApiResponse::CODE_SUCCESS, array $data = [], $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_CREATED)->respond([ 'status' => [ 'type' => 'success', 'message' => $this->getDefaultMessage($...
php
public function respondCreated($code = ApiResponse::CODE_SUCCESS, array $data = [], $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_CREATED)->respond([ 'status' => [ 'type' => 'success', 'message' => $this->getDefaultMessage($...
[ "public", "function", "respondCreated", "(", "$", "code", "=", "ApiResponse", "::", "CODE_SUCCESS", ",", "array", "$", "data", "=", "[", "]", ",", "$", "message", "=", "null", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "setStatusCode", "...
Returns 201 response with data. @param int $code @param array $data @param null $message @return \Illuminate\Http\JsonResponse
[ "Returns", "201", "response", "with", "data", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L216-L227
iocaste/microservice-foundation
src/Http/Responds.php
Responds.respondDeleted
public function respondDeleted($code = ApiResponse::CODE_DELETED, array $data = [], $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_NO_CONTENT)->respond([ 'status' => [ 'type' => 'success', 'message' => $this->getDefaultMessag...
php
public function respondDeleted($code = ApiResponse::CODE_DELETED, array $data = [], $message = null): JsonResponse { return $this->setStatusCode(IlluminateResponse::HTTP_NO_CONTENT)->respond([ 'status' => [ 'type' => 'success', 'message' => $this->getDefaultMessag...
[ "public", "function", "respondDeleted", "(", "$", "code", "=", "ApiResponse", "::", "CODE_DELETED", ",", "array", "$", "data", "=", "[", "]", ",", "$", "message", "=", "null", ")", ":", "JsonResponse", "{", "return", "$", "this", "->", "setStatusCode", "...
Returns 204 response, enacted but the response does not include an entity. @param int $code @param array $data @param string $message @return \Illuminate\Http\JsonResponse
[ "Returns", "204", "response", "enacted", "but", "the", "response", "does", "not", "include", "an", "entity", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L238-L249
iocaste/microservice-foundation
src/Http/Responds.php
Responds.getDefaultMessage
protected function getDefaultMessage($code, $message): string { if ($code !== null && $message === null) { return ApiResponse::$statusTexts[$code]['message']; } return $message; }
php
protected function getDefaultMessage($code, $message): string { if ($code !== null && $message === null) { return ApiResponse::$statusTexts[$code]['message']; } return $message; }
[ "protected", "function", "getDefaultMessage", "(", "$", "code", ",", "$", "message", ")", ":", "string", "{", "if", "(", "$", "code", "!==", "null", "&&", "$", "message", "===", "null", ")", "{", "return", "ApiResponse", "::", "$", "statusTexts", "[", ...
Checks if specified code already has default message. @param $code @param $message @return string
[ "Checks", "if", "specified", "code", "already", "has", "default", "message", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L259-L266
titon/db
src/Titon/Db/Driver/Dialect/AbstractDialect.php
AbstractDialect.addStatements
public function addStatements(array $statements) { foreach ($statements as $key => $statement) { $this->addStatement($key, $statement); } return $this; }
php
public function addStatements(array $statements) { foreach ($statements as $key => $statement) { $this->addStatement($key, $statement); } return $this; }
[ "public", "function", "addStatements", "(", "array", "$", "statements", ")", "{", "foreach", "(", "$", "statements", "as", "$", "key", "=>", "$", "statement", ")", "{", "$", "this", "->", "addStatement", "(", "$", "key", ",", "$", "statement", ")", ";"...
{@inheritdoc}
[ "{" ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L215-L221
titon/db
src/Titon/Db/Driver/Dialect/AbstractDialect.php
AbstractDialect.formatAttributes
public function formatAttributes(array $attributes) { foreach ($attributes as $key => $attr) { if ($attr instanceof Closure) { $attributes[$key] = call_user_func($attr, $this); } else if ($this->hasKeyword($attr)) { $attributes[$key] = $this->getKeyword($...
php
public function formatAttributes(array $attributes) { foreach ($attributes as $key => $attr) { if ($attr instanceof Closure) { $attributes[$key] = call_user_func($attr, $this); } else if ($this->hasKeyword($attr)) { $attributes[$key] = $this->getKeyword($...
[ "public", "function", "formatAttributes", "(", "array", "$", "attributes", ")", "{", "foreach", "(", "$", "attributes", "as", "$", "key", "=>", "$", "attr", ")", "{", "if", "(", "$", "attr", "instanceof", "Closure", ")", "{", "$", "attributes", "[", "$...
Prepare the list of attributes for rendering. If an attribute is found within a keyword, use the keyword. @param array $attributes @return array
[ "Prepare", "the", "list", "of", "attributes", "for", "rendering", ".", "If", "an", "attribute", "is", "found", "within", "a", "keyword", "use", "the", "keyword", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L230-L247
titon/db
src/Titon/Db/Driver/Dialect/AbstractDialect.php
AbstractDialect.formatColumns
public function formatColumns(Schema $schema) { $columns = []; foreach ($schema->getColumns() as $column => $options) { $dataType = $this->getDriver()->getType($options['type']); $options = $options + $dataType->getDefaultOptions(); $type = $options['type']; ...
php
public function formatColumns(Schema $schema) { $columns = []; foreach ($schema->getColumns() as $column => $options) { $dataType = $this->getDriver()->getType($options['type']); $options = $options + $dataType->getDefaultOptions(); $type = $options['type']; ...
[ "public", "function", "formatColumns", "(", "Schema", "$", "schema", ")", "{", "$", "columns", "=", "[", "]", ";", "foreach", "(", "$", "schema", "->", "getColumns", "(", ")", "as", "$", "column", "=>", "$", "options", ")", "{", "$", "dataType", "=",...
Format columns for a table schema. @param \Titon\Db\Driver\Schema $schema @return string
[ "Format", "columns", "for", "a", "table", "schema", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L255-L311
titon/db
src/Titon/Db/Driver/Dialect/AbstractDialect.php
AbstractDialect.formatCompounds
public function formatCompounds(array $queries) { if (!$queries) { return ''; } // @codeCoverageIgnoreStart if (!method_exists($this, 'buildSelect')) { throw new UnsupportedQueryStatementException('Unions require a buildSelect() method'); } // @co...
php
public function formatCompounds(array $queries) { if (!$queries) { return ''; } // @codeCoverageIgnoreStart if (!method_exists($this, 'buildSelect')) { throw new UnsupportedQueryStatementException('Unions require a buildSelect() method'); } // @co...
[ "public", "function", "formatCompounds", "(", "array", "$", "queries", ")", "{", "if", "(", "!", "$", "queries", ")", "{", "return", "''", ";", "}", "// @codeCoverageIgnoreStart", "if", "(", "!", "method_exists", "(", "$", "this", ",", "'buildSelect'", ")"...
Format compound queries: union, intersect, exclude. @param \Titon\Db\Query[] $queries @return string @throws \Titon\Db\Exception\UnsupportedQueryStatementException
[ "Format", "compound", "queries", ":", "union", "intersect", "exclude", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L320-L347
titon/db
src/Titon/Db/Driver/Dialect/AbstractDialect.php
AbstractDialect.formatDefault
public function formatDefault($value) { if ($value === '') { return ''; } if ($value instanceof Closure) { $value = call_user_func($value, $this); } else if (is_string($value) || $value === null) { $value = $this->getDriver()->escape($value); ...
php
public function formatDefault($value) { if ($value === '') { return ''; } if ($value instanceof Closure) { $value = call_user_func($value, $this); } else if (is_string($value) || $value === null) { $value = $this->getDriver()->escape($value); ...
[ "public", "function", "formatDefault", "(", "$", "value", ")", "{", "if", "(", "$", "value", "===", "''", ")", "{", "return", "''", ";", "}", "if", "(", "$", "value", "instanceof", "Closure", ")", "{", "$", "value", "=", "call_user_func", "(", "$", ...
Format the default value of a column. @param mixed $value @return string
[ "Format", "the", "default", "value", "of", "a", "column", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L355-L368
titon/db
src/Titon/Db/Driver/Dialect/AbstractDialect.php
AbstractDialect.formatExpression
public function formatExpression(Expr $expr) { $field = $expr->getField(); $operator = $expr->getOperator(); $value = $expr->getValue(); if ($operator === Expr::AS_ALIAS) { return sprintf($this->getClause(self::AS_ALIAS), $this->quote($field), $this->quote($value)); ...
php
public function formatExpression(Expr $expr) { $field = $expr->getField(); $operator = $expr->getOperator(); $value = $expr->getValue(); if ($operator === Expr::AS_ALIAS) { return sprintf($this->getClause(self::AS_ALIAS), $this->quote($field), $this->quote($value)); ...
[ "public", "function", "formatExpression", "(", "Expr", "$", "expr", ")", "{", "$", "field", "=", "$", "expr", "->", "getField", "(", ")", ";", "$", "operator", "=", "$", "expr", "->", "getOperator", "(", ")", ";", "$", "value", "=", "$", "expr", "-...
Format database expressions. @param \Titon\Db\Query\Expr $expr @return string
[ "Format", "database", "expressions", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L376-L436
titon/db
src/Titon/Db/Driver/Dialect/AbstractDialect.php
AbstractDialect.formatFields
public function formatFields(Query $query) { $joins = $query->getJoins(); $type = $query->getType(); switch ($type) { case Query::INSERT: case Query::MULTI_INSERT: $fields = $query->getData(); if (empty($fields)) { thr...
php
public function formatFields(Query $query) { $joins = $query->getJoins(); $type = $query->getType(); switch ($type) { case Query::INSERT: case Query::MULTI_INSERT: $fields = $query->getData(); if (empty($fields)) { thr...
[ "public", "function", "formatFields", "(", "Query", "$", "query", ")", "{", "$", "joins", "=", "$", "query", "->", "getJoins", "(", ")", ";", "$", "type", "=", "$", "query", "->", "getType", "(", ")", ";", "switch", "(", "$", "type", ")", "{", "c...
Format the fields structure depending on the type of query. @param \Titon\Db\Query $query @return string @throws \Titon\Db\Exception\InvalidQueryException
[ "Format", "the", "fields", "structure", "depending", "on", "the", "type", "of", "query", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L445-L545
titon/db
src/Titon/Db/Driver/Dialect/AbstractDialect.php
AbstractDialect.formatSelectFields
public function formatSelectFields(array $fields, $alias = null) { $columns = []; $quotedAlias = $alias ? $this->quote($alias) . '.' : ''; $virtualJoins = $this->getConfig('virtualJoins'); if (empty($fields)) { $columns[] = $quotedAlias . '*'; } else { f...
php
public function formatSelectFields(array $fields, $alias = null) { $columns = []; $quotedAlias = $alias ? $this->quote($alias) . '.' : ''; $virtualJoins = $this->getConfig('virtualJoins'); if (empty($fields)) { $columns[] = $quotedAlias . '*'; } else { f...
[ "public", "function", "formatSelectFields", "(", "array", "$", "fields", ",", "$", "alias", "=", "null", ")", "{", "$", "columns", "=", "[", "]", ";", "$", "quotedAlias", "=", "$", "alias", "?", "$", "this", "->", "quote", "(", "$", "alias", ")", "...
Format a list of fields for a SELECT statement and apply an optional alias. @param array $fields @param string $alias @return array
[ "Format", "a", "list", "of", "fields", "for", "a", "SELECT", "statement", "and", "apply", "an", "optional", "alias", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L554-L590
titon/db
src/Titon/Db/Driver/Dialect/AbstractDialect.php
AbstractDialect.formatUpdateFields
public function formatUpdateFields(array $fields, $alias = null) { $columns = []; if ($alias) { $alias = $this->quote($alias) . '.'; } foreach ($fields as $key => $value) { if ($value instanceof Expr) { $columns[] = $alias . $this->quote($key) . ...
php
public function formatUpdateFields(array $fields, $alias = null) { $columns = []; if ($alias) { $alias = $this->quote($alias) . '.'; } foreach ($fields as $key => $value) { if ($value instanceof Expr) { $columns[] = $alias . $this->quote($key) . ...
[ "public", "function", "formatUpdateFields", "(", "array", "$", "fields", ",", "$", "alias", "=", "null", ")", "{", "$", "columns", "=", "[", "]", ";", "if", "(", "$", "alias", ")", "{", "$", "alias", "=", "$", "this", "->", "quote", "(", "$", "al...
Format a list of fields for a SELECT statement and apply an optional alias. @param array $fields @param string $alias @return array
[ "Format", "a", "list", "of", "fields", "for", "a", "SELECT", "statement", "and", "apply", "an", "optional", "alias", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L599-L616