id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
44,600
bheisig/i-doit-api-client-php
src/CMDBCategoryInfo.php
CMDBCategoryInfo.readAll
public function readAll() { $cmdbObjectTypes = new CMDBObjectTypes($this->api); $cmdbObjectTypeCategories = new CMDBObjectTypeCategories($this->api); $categoryConsts = []; $objectTypes = $cmdbObjectTypes->read(); $objectTypeIDs = array_map(function ($objectType) { return (int) $objectType['id']; }, $objectTypes); $objectTypeCategoriesBatch = $cmdbObjectTypeCategories->batchReadByID($objectTypeIDs); $catTypes = ['catg', 'cats']; foreach ($objectTypeCategoriesBatch as $objectTypeCategories) { foreach ($catTypes as $catType) { if (!array_key_exists($catType, $objectTypeCategories)) { continue; } $more = array_map(function ($category) { return $category['const']; }, $objectTypeCategories[$catType]); $categoryConsts = array_merge($categoryConsts, $more); } } $categoryConsts = array_unique($categoryConsts); $blacklistedCategoryConsts = $this->getVirtualCategoryConstants(); $cleanCategoryConstants = []; foreach ($categoryConsts as $categoryConstant) { if (!in_array($categoryConstant, $blacklistedCategoryConsts)) { $cleanCategoryConstants[] = $categoryConstant; } } sort($cleanCategoryConstants); $categories = $this->batchRead($cleanCategoryConstants); $combinedArray = array_combine($cleanCategoryConstants, $categories); if (!is_array($combinedArray)) { throw new RuntimeException('Unable to restructure result'); } return $combinedArray; }
php
public function readAll() { $cmdbObjectTypes = new CMDBObjectTypes($this->api); $cmdbObjectTypeCategories = new CMDBObjectTypeCategories($this->api); $categoryConsts = []; $objectTypes = $cmdbObjectTypes->read(); $objectTypeIDs = array_map(function ($objectType) { return (int) $objectType['id']; }, $objectTypes); $objectTypeCategoriesBatch = $cmdbObjectTypeCategories->batchReadByID($objectTypeIDs); $catTypes = ['catg', 'cats']; foreach ($objectTypeCategoriesBatch as $objectTypeCategories) { foreach ($catTypes as $catType) { if (!array_key_exists($catType, $objectTypeCategories)) { continue; } $more = array_map(function ($category) { return $category['const']; }, $objectTypeCategories[$catType]); $categoryConsts = array_merge($categoryConsts, $more); } } $categoryConsts = array_unique($categoryConsts); $blacklistedCategoryConsts = $this->getVirtualCategoryConstants(); $cleanCategoryConstants = []; foreach ($categoryConsts as $categoryConstant) { if (!in_array($categoryConstant, $blacklistedCategoryConsts)) { $cleanCategoryConstants[] = $categoryConstant; } } sort($cleanCategoryConstants); $categories = $this->batchRead($cleanCategoryConstants); $combinedArray = array_combine($cleanCategoryConstants, $categories); if (!is_array($combinedArray)) { throw new RuntimeException('Unable to restructure result'); } return $combinedArray; }
[ "public", "function", "readAll", "(", ")", "{", "$", "cmdbObjectTypes", "=", "new", "CMDBObjectTypes", "(", "$", "this", "->", "api", ")", ";", "$", "cmdbObjectTypeCategories", "=", "new", "CMDBObjectTypeCategories", "(", "$", "this", "->", "api", ")", ";", ...
Try to fetch information about all available categories Ignored: * Custom categories * Categories which are not assigned to any object types Notice: This method causes 3 API calls. @return array Indexed array of associative arrays @throws Exception on error
[ "Try", "to", "fetch", "information", "about", "all", "available", "categories" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBCategoryInfo.php#L90-L137
44,601
bheisig/i-doit-api-client-php
src/CMDBObjectTypeGroups.php
CMDBObjectTypeGroups.read
public function read($orderBy = null, $sortDirection = null, $limit = null) { $params = []; if (isset($orderBy)) { $params['order_by'] = $orderBy; } if (isset($sortDirection)) { $params['sort'] = $sortDirection; } if (isset($limit)) { $params['limit'] = $limit; } return $this->api->request( 'cmdb.object_type_groups.read', $params ); }
php
public function read($orderBy = null, $sortDirection = null, $limit = null) { $params = []; if (isset($orderBy)) { $params['order_by'] = $orderBy; } if (isset($sortDirection)) { $params['sort'] = $sortDirection; } if (isset($limit)) { $params['limit'] = $limit; } return $this->api->request( 'cmdb.object_type_groups.read', $params ); }
[ "public", "function", "read", "(", "$", "orderBy", "=", "null", ",", "$", "sortDirection", "=", "null", ",", "$", "limit", "=", "null", ")", "{", "$", "params", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "orderBy", ")", ")", "{", "$", "p...
Fetches object type groups @param string $orderBy Order by 'title', 'status', 'constant' or 'id' optionally; use class constants ORDER_* @param string $sortDirection Sort ascending or descending optionally; use class constants SORT_* @param int $limit Limit result set optionally @return array @throws Exception on error
[ "Fetches", "object", "type", "groups" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjectTypeGroups.php#L53-L72
44,602
bheisig/i-doit-api-client-php
src/Idoit.php
Idoit.getAddOns
public function getAddOns() { $response = $this->api->request('idoit.addons.read'); if (!array_key_exists('result', $response) || !is_array($response['result'])) { throw new RuntimeException('Bad result'); } return $response['result']; }
php
public function getAddOns() { $response = $this->api->request('idoit.addons.read'); if (!array_key_exists('result', $response) || !is_array($response['result'])) { throw new RuntimeException('Bad result'); } return $response['result']; }
[ "public", "function", "getAddOns", "(", ")", "{", "$", "response", "=", "$", "this", "->", "api", "->", "request", "(", "'idoit.addons.read'", ")", ";", "if", "(", "!", "array_key_exists", "(", "'result'", ",", "$", "response", ")", "||", "!", "is_array"...
Read information about installed add-ons @return array Associative array @throws Exception on error
[ "Read", "information", "about", "installed", "add", "-", "ons" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/Idoit.php#L53-L61
44,603
bheisig/i-doit-api-client-php
src/Idoit.php
Idoit.batchSearch
public function batchSearch(array $queries) { $requests = []; foreach ($queries as $query) { $requests[] = [ 'method' => 'idoit.search', 'params' => [ 'q' => $query ] ]; } return $this->api->batchRequest($requests); }
php
public function batchSearch(array $queries) { $requests = []; foreach ($queries as $query) { $requests[] = [ 'method' => 'idoit.search', 'params' => [ 'q' => $query ] ]; } return $this->api->batchRequest($requests); }
[ "public", "function", "batchSearch", "(", "array", "$", "queries", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "queries", "as", "$", "query", ")", "{", "$", "requests", "[", "]", "=", "[", "'method'", "=>", "'idoit.search'", "...
Perform one or more searches at once @param array $queries Queries as strings @return array Search results @throws Exception on error
[ "Perform", "one", "or", "more", "searches", "at", "once" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/Idoit.php#L110-L123
44,604
bheisig/i-doit-api-client-php
src/CMDBObjects.php
CMDBObjects.create
public function create(array $objects) { $requests = []; foreach ($objects as $object) { $requests[] = [ 'method' => 'cmdb.object.create', 'params' => $object ]; } $result = $this->api->batchRequest($requests); $objectIDs = []; foreach ($result as $object) { $objectIDs[] = $object['id']; } return $objectIDs; }
php
public function create(array $objects) { $requests = []; foreach ($objects as $object) { $requests[] = [ 'method' => 'cmdb.object.create', 'params' => $object ]; } $result = $this->api->batchRequest($requests); $objectIDs = []; foreach ($result as $object) { $objectIDs[] = $object['id']; } return $objectIDs; }
[ "public", "function", "create", "(", "array", "$", "objects", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "objects", "as", "$", "object", ")", "{", "$", "requests", "[", "]", "=", "[", "'method'", "=>", "'cmdb.object.create'", ...
Create one or more objects @param array $objects Mandatory attributes ('type', 'title') and optional attributes ('category', 'purpose', 'cmdb_status', 'description') @return array List of object identifiers @throws Exception on error
[ "Create", "one", "or", "more", "objects" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjects.php#L59-L78
44,605
bheisig/i-doit-api-client-php
src/CMDBObjects.php
CMDBObjects.readByIDs
public function readByIDs(array $objectIDs, $categories = false) { $params = [ 'filter' => [ 'ids' => $objectIDs ] ]; if ($categories !== false) { $params['categories'] = $categories; } return $this->api->request( 'cmdb.objects.read', $params ); }
php
public function readByIDs(array $objectIDs, $categories = false) { $params = [ 'filter' => [ 'ids' => $objectIDs ] ]; if ($categories !== false) { $params['categories'] = $categories; } return $this->api->request( 'cmdb.objects.read', $params ); }
[ "public", "function", "readByIDs", "(", "array", "$", "objectIDs", ",", "$", "categories", "=", "false", ")", "{", "$", "params", "=", "[", "'filter'", "=>", "[", "'ids'", "=>", "$", "objectIDs", "]", "]", ";", "if", "(", "$", "categories", "!==", "f...
Fetch objects by their identifiers @param array $objectIDs List of object identifiers as integers @param bool|array $categories Also fetch category entries; add a list of category constants as array of strings or true for all assigned categories, otherwise false for none; defaults to false @return array Indexed array of associative arrays @throws Exception on error
[ "Fetch", "objects", "by", "their", "identifiers" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjects.php#L146-L161
44,606
bheisig/i-doit-api-client-php
src/CMDBObjects.php
CMDBObjects.readByType
public function readByType($objectType, $categories = false) { $params = [ 'filter' => [ 'type' => $objectType ] ]; if ($categories !== false) { $params['categories'] = $categories; } return $this->api->request( 'cmdb.objects.read', $params ); }
php
public function readByType($objectType, $categories = false) { $params = [ 'filter' => [ 'type' => $objectType ] ]; if ($categories !== false) { $params['categories'] = $categories; } return $this->api->request( 'cmdb.objects.read', $params ); }
[ "public", "function", "readByType", "(", "$", "objectType", ",", "$", "categories", "=", "false", ")", "{", "$", "params", "=", "[", "'filter'", "=>", "[", "'type'", "=>", "$", "objectType", "]", "]", ";", "if", "(", "$", "categories", "!==", "false", ...
Fetch objects by their object type @param string $objectType Object type constant @param bool|array $categories Also fetch category entries; add a list of category constants as array of strings or true for all assigned categories, otherwise false for none; defaults to false @return array Indexed array of associative arrays @throws Exception on error
[ "Fetch", "objects", "by", "their", "object", "type" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjects.php#L174-L189
44,607
bheisig/i-doit-api-client-php
src/CMDBObjects.php
CMDBObjects.update
public function update(array $objects) { $requests = []; foreach ($objects as $object) { $requests[] = [ 'method' => 'cmdb.object.update', 'params' => $object ]; } $this->api->batchRequest($requests); return $this; }
php
public function update(array $objects) { $requests = []; foreach ($objects as $object) { $requests[] = [ 'method' => 'cmdb.object.update', 'params' => $object ]; } $this->api->batchRequest($requests); return $this; }
[ "public", "function", "update", "(", "array", "$", "objects", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "objects", "as", "$", "object", ")", "{", "$", "requests", "[", "]", "=", "[", "'method'", "=>", "'cmdb.object.update'", ...
Update one or more existing objects @param array $objects Indexed array of object attributes ('id' and 'title') @return self Returns itself @throws Exception on error
[ "Update", "one", "or", "more", "existing", "objects" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjects.php#L300-L313
44,608
bheisig/i-doit-api-client-php
src/CMDBObjects.php
CMDBObjects.archive
public function archive(array $objectIDs) { $requests = []; foreach ($objectIDs as $objectID) { $requests[] = [ 'method' => 'cmdb.object.archive', 'params' => [ 'object' => $objectID ] ]; } $this->api->batchRequest($requests); return $this; }
php
public function archive(array $objectIDs) { $requests = []; foreach ($objectIDs as $objectID) { $requests[] = [ 'method' => 'cmdb.object.archive', 'params' => [ 'object' => $objectID ] ]; } $this->api->batchRequest($requests); return $this; }
[ "public", "function", "archive", "(", "array", "$", "objectIDs", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "objectIDs", "as", "$", "objectID", ")", "{", "$", "requests", "[", "]", "=", "[", "'method'", "=>", "'cmdb.object.arch...
Archive one or more objects @param array $objectIDs List of object identifiers as integers @return self Returns itself @throws Exception on error
[ "Archive", "one", "or", "more", "objects" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjects.php#L324-L339
44,609
bheisig/i-doit-api-client-php
src/CMDBObjects.php
CMDBObjects.delete
public function delete(array $objectIDs) { $requests = []; foreach ($objectIDs as $objectID) { $requests[] = [ 'method' => 'cmdb.object.delete', 'params' => [ 'object' => $objectID ] ]; } $this->api->batchRequest($requests); return $this; }
php
public function delete(array $objectIDs) { $requests = []; foreach ($objectIDs as $objectID) { $requests[] = [ 'method' => 'cmdb.object.delete', 'params' => [ 'object' => $objectID ] ]; } $this->api->batchRequest($requests); return $this; }
[ "public", "function", "delete", "(", "array", "$", "objectIDs", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "objectIDs", "as", "$", "objectID", ")", "{", "$", "requests", "[", "]", "=", "[", "'method'", "=>", "'cmdb.object.delet...
Delete one or more objects @param array $objectIDs List of object identifiers as integers @return self Returns itself @throws Exception on error
[ "Delete", "one", "or", "more", "objects" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjects.php#L350-L365
44,610
bheisig/i-doit-api-client-php
src/CMDBObjects.php
CMDBObjects.purge
public function purge(array $objectIDs) { $requests = []; foreach ($objectIDs as $objectID) { $requests[] = [ 'method' => 'cmdb.object.purge', 'params' => [ 'object' => $objectID ] ]; } $this->api->batchRequest($requests); return $this; }
php
public function purge(array $objectIDs) { $requests = []; foreach ($objectIDs as $objectID) { $requests[] = [ 'method' => 'cmdb.object.purge', 'params' => [ 'object' => $objectID ] ]; } $this->api->batchRequest($requests); return $this; }
[ "public", "function", "purge", "(", "array", "$", "objectIDs", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "objectIDs", "as", "$", "objectID", ")", "{", "$", "requests", "[", "]", "=", "[", "'method'", "=>", "'cmdb.object.purge'...
Purge one or more objects @param array $objectIDs List of object identifiers as integers @return self Returns itself @throws Exception on error
[ "Purge", "one", "or", "more", "objects" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjects.php#L376-L391
44,611
bheisig/i-doit-api-client-php
src/CMDBObjects.php
CMDBObjects.recycle
public function recycle(array $objectIDs) { $requests = []; foreach ($objectIDs as $objectID) { $requests[] = [ 'method' => 'cmdb.object.recycle', 'params' => [ 'object' => $objectID ] ]; } $this->api->batchRequest($requests); return $this; }
php
public function recycle(array $objectIDs) { $requests = []; foreach ($objectIDs as $objectID) { $requests[] = [ 'method' => 'cmdb.object.recycle', 'params' => [ 'object' => $objectID ] ]; } $this->api->batchRequest($requests); return $this; }
[ "public", "function", "recycle", "(", "array", "$", "objectIDs", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "objectIDs", "as", "$", "objectID", ")", "{", "$", "requests", "[", "]", "=", "[", "'method'", "=>", "'cmdb.object.recy...
Restore objects to "normal" status @param array $objectIDs List of object identifiers as integers @return self Returns itself @throws Exception on error
[ "Restore", "objects", "to", "normal", "status" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjects.php#L402-L417
44,612
bheisig/i-doit-api-client-php
src/CMDBDialog.php
CMDBDialog.create
public function create($category, $attribute, $value, $parent = null) { $params = [ 'category' => $category, 'property' => $attribute, 'value' => $value ]; if (isset($parent)) { $params['parent'] = $parent; } $result = $this->api->request( 'cmdb.dialog.create', $params ); if (!array_key_exists('entry_id', $result) || !is_numeric($result['entry_id'])) { throw new RuntimeException('Bad result'); } return (int) $result['entry_id']; }
php
public function create($category, $attribute, $value, $parent = null) { $params = [ 'category' => $category, 'property' => $attribute, 'value' => $value ]; if (isset($parent)) { $params['parent'] = $parent; } $result = $this->api->request( 'cmdb.dialog.create', $params ); if (!array_key_exists('entry_id', $result) || !is_numeric($result['entry_id'])) { throw new RuntimeException('Bad result'); } return (int) $result['entry_id']; }
[ "public", "function", "create", "(", "$", "category", ",", "$", "attribute", ",", "$", "value", ",", "$", "parent", "=", "null", ")", "{", "$", "params", "=", "[", "'category'", "=>", "$", "category", ",", "'property'", "=>", "$", "attribute", ",", "...
Create a new entry for a drop-down menu @param string $category Category constant @param string $attribute Attribute @param mixed $value Value @param string|integer $parent Reference parent entry by its title (string) or by its identifier (integer) @return int Entry identifier @throws Exception on error
[ "Create", "a", "new", "entry", "for", "a", "drop", "-", "down", "menu" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBDialog.php#L47-L69
44,613
bheisig/i-doit-api-client-php
src/CMDBDialog.php
CMDBDialog.batchCreate
public function batchCreate(array $values) { $requests = []; foreach ($values as $category => $keyValuePair) { foreach ($keyValuePair as $attribute => $mixed) { $values = []; if (is_array($mixed)) { $values = $mixed; } else { $values[] = $mixed; } foreach ($values as $value) { $requests[] = [ 'method' => 'cmdb.dialog.create', 'params' => [ 'category' => $category, 'property' => $attribute, 'value' => $value ] ]; } } } $entryIDs = []; $entries = $this->api->batchRequest($requests); foreach ($entries as $entry) { if (!array_key_exists('entry_id', $entry) || !is_numeric($entry['entry_id'])) { throw new RuntimeException('Bad result'); } $entryIDs[] = (int) $entry['entry_id']; } return $entryIDs; }
php
public function batchCreate(array $values) { $requests = []; foreach ($values as $category => $keyValuePair) { foreach ($keyValuePair as $attribute => $mixed) { $values = []; if (is_array($mixed)) { $values = $mixed; } else { $values[] = $mixed; } foreach ($values as $value) { $requests[] = [ 'method' => 'cmdb.dialog.create', 'params' => [ 'category' => $category, 'property' => $attribute, 'value' => $value ] ]; } } } $entryIDs = []; $entries = $this->api->batchRequest($requests); foreach ($entries as $entry) { if (!array_key_exists('entry_id', $entry) || !is_numeric($entry['entry_id'])) { throw new RuntimeException('Bad result'); } $entryIDs[] = (int) $entry['entry_id']; } return $entryIDs; }
[ "public", "function", "batchCreate", "(", "array", "$", "values", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "values", "as", "$", "category", "=>", "$", "keyValuePair", ")", "{", "foreach", "(", "$", "keyValuePair", "as", "$", ...
Create one or more entries for a drow-down menu @param array $values Values: [ 'cat' => [ 'attr' => 'value', 'attr' => 'value' ], 'cat' => [ 'attr' => ['value 1', 'value 2'] ] ] @return array List of entry identifiers @throws Exception on error @todo Add support for parameter "parent"!
[ "Create", "one", "or", "more", "entries", "for", "a", "drow", "-", "down", "menu" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBDialog.php#L90-L130
44,614
bheisig/i-doit-api-client-php
src/CMDBDialog.php
CMDBDialog.batchRead
public function batchRead(array $attributes) { $requests = []; foreach ($attributes as $category => $mixed) { $attributes = []; if (is_array($mixed)) { $attributes = $mixed; } else { $attributes[] = $mixed; } foreach ($attributes as $attribute) { $requests[] = [ 'method' => 'cmdb.dialog.read', 'params' => [ 'category' => $category, 'property' => $attribute ] ]; } } return $this->api->batchRequest($requests); }
php
public function batchRead(array $attributes) { $requests = []; foreach ($attributes as $category => $mixed) { $attributes = []; if (is_array($mixed)) { $attributes = $mixed; } else { $attributes[] = $mixed; } foreach ($attributes as $attribute) { $requests[] = [ 'method' => 'cmdb.dialog.read', 'params' => [ 'category' => $category, 'property' => $attribute ] ]; } } return $this->api->batchRequest($requests); }
[ "public", "function", "batchRead", "(", "array", "$", "attributes", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "attributes", "as", "$", "category", "=>", "$", "mixed", ")", "{", "$", "attributes", "=", "[", "]", ";", "if", ...
Fetch values from one or more drop-down menus @param array $attributes Attributes: ['cat' => 'attr', 'cat' => ['attr 1', 'attr 2']] @return array Indexed array of associative arrays @throws Exception on error
[ "Fetch", "values", "from", "one", "or", "more", "drop", "-", "down", "menus" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBDialog.php#L161-L185
44,615
bheisig/i-doit-api-client-php
src/CMDBDialog.php
CMDBDialog.delete
public function delete($category, $attribute, $entryID) { $this->api->request( 'cmdb.dialog.delete', [ 'category' => $category, 'property' => $attribute, 'entry_id' => $entryID ] ); return $this; }
php
public function delete($category, $attribute, $entryID) { $this->api->request( 'cmdb.dialog.delete', [ 'category' => $category, 'property' => $attribute, 'entry_id' => $entryID ] ); return $this; }
[ "public", "function", "delete", "(", "$", "category", ",", "$", "attribute", ",", "$", "entryID", ")", "{", "$", "this", "->", "api", "->", "request", "(", "'cmdb.dialog.delete'", ",", "[", "'category'", "=>", "$", "category", ",", "'property'", "=>", "$...
Purge value from drop-down menu @param string $category Category constant @param string $attribute Attribute @param int $entryID Entry identifier @return self Returns itself @throws Exception on error
[ "Purge", "value", "from", "drop", "-", "down", "menu" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBDialog.php#L198-L209
44,616
bheisig/i-doit-api-client-php
src/CheckMKStaticTag.php
CheckMKStaticTag.create
public function create($title, $tag = null, $group = null, $description = null) { $params = [ 'data' => [ 'title' => $title ] ]; if (isset($tag)) { $params['data']['tag'] = $tag; } if (isset($group)) { $params['data']['group'] = $group; } if (isset($group)) { $params['data']['description'] = $description; } $result = $this->api->request( 'checkmk.statictag.create', $params ); if (!array_key_exists('id', $result) || !is_numeric($result['id']) || !array_key_exists('success', $result) || $result['success'] !== true) { if (array_key_exists('message', $result)) { throw new RuntimeException(sprintf('Bad result: %s', $result['message'])); } else { throw new RuntimeException('Bad result'); } } return (int) $result['id']; }
php
public function create($title, $tag = null, $group = null, $description = null) { $params = [ 'data' => [ 'title' => $title ] ]; if (isset($tag)) { $params['data']['tag'] = $tag; } if (isset($group)) { $params['data']['group'] = $group; } if (isset($group)) { $params['data']['description'] = $description; } $result = $this->api->request( 'checkmk.statictag.create', $params ); if (!array_key_exists('id', $result) || !is_numeric($result['id']) || !array_key_exists('success', $result) || $result['success'] !== true) { if (array_key_exists('message', $result)) { throw new RuntimeException(sprintf('Bad result: %s', $result['message'])); } else { throw new RuntimeException('Bad result'); } } return (int) $result['id']; }
[ "public", "function", "create", "(", "$", "title", ",", "$", "tag", "=", "null", ",", "$", "group", "=", "null", ",", "$", "description", "=", "null", ")", "{", "$", "params", "=", "[", "'data'", "=>", "[", "'title'", "=>", "$", "title", "]", "]"...
Create a new static host tag @param string $title Name @param string $tag Tag ID @param string $group Optional associated host group @param string $description Optional description @return int Identifier @throws Exception on error
[ "Create", "a", "new", "static", "host", "tag" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CheckMKStaticTag.php#L48-L84
44,617
bheisig/i-doit-api-client-php
src/CheckMKStaticTag.php
CheckMKStaticTag.batchCreate
public function batchCreate(array $tags) { $requests = []; $required = ['title']; foreach ($tags as $data) { foreach ($required as $attribute) { if (!array_key_exists($attribute, $data)) { throw new BadMethodCallException(sprintf( 'Missing attribute "%s"', $attribute )); } } $requests[] = [ 'method' => 'checkmk.statictag.create', 'params' => [ 'data' => $data ] ]; } $result = $this->api->batchRequest($requests); $tagIDs = []; foreach ($result as $tag) { // Do not check 'id' because in a batch request it is always NULL: if (!array_key_exists('success', $tag) || $tag['success'] !== true) { if (array_key_exists('message', $tag)) { throw new RuntimeException(sprintf('Bad result: %s', $tag['message'])); } else { throw new RuntimeException('Bad result'); } } $tagIDs[] = $tag['id']; } return $tagIDs; }
php
public function batchCreate(array $tags) { $requests = []; $required = ['title']; foreach ($tags as $data) { foreach ($required as $attribute) { if (!array_key_exists($attribute, $data)) { throw new BadMethodCallException(sprintf( 'Missing attribute "%s"', $attribute )); } } $requests[] = [ 'method' => 'checkmk.statictag.create', 'params' => [ 'data' => $data ] ]; } $result = $this->api->batchRequest($requests); $tagIDs = []; foreach ($result as $tag) { // Do not check 'id' because in a batch request it is always NULL: if (!array_key_exists('success', $tag) || $tag['success'] !== true) { if (array_key_exists('message', $tag)) { throw new RuntimeException(sprintf('Bad result: %s', $tag['message'])); } else { throw new RuntimeException('Bad result'); } } $tagIDs[] = $tag['id']; } return $tagIDs; }
[ "public", "function", "batchCreate", "(", "array", "$", "tags", ")", "{", "$", "requests", "=", "[", "]", ";", "$", "required", "=", "[", "'title'", "]", ";", "foreach", "(", "$", "tags", "as", "$", "data", ")", "{", "foreach", "(", "$", "required"...
Create one or more static host tags @param array $tags List of tags; required attributes per tag: "title"; optional attributes per tag: "tag" (tag ID), "group", "description" @return array List of identifiers as integers @throws Exception on error
[ "Create", "one", "or", "more", "static", "host", "tags" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CheckMKStaticTag.php#L97-L139
44,618
bheisig/i-doit-api-client-php
src/CheckMKStaticTag.php
CheckMKStaticTag.deleteAll
public function deleteAll() { $tags = $this->read(); $ids = []; foreach ($tags as $tag) { $ids[] = $tag['id']; } if (count($ids) > 0) { $this->batchDelete($ids); } return $this; }
php
public function deleteAll() { $tags = $this->read(); $ids = []; foreach ($tags as $tag) { $ids[] = $tag['id']; } if (count($ids) > 0) { $this->batchDelete($ids); } return $this; }
[ "public", "function", "deleteAll", "(", ")", "{", "$", "tags", "=", "$", "this", "->", "read", "(", ")", ";", "$", "ids", "=", "[", "]", ";", "foreach", "(", "$", "tags", "as", "$", "tag", ")", "{", "$", "ids", "[", "]", "=", "$", "tag", "[...
Delete all static host tags @return self Returns itself @throws Exception on error
[ "Delete", "all", "static", "host", "tags" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CheckMKStaticTag.php#L314-L328
44,619
bheisig/i-doit-api-client-php
src/CMDBObjectTypes.php
CMDBObjectTypes.readOne
public function readOne($objectType) { $result = $this->api->request( 'cmdb.object_types', [ 'filter' => [ 'id' => $objectType ], 'countobjects' => true ] ); return end($result); }
php
public function readOne($objectType) { $result = $this->api->request( 'cmdb.object_types', [ 'filter' => [ 'id' => $objectType ], 'countobjects' => true ] ); return end($result); }
[ "public", "function", "readOne", "(", "$", "objectType", ")", "{", "$", "result", "=", "$", "this", "->", "api", "->", "request", "(", "'cmdb.object_types'", ",", "[", "'filter'", "=>", "[", "'id'", "=>", "$", "objectType", "]", ",", "'countobjects'", "=...
Fetches information about an object type by its constant @param string $objectType Object type constant @return array Associative array @throws Exception on error
[ "Fetches", "information", "about", "an", "object", "type", "by", "its", "constant" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBObjectTypes.php#L59-L71
44,620
PrestaShop/welcome
welcome.php
Welcome.install
public function install() { return parent::install() && $this->installTab() && $this->registerHook('displayAdminNavBarBeforeEnd') && $this->registerHook('displayAdminAfterHeader') && $this->registerHook('displayBackOfficeHeader'); }
php
public function install() { return parent::install() && $this->installTab() && $this->registerHook('displayAdminNavBarBeforeEnd') && $this->registerHook('displayAdminAfterHeader') && $this->registerHook('displayBackOfficeHeader'); }
[ "public", "function", "install", "(", ")", "{", "return", "parent", "::", "install", "(", ")", "&&", "$", "this", "->", "installTab", "(", ")", "&&", "$", "this", "->", "registerHook", "(", "'displayAdminNavBarBeforeEnd'", ")", "&&", "$", "this", "->", "...
Module installation. @return bool Success of the installation
[ "Module", "installation", "." ]
a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50
https://github.com/PrestaShop/welcome/blob/a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50/welcome.php#L90-L97
44,621
PrestaShop/welcome
welcome.php
Welcome.hookDisplayBackOfficeHeader
public function hookDisplayBackOfficeHeader() { if (!$this->onBoarding->isFinished()) { $this->context->controller->addCSS($this->_path.'public/module.css', 'all'); $this->context->controller->addJS($this->_path.'public/module.js', 'all'); } }
php
public function hookDisplayBackOfficeHeader() { if (!$this->onBoarding->isFinished()) { $this->context->controller->addCSS($this->_path.'public/module.css', 'all'); $this->context->controller->addJS($this->_path.'public/module.js', 'all'); } }
[ "public", "function", "hookDisplayBackOfficeHeader", "(", ")", "{", "if", "(", "!", "$", "this", "->", "onBoarding", "->", "isFinished", "(", ")", ")", "{", "$", "this", "->", "context", "->", "controller", "->", "addCSS", "(", "$", "this", "->", "_path"...
Hook called when the backoffice header is displayed.
[ "Hook", "called", "when", "the", "backoffice", "header", "is", "displayed", "." ]
a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50
https://github.com/PrestaShop/welcome/blob/a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50/welcome.php#L140-L146
44,622
PrestaShop/welcome
welcome.php
Welcome.hookDisplayAdminNavBarBeforeEnd
public function hookDisplayAdminNavBarBeforeEnd() { if (!$this->onBoarding->isFinished()) { $this->onBoarding->showModuleContentForNavBar($this->context->link); } }
php
public function hookDisplayAdminNavBarBeforeEnd() { if (!$this->onBoarding->isFinished()) { $this->onBoarding->showModuleContentForNavBar($this->context->link); } }
[ "public", "function", "hookDisplayAdminNavBarBeforeEnd", "(", ")", "{", "if", "(", "!", "$", "this", "->", "onBoarding", "->", "isFinished", "(", ")", ")", "{", "$", "this", "->", "onBoarding", "->", "showModuleContentForNavBar", "(", "$", "this", "->", "con...
Hook called before the end of the nav bar.
[ "Hook", "called", "before", "the", "end", "of", "the", "nav", "bar", "." ]
a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50
https://github.com/PrestaShop/welcome/blob/a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50/welcome.php#L161-L166
44,623
PrestaShop/welcome
welcome.php
Welcome.apiCall
public function apiCall($action, $value) { switch ($action) { case 'setCurrentStep': if (!$this->onBoarding->setCurrentStep($value)) { throw new Exception('The current step cannot be saved.'); } break; case 'setShutDown': if (!$this->onBoarding->setShutDown($value)) { throw new Exception('The shut down status cannot be saved.'); } break; } }
php
public function apiCall($action, $value) { switch ($action) { case 'setCurrentStep': if (!$this->onBoarding->setCurrentStep($value)) { throw new Exception('The current step cannot be saved.'); } break; case 'setShutDown': if (!$this->onBoarding->setShutDown($value)) { throw new Exception('The shut down status cannot be saved.'); } break; } }
[ "public", "function", "apiCall", "(", "$", "action", ",", "$", "value", ")", "{", "switch", "(", "$", "action", ")", "{", "case", "'setCurrentStep'", ":", "if", "(", "!", "$", "this", "->", "onBoarding", "->", "setCurrentStep", "(", "$", "value", ")", ...
Execute an API like action for the OnBoarding. @param string $action Action to perform @param mixed $value Value to assign to the action @throws Exception
[ "Execute", "an", "API", "like", "action", "for", "the", "OnBoarding", "." ]
a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50
https://github.com/PrestaShop/welcome/blob/a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50/welcome.php#L176-L190
44,624
PrestaShop/welcome
OnBoarding/OnBoarding.php
OnBoarding.showModuleContent
public function showModuleContent() { $templates = array(); foreach ($this->configuration['templates'] as $template) { $templates[] = array( 'name' => $template, 'content' => str_replace(array("\n", "\r", "\t"), "", $this->getTemplateContent("templates/$template")), ); } echo $this->getTemplateContent('content', array( 'currentStep' => $this->getCurrentStep(), 'totalSteps' => $this->getTotalSteps(), 'percent_real' => ($this->getCurrentStep() / $this->getTotalSteps()) * 100, 'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps())*100), 'isShutDown' => $this->isShutDown(), 'steps' => $this->configuration['steps'], 'jsonSteps' => json_encode($this->configuration['steps']), 'templates' => $templates, )); }
php
public function showModuleContent() { $templates = array(); foreach ($this->configuration['templates'] as $template) { $templates[] = array( 'name' => $template, 'content' => str_replace(array("\n", "\r", "\t"), "", $this->getTemplateContent("templates/$template")), ); } echo $this->getTemplateContent('content', array( 'currentStep' => $this->getCurrentStep(), 'totalSteps' => $this->getTotalSteps(), 'percent_real' => ($this->getCurrentStep() / $this->getTotalSteps()) * 100, 'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps())*100), 'isShutDown' => $this->isShutDown(), 'steps' => $this->configuration['steps'], 'jsonSteps' => json_encode($this->configuration['steps']), 'templates' => $templates, )); }
[ "public", "function", "showModuleContent", "(", ")", "{", "$", "templates", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "configuration", "[", "'templates'", "]", "as", "$", "template", ")", "{", "$", "templates", "[", "]", "=", "arr...
Show the OnBoarding module content.
[ "Show", "the", "OnBoarding", "module", "content", "." ]
a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50
https://github.com/PrestaShop/welcome/blob/a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50/OnBoarding/OnBoarding.php#L63-L83
44,625
PrestaShop/welcome
OnBoarding/OnBoarding.php
OnBoarding.showModuleContentForNavBar
public function showModuleContentForNavBar($link) { echo $this->getTemplateContent('navbar', array( 'currentStep' => $this->getCurrentStep(), 'totalSteps' => $this->getTotalSteps(), 'percent_real' => ($this->getCurrentStep() / $this->getTotalSteps()) * 100, 'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps())*100), 'link' => $link->getAdminLink('AdminWelcome'), )); }
php
public function showModuleContentForNavBar($link) { echo $this->getTemplateContent('navbar', array( 'currentStep' => $this->getCurrentStep(), 'totalSteps' => $this->getTotalSteps(), 'percent_real' => ($this->getCurrentStep() / $this->getTotalSteps()) * 100, 'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps())*100), 'link' => $link->getAdminLink('AdminWelcome'), )); }
[ "public", "function", "showModuleContentForNavBar", "(", "$", "link", ")", "{", "echo", "$", "this", "->", "getTemplateContent", "(", "'navbar'", ",", "array", "(", "'currentStep'", "=>", "$", "this", "->", "getCurrentStep", "(", ")", ",", "'totalSteps'", "=>"...
Show the OnBoarding content for the nav bar.
[ "Show", "the", "OnBoarding", "content", "for", "the", "nav", "bar", "." ]
a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50
https://github.com/PrestaShop/welcome/blob/a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50/OnBoarding/OnBoarding.php#L88-L97
44,626
PrestaShop/welcome
OnBoarding/OnBoarding.php
OnBoarding.loadConfiguration
private function loadConfiguration(Router $router) { $configuration = new Configuration($this->translator); $configuration = $configuration->getConfiguration($router); foreach ($configuration['steps']['groups'] as &$currentGroup) { if (isset($currentGroup['title'])) { $currentGroup['title'] = $this->getTextFromSettings($currentGroup['title']); } if (isset($currentGroup['subtitle'])) { foreach ($currentGroup['subtitle'] as &$subtitle) { $subtitle = $this->getTextFromSettings($subtitle); } } foreach ($currentGroup['steps'] as &$currentStep) { $currentStep['text'] = $this->getTextFromSettings($currentStep['text']); } } $this->configuration = $configuration; }
php
private function loadConfiguration(Router $router) { $configuration = new Configuration($this->translator); $configuration = $configuration->getConfiguration($router); foreach ($configuration['steps']['groups'] as &$currentGroup) { if (isset($currentGroup['title'])) { $currentGroup['title'] = $this->getTextFromSettings($currentGroup['title']); } if (isset($currentGroup['subtitle'])) { foreach ($currentGroup['subtitle'] as &$subtitle) { $subtitle = $this->getTextFromSettings($subtitle); } } foreach ($currentGroup['steps'] as &$currentStep) { $currentStep['text'] = $this->getTextFromSettings($currentStep['text']); } } $this->configuration = $configuration; }
[ "private", "function", "loadConfiguration", "(", "Router", "$", "router", ")", "{", "$", "configuration", "=", "new", "Configuration", "(", "$", "this", "->", "translator", ")", ";", "$", "configuration", "=", "$", "configuration", "->", "getConfiguration", "(...
Load all the steps with the localized texts. @param string $configPath Path where the configuration can be loaded
[ "Load", "all", "the", "steps", "with", "the", "localized", "texts", "." ]
a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50
https://github.com/PrestaShop/welcome/blob/a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50/OnBoarding/OnBoarding.php#L138-L158
44,627
PrestaShop/welcome
OnBoarding/OnBoarding.php
OnBoarding.getTemplateContent
private function getTemplateContent($templateName, $additionnalParameters = array()) { $this->smarty->assign($additionnalParameters); return $this->module->fetch(__DIR__.'/../views/'.$templateName.'.tpl'); }
php
private function getTemplateContent($templateName, $additionnalParameters = array()) { $this->smarty->assign($additionnalParameters); return $this->module->fetch(__DIR__.'/../views/'.$templateName.'.tpl'); }
[ "private", "function", "getTemplateContent", "(", "$", "templateName", ",", "$", "additionnalParameters", "=", "array", "(", ")", ")", "{", "$", "this", "->", "smarty", "->", "assign", "(", "$", "additionnalParameters", ")", ";", "return", "$", "this", "->",...
Return a template. @param string $templateName Template name @param array $additionnalParameters Additionnal parameters to inject on the Twig template @return string Parsed template
[ "Return", "a", "template", "." ]
a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50
https://github.com/PrestaShop/welcome/blob/a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50/OnBoarding/OnBoarding.php#L197-L201
44,628
PrestaShop/welcome
OnBoarding/OnBoarding.php
OnBoarding.getTotalSteps
private function getTotalSteps() { $total = 0; if (null != $this->configuration) { foreach ($this->configuration['steps']['groups'] as &$group) { $total += count($group['steps']); } } return $total; }
php
private function getTotalSteps() { $total = 0; if (null != $this->configuration) { foreach ($this->configuration['steps']['groups'] as &$group) { $total += count($group['steps']); } } return $total; }
[ "private", "function", "getTotalSteps", "(", ")", "{", "$", "total", "=", "0", ";", "if", "(", "null", "!=", "$", "this", "->", "configuration", ")", "{", "foreach", "(", "$", "this", "->", "configuration", "[", "'steps'", "]", "[", "'groups'", "]", ...
Return the steps count. @return int Steps count
[ "Return", "the", "steps", "count", "." ]
a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50
https://github.com/PrestaShop/welcome/blob/a0ad26a5fdeb0311e1aea1a42be3d9c74e889a50/OnBoarding/OnBoarding.php#L218-L229
44,629
bheisig/i-doit-api-client-php
src/CMDBLogbook.php
CMDBLogbook.create
public function create($objectID, $message, $description = null) { $params = [ 'object_id' => $objectID, 'message' => $message ]; if (isset($description)) { $params['description'] = $description; } $result = $this->api->request( 'cmdb.logbook.create', $params ); if (!array_key_exists('success', $result) || $result['success'] !== true) { if (array_key_exists('message', $result)) { throw new RuntimeException(sprintf('Bad result: %s', $result['message'])); } else { throw new RuntimeException('Bad result'); } } return $this; }
php
public function create($objectID, $message, $description = null) { $params = [ 'object_id' => $objectID, 'message' => $message ]; if (isset($description)) { $params['description'] = $description; } $result = $this->api->request( 'cmdb.logbook.create', $params ); if (!array_key_exists('success', $result) || $result['success'] !== true) { if (array_key_exists('message', $result)) { throw new RuntimeException(sprintf('Bad result: %s', $result['message'])); } else { throw new RuntimeException('Bad result'); } } return $this; }
[ "public", "function", "create", "(", "$", "objectID", ",", "$", "message", ",", "$", "description", "=", "null", ")", "{", "$", "params", "=", "[", "'object_id'", "=>", "$", "objectID", ",", "'message'", "=>", "$", "message", "]", ";", "if", "(", "is...
Create a new logbook entry @param int $objectID Object identifier @param string $message Message @param string $description (optional) Description @return self Returns itself @throws Exception on error
[ "Create", "a", "new", "logbook", "entry" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBLogbook.php#L46-L71
44,630
bheisig/i-doit-api-client-php
src/CMDBLogbook.php
CMDBLogbook.batchCreate
public function batchCreate($objectID, array $messages) { $requests = []; foreach ($messages as $message) { $requests[] = [ 'method' => 'cmdb.logbook.create', 'params' => [ 'object_id' => $objectID, 'message' => $message ] ]; } $this->api->batchRequest($requests); return $this; }
php
public function batchCreate($objectID, array $messages) { $requests = []; foreach ($messages as $message) { $requests[] = [ 'method' => 'cmdb.logbook.create', 'params' => [ 'object_id' => $objectID, 'message' => $message ] ]; } $this->api->batchRequest($requests); return $this; }
[ "public", "function", "batchCreate", "(", "$", "objectID", ",", "array", "$", "messages", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "messages", "as", "$", "message", ")", "{", "$", "requests", "[", "]", "=", "[", "'method'",...
Create one or more logbook entries for a specific object @param int $objectID Object identifier @param array $messages List of messages as strings @return self Returns itself @throws Exception on error
[ "Create", "one", "or", "more", "logbook", "entries", "for", "a", "specific", "object" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBLogbook.php#L83-L99
44,631
bheisig/i-doit-api-client-php
src/CMDBLogbook.php
CMDBLogbook.read
public function read($since = null, $limit = 1000) { $params = [ 'limit' => $limit ]; if (isset($since)) { $params['since'] = $since; } return $this->api->request( 'cmdb.logbook.read', $params ); }
php
public function read($since = null, $limit = 1000) { $params = [ 'limit' => $limit ]; if (isset($since)) { $params['since'] = $since; } return $this->api->request( 'cmdb.logbook.read', $params ); }
[ "public", "function", "read", "(", "$", "since", "=", "null", ",", "$", "limit", "=", "1000", ")", "{", "$", "params", "=", "[", "'limit'", "=>", "$", "limit", "]", ";", "if", "(", "isset", "(", "$", "since", ")", ")", "{", "$", "params", "[", ...
Fetch all logbook entries @param string $since Optional list only entries since a specific date; supports everything which can be parsed by strtotime() @param int $limit Limit number of entries; defaults to 1000 @return array Indexed array of associative arrays @throws Exception on error
[ "Fetch", "all", "logbook", "entries" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBLogbook.php#L112-L125
44,632
bheisig/i-doit-api-client-php
src/CMDBLogbook.php
CMDBLogbook.readByObject
public function readByObject($objectID, $since = null, $limit = 1000) { $params = [ 'object_id' => $objectID, 'limit' => $limit ]; if (isset($since)) { $params['since'] = $since; } return $this->api->request( 'cmdb.logbook.read', $params ); }
php
public function readByObject($objectID, $since = null, $limit = 1000) { $params = [ 'object_id' => $objectID, 'limit' => $limit ]; if (isset($since)) { $params['since'] = $since; } return $this->api->request( 'cmdb.logbook.read', $params ); }
[ "public", "function", "readByObject", "(", "$", "objectID", ",", "$", "since", "=", "null", ",", "$", "limit", "=", "1000", ")", "{", "$", "params", "=", "[", "'object_id'", "=>", "$", "objectID", ",", "'limit'", "=>", "$", "limit", "]", ";", "if", ...
Fetch all logbook entries for a specific object @param int $objectID Object identifier @param string $since Optional list only entries since a specific date; supports everything which can be parsed by strtotime() @param int $limit Limit number of entries; defaults to 1000 @return array Indexed array of associative arrays @throws Exception on error
[ "Fetch", "all", "logbook", "entries", "for", "a", "specific", "object" ]
931ac20cfbe07fa330766d4516018bf7bc926efd
https://github.com/bheisig/i-doit-api-client-php/blob/931ac20cfbe07fa330766d4516018bf7bc926efd/src/CMDBLogbook.php#L139-L153
44,633
mhirdes/go_maps_ext
Classes/Domain/Model/Map.php
Map.getTravelModes
public function getTravelModes() { $travelModes = []; for ($i = 0; $i <= 4; $i++) { $travelModes[$i] = LocalizationUtility::translate( 'tx_gomapsext_domain_model_map.travel_mode.' . $i, 'go_maps_ext' ); } return $travelModes; }
php
public function getTravelModes() { $travelModes = []; for ($i = 0; $i <= 4; $i++) { $travelModes[$i] = LocalizationUtility::translate( 'tx_gomapsext_domain_model_map.travel_mode.' . $i, 'go_maps_ext' ); } return $travelModes; }
[ "public", "function", "getTravelModes", "(", ")", "{", "$", "travelModes", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<=", "4", ";", "$", "i", "++", ")", "{", "$", "travelModes", "[", "$", "i", "]", "=", "LocalizationUt...
Returns the travelModes @return \array $travelModes
[ "Returns", "the", "travelModes" ]
fc464d2ec4838add7748b4273e7f8b2a458aad79
https://github.com/mhirdes/go_maps_ext/blob/fc464d2ec4838add7748b4273e7f8b2a458aad79/Classes/Domain/Model/Map.php#L1208-L1219
44,634
mhirdes/go_maps_ext
Classes/Domain/Model/Map.php
Map.getUnitSystems
public function getUnitSystems() { for ($i = 2; $i <= 3; $i++) { $unitSystems[$i] = LocalizationUtility::translate( 'tx_gomapsext_domain_model_map.unit_system.' . $i, 'go_maps_ext' ); } return $unitSystems; }
php
public function getUnitSystems() { for ($i = 2; $i <= 3; $i++) { $unitSystems[$i] = LocalizationUtility::translate( 'tx_gomapsext_domain_model_map.unit_system.' . $i, 'go_maps_ext' ); } return $unitSystems; }
[ "public", "function", "getUnitSystems", "(", ")", "{", "for", "(", "$", "i", "=", "2", ";", "$", "i", "<=", "3", ";", "$", "i", "++", ")", "{", "$", "unitSystems", "[", "$", "i", "]", "=", "LocalizationUtility", "::", "translate", "(", "'tx_gomapse...
Returns the unitSystems @return \array $unitSystems
[ "Returns", "the", "unitSystems" ]
fc464d2ec4838add7748b4273e7f8b2a458aad79
https://github.com/mhirdes/go_maps_ext/blob/fc464d2ec4838add7748b4273e7f8b2a458aad79/Classes/Domain/Model/Map.php#L1226-L1236
44,635
mhirdes/go_maps_ext
Classes/Domain/Model/Address.php
Address.initStorageObjects
protected function initStorageObjects() { /** * Do not modify this method! * It will be rewritten on each save in the extension builder * You may modify the constructor of this class instead */ $this->infoWindowImages = new ObjectStorage(); $this->categories = new ObjectStorage(); $this->map = new ObjectStorage(); }
php
protected function initStorageObjects() { /** * Do not modify this method! * It will be rewritten on each save in the extension builder * You may modify the constructor of this class instead */ $this->infoWindowImages = new ObjectStorage(); $this->categories = new ObjectStorage(); $this->map = new ObjectStorage(); }
[ "protected", "function", "initStorageObjects", "(", ")", "{", "/**\n * Do not modify this method!\n * It will be rewritten on each save in the extension builder\n * You may modify the constructor of this class instead\n */", "$", "this", "->", "infoWindowImages", ...
Initializes all \TYPO3\CMS\Extbase\Persistence\ObjectStorage properties. @return void
[ "Initializes", "all", "\\", "TYPO3", "\\", "CMS", "\\", "Extbase", "\\", "Persistence", "\\", "ObjectStorage", "properties", "." ]
fc464d2ec4838add7748b4273e7f8b2a458aad79
https://github.com/mhirdes/go_maps_ext/blob/fc464d2ec4838add7748b4273e7f8b2a458aad79/Classes/Domain/Model/Address.php#L180-L190
44,636
mhirdes/go_maps_ext
Classes/Domain/Repository/AddressRepository.php
AddressRepository.findAllAddresses
public function findAllAddresses(Map $map, $pid) { $query = $this->createQuery(); $query->getQuerySettings()->setRespectStoragePage(false); $query->getQuerySettings()->setRespectSysLanguage(false); $or = []; $and = []; foreach (explode(',', $pid) as $p) { $or[] = $query->equals('pid', $p); } if ($map) { $or[] = $query->contains('map', $map); } $and[] = $query->logicalOr($or); return $query->matching( $query->logicalAnd( $and ) ) ->execute(); }
php
public function findAllAddresses(Map $map, $pid) { $query = $this->createQuery(); $query->getQuerySettings()->setRespectStoragePage(false); $query->getQuerySettings()->setRespectSysLanguage(false); $or = []; $and = []; foreach (explode(',', $pid) as $p) { $or[] = $query->equals('pid', $p); } if ($map) { $or[] = $query->contains('map', $map); } $and[] = $query->logicalOr($or); return $query->matching( $query->logicalAnd( $and ) ) ->execute(); }
[ "public", "function", "findAllAddresses", "(", "Map", "$", "map", ",", "$", "pid", ")", "{", "$", "query", "=", "$", "this", "->", "createQuery", "(", ")", ";", "$", "query", "->", "getQuerySettings", "(", ")", "->", "setRespectStoragePage", "(", "false"...
Finds all addresses by the specified map or the storage pid @param \Clickstorm\GoMapsExt\Domain\Model\Map $map The map @param int $pid The Storage Pid @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface The addresses @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
[ "Finds", "all", "addresses", "by", "the", "specified", "map", "or", "the", "storage", "pid" ]
fc464d2ec4838add7748b4273e7f8b2a458aad79
https://github.com/mhirdes/go_maps_ext/blob/fc464d2ec4838add7748b4273e7f8b2a458aad79/Classes/Domain/Repository/AddressRepository.php#L47-L70
44,637
zencoder/zencoder-php
Services/Zencoder/Jobs.php
Services_Zencoder_Jobs.index
public function index($args = array(), $params = array()) { $jobs = $this->proxy->retrieveData("jobs.json", $args, $params); $results = array(); foreach($jobs as $job) $results[] = new Services_Zencoder_Job($job); return $results; }
php
public function index($args = array(), $params = array()) { $jobs = $this->proxy->retrieveData("jobs.json", $args, $params); $results = array(); foreach($jobs as $job) $results[] = new Services_Zencoder_Job($job); return $results; }
[ "public", "function", "index", "(", "$", "args", "=", "array", "(", ")", ",", "$", "params", "=", "array", "(", ")", ")", "{", "$", "jobs", "=", "$", "this", "->", "proxy", "->", "retrieveData", "(", "\"jobs.json\"", ",", "$", "args", ",", "$", "...
List all jobs on your account @param array $args Array of filters to use when loading index @param array $params Optional overrides @return array An array of Services_Zencoder_Job objects
[ "List", "all", "jobs", "on", "your", "account" ]
a945431352da25357dc3f82b0dc13625a142d2e1
https://github.com/zencoder/zencoder-php/blob/a945431352da25357dc3f82b0dc13625a142d2e1/Services/Zencoder/Jobs.php#L47-L52
44,638
zencoder/zencoder-php
Services/Zencoder/Accounts.php
Services_Zencoder_Accounts.create
public function create($account = NULL, $params = array()) { if(is_string($account)) { $json = trim($account); } else if(is_array($account)) { $json = json_encode($account); } else { throw new Services_Zencoder_Exception( 'Account parameters required to create account.'); } return new Services_Zencoder_Account($this->proxy->createData("account", $json, $params)); }
php
public function create($account = NULL, $params = array()) { if(is_string($account)) { $json = trim($account); } else if(is_array($account)) { $json = json_encode($account); } else { throw new Services_Zencoder_Exception( 'Account parameters required to create account.'); } return new Services_Zencoder_Account($this->proxy->createData("account", $json, $params)); }
[ "public", "function", "create", "(", "$", "account", "=", "NULL", ",", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "is_string", "(", "$", "account", ")", ")", "{", "$", "json", "=", "trim", "(", "$", "account", ")", ";", "}", "e...
Create a Zencoder account @param array $account Array of attributes to use when creating the account @param array $params Optional overrides @return Services_Zencoder_Account The object representation of the resource
[ "Create", "a", "Zencoder", "account" ]
a945431352da25357dc3f82b0dc13625a142d2e1
https://github.com/zencoder/zencoder-php/blob/a945431352da25357dc3f82b0dc13625a142d2e1/Services/Zencoder/Accounts.php#L23-L33
44,639
zencoder/zencoder-php
Services/Zencoder/Notifications.php
Services_Zencoder_Notifications.parseIncoming
public function parseIncoming() { $incoming_data = json_decode(trim(file_get_contents('php://input'))); if (!$incoming_data) { throw new Services_Zencoder_Exception( 'Unable to parse notification data: ' . file_get_contents('php://input')); } return new Services_Zencoder_Notification($incoming_data); }
php
public function parseIncoming() { $incoming_data = json_decode(trim(file_get_contents('php://input'))); if (!$incoming_data) { throw new Services_Zencoder_Exception( 'Unable to parse notification data: ' . file_get_contents('php://input')); } return new Services_Zencoder_Notification($incoming_data); }
[ "public", "function", "parseIncoming", "(", ")", "{", "$", "incoming_data", "=", "json_decode", "(", "trim", "(", "file_get_contents", "(", "'php://input'", ")", ")", ")", ";", "if", "(", "!", "$", "incoming_data", ")", "{", "throw", "new", "Services_Zencode...
Parse and process incoming notifications from Zencoder @return Services_Zencoder_Notification Parsed notification data
[ "Parse", "and", "process", "incoming", "notifications", "from", "Zencoder" ]
a945431352da25357dc3f82b0dc13625a142d2e1
https://github.com/zencoder/zencoder-php/blob/a945431352da25357dc3f82b0dc13625a142d2e1/Services/Zencoder/Notifications.php#L20-L28
44,640
zencoder/zencoder-php
Services/Zencoder.php
Services_Zencoder.retrieveData
public function retrieveData($path, array $params = array(), array $opts = array()) { return empty($params) ? $this->_processResponse($this->http->get($this->_getApiPath($opts) . $path)) : $this->_processResponse( $this->http->get($this->_getApiPath($opts) . $path . "?" . http_build_query($params, '', '&')) ); }
php
public function retrieveData($path, array $params = array(), array $opts = array()) { return empty($params) ? $this->_processResponse($this->http->get($this->_getApiPath($opts) . $path)) : $this->_processResponse( $this->http->get($this->_getApiPath($opts) . $path . "?" . http_build_query($params, '', '&')) ); }
[ "public", "function", "retrieveData", "(", "$", "path", ",", "array", "$", "params", "=", "array", "(", ")", ",", "array", "$", "opts", "=", "array", "(", ")", ")", "{", "return", "empty", "(", "$", "params", ")", "?", "$", "this", "->", "_processR...
GET the resource at the specified path. @param string $path Path to the resource @param array $params Query string parameters @param array $opts Optional overrides @return object The object representation of the resource
[ "GET", "the", "resource", "at", "the", "specified", "path", "." ]
a945431352da25357dc3f82b0dc13625a142d2e1
https://github.com/zencoder/zencoder-php/blob/a945431352da25357dc3f82b0dc13625a142d2e1/Services/Zencoder.php#L149-L156
44,641
zencoder/zencoder-php
Services/Zencoder.php
Services_Zencoder.deleteData
public function deleteData($path, array $opts = array()) { return $this->_processResponse($this->http->delete($this->_getApiPath($opts) . $path)); }
php
public function deleteData($path, array $opts = array()) { return $this->_processResponse($this->http->delete($this->_getApiPath($opts) . $path)); }
[ "public", "function", "deleteData", "(", "$", "path", ",", "array", "$", "opts", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "_processResponse", "(", "$", "this", "->", "http", "->", "delete", "(", "$", "this", "->", "_getApiPath", ...
DELETE the resource at the specified path. @param string $path Path to the resource @param array $opts Optional overrides @return object The object representation of the resource
[ "DELETE", "the", "resource", "at", "the", "specified", "path", "." ]
a945431352da25357dc3f82b0dc13625a142d2e1
https://github.com/zencoder/zencoder-php/blob/a945431352da25357dc3f82b0dc13625a142d2e1/Services/Zencoder.php#L166-L169
44,642
zencoder/zencoder-php
Services/Zencoder.php
Services_Zencoder.createData
public function createData($path, $body = "", array $opts = array()) { $headers = array('Content-Type' => 'application/json'); return empty($body) ? $this->_processResponse($this->http->post($this->_getApiPath($opts) . $path, $headers)) : $this->_processResponse( $this->http->post( $this->_getApiPath($opts) . $path, $headers, $body ) ); }
php
public function createData($path, $body = "", array $opts = array()) { $headers = array('Content-Type' => 'application/json'); return empty($body) ? $this->_processResponse($this->http->post($this->_getApiPath($opts) . $path, $headers)) : $this->_processResponse( $this->http->post( $this->_getApiPath($opts) . $path, $headers, $body ) ); }
[ "public", "function", "createData", "(", "$", "path", ",", "$", "body", "=", "\"\"", ",", "array", "$", "opts", "=", "array", "(", ")", ")", "{", "$", "headers", "=", "array", "(", "'Content-Type'", "=>", "'application/json'", ")", ";", "return", "empt...
POST to the resource at the specified path. @param string $path Path to the resource @param string $body Raw body to post @param array $opts Optional overrides @return object The object representation of the resource
[ "POST", "to", "the", "resource", "at", "the", "specified", "path", "." ]
a945431352da25357dc3f82b0dc13625a142d2e1
https://github.com/zencoder/zencoder-php/blob/a945431352da25357dc3f82b0dc13625a142d2e1/Services/Zencoder.php#L180-L192
44,643
zencoder/zencoder-php
Services/Zencoder.php
Services_Zencoder.updateData
public function updateData($path, $body = "", array $opts = array()) { $headers = array('Content-Type' => 'application/json'); return empty($params) ? $this->_processResponse($this->http->put($this->_getApiPath($opts) . $path, $headers)) : $this->_processResponse( $this->http->put( $this->_getApiPath($opts) . $path, $headers, $body ) ); }
php
public function updateData($path, $body = "", array $opts = array()) { $headers = array('Content-Type' => 'application/json'); return empty($params) ? $this->_processResponse($this->http->put($this->_getApiPath($opts) . $path, $headers)) : $this->_processResponse( $this->http->put( $this->_getApiPath($opts) . $path, $headers, $body ) ); }
[ "public", "function", "updateData", "(", "$", "path", ",", "$", "body", "=", "\"\"", ",", "array", "$", "opts", "=", "array", "(", ")", ")", "{", "$", "headers", "=", "array", "(", "'Content-Type'", "=>", "'application/json'", ")", ";", "return", "empt...
PUT to the resource at the specified path. @param string $path Path to the resource @param string $body Raw body to post @param array $opts Optional overrides @return object The object representation of the resource
[ "PUT", "to", "the", "resource", "at", "the", "specified", "path", "." ]
a945431352da25357dc3f82b0dc13625a142d2e1
https://github.com/zencoder/zencoder-php/blob/a945431352da25357dc3f82b0dc13625a142d2e1/Services/Zencoder.php#L203-L215
44,644
Codeception/base
src/Codeception/Module/XMLRPC.php
XMLRPC.seeResponseCodeIs
public function seeResponseCodeIs($num) { \PHPUnit\Framework\Assert::assertEquals($num, $this->client->getInternalResponse()->getStatus()); }
php
public function seeResponseCodeIs($num) { \PHPUnit\Framework\Assert::assertEquals($num, $this->client->getInternalResponse()->getStatus()); }
[ "public", "function", "seeResponseCodeIs", "(", "$", "num", ")", "{", "\\", "PHPUnit", "\\", "Framework", "\\", "Assert", "::", "assertEquals", "(", "$", "num", ",", "$", "this", "->", "client", "->", "getInternalResponse", "(", ")", "->", "getStatus", "("...
Checks response code. @param $num
[ "Checks", "response", "code", "." ]
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Module/XMLRPC.php#L119-L122
44,645
Codeception/base
src/Codeception/Module/XMLRPC.php
XMLRPC.seeResponseIsXMLRPC
public function seeResponseIsXMLRPC() { $result = xmlrpc_decode($this->response); \PHPUnit\Framework\Assert::assertNotNull($result, 'Invalid response document returned from XmlRpc server'); }
php
public function seeResponseIsXMLRPC() { $result = xmlrpc_decode($this->response); \PHPUnit\Framework\Assert::assertNotNull($result, 'Invalid response document returned from XmlRpc server'); }
[ "public", "function", "seeResponseIsXMLRPC", "(", ")", "{", "$", "result", "=", "xmlrpc_decode", "(", "$", "this", "->", "response", ")", ";", "\\", "PHPUnit", "\\", "Framework", "\\", "Assert", "::", "assertNotNull", "(", "$", "result", ",", "'Invalid respo...
Checks weather last response was valid XMLRPC. This is done with xmlrpc_decode function.
[ "Checks", "weather", "last", "response", "was", "valid", "XMLRPC", ".", "This", "is", "done", "with", "xmlrpc_decode", "function", "." ]
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Module/XMLRPC.php#L129-L133
44,646
Codeception/base
src/Codeception/Module/XMLRPC.php
XMLRPC.sendXMLRPCMethodCall
public function sendXMLRPCMethodCall($methodName, $parameters = []) { if (!array_key_exists('Content-Type', $this->headers)) { $this->headers['Content-Type'] = 'text/xml'; } foreach ($this->headers as $header => $val) { $this->client->setServerParameter("HTTP_$header", $val); } $url = $this->config['url']; if (is_array($parameters)) { $parameters = $this->scalarizeArray($parameters); } $requestBody = xmlrpc_encode_request($methodName, array_values($parameters)); $this->debugSection('Request', $url . PHP_EOL . $requestBody); $this->client->request('POST', $url, [], [], [], $requestBody); $this->response = $this->client->getInternalResponse()->getContent(); $this->debugSection('Response', $this->response); }
php
public function sendXMLRPCMethodCall($methodName, $parameters = []) { if (!array_key_exists('Content-Type', $this->headers)) { $this->headers['Content-Type'] = 'text/xml'; } foreach ($this->headers as $header => $val) { $this->client->setServerParameter("HTTP_$header", $val); } $url = $this->config['url']; if (is_array($parameters)) { $parameters = $this->scalarizeArray($parameters); } $requestBody = xmlrpc_encode_request($methodName, array_values($parameters)); $this->debugSection('Request', $url . PHP_EOL . $requestBody); $this->client->request('POST', $url, [], [], [], $requestBody); $this->response = $this->client->getInternalResponse()->getContent(); $this->debugSection('Response', $this->response); }
[ "public", "function", "sendXMLRPCMethodCall", "(", "$", "methodName", ",", "$", "parameters", "=", "[", "]", ")", "{", "if", "(", "!", "array_key_exists", "(", "'Content-Type'", ",", "$", "this", "->", "headers", ")", ")", "{", "$", "this", "->", "header...
Sends a XMLRPC method call to remote XMLRPC-server. @param string $methodName @param array $parameters
[ "Sends", "a", "XMLRPC", "method", "call", "to", "remote", "XMLRPC", "-", "server", "." ]
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Module/XMLRPC.php#L141-L164
44,647
Codeception/base
src/Codeception/Lib/InnerBrowser.php
InnerBrowser.clickButton
private function clickButton(\DOMNode $node) { $formParams = []; $buttonName = (string)$node->getAttribute('name'); $buttonValue = $node->getAttribute('value'); if ($buttonName !== '' && $buttonValue !== null) { $formParams = [$buttonName => $buttonValue]; } while ($node->parentNode !== null) { $node = $node->parentNode; if (!isset($node->tagName)) { // this is the top most node, it has no parent either break; } if ($node->tagName === 'a') { $this->openHrefFromDomNode($node); return true; } elseif ($node->tagName === 'form') { $this->proceedSubmitForm( new Crawler($node, $this->getAbsoluteUrlFor($this->_getCurrentUri()), $this->getBaseUrl()), $formParams ); return true; } } codecept_debug('Button is not inside a link or a form'); return false; }
php
private function clickButton(\DOMNode $node) { $formParams = []; $buttonName = (string)$node->getAttribute('name'); $buttonValue = $node->getAttribute('value'); if ($buttonName !== '' && $buttonValue !== null) { $formParams = [$buttonName => $buttonValue]; } while ($node->parentNode !== null) { $node = $node->parentNode; if (!isset($node->tagName)) { // this is the top most node, it has no parent either break; } if ($node->tagName === 'a') { $this->openHrefFromDomNode($node); return true; } elseif ($node->tagName === 'form') { $this->proceedSubmitForm( new Crawler($node, $this->getAbsoluteUrlFor($this->_getCurrentUri()), $this->getBaseUrl()), $formParams ); return true; } } codecept_debug('Button is not inside a link or a form'); return false; }
[ "private", "function", "clickButton", "(", "\\", "DOMNode", "$", "node", ")", "{", "$", "formParams", "=", "[", "]", ";", "$", "buttonName", "=", "(", "string", ")", "$", "node", "->", "getAttribute", "(", "'name'", ")", ";", "$", "buttonValue", "=", ...
Clicks the link or submits the form when the button is clicked @param \DOMNode $node @return boolean clicked something
[ "Clicks", "the", "link", "or", "submits", "the", "form", "when", "the", "button", "is", "clicked" ]
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Lib/InnerBrowser.php#L421-L450
44,648
Codeception/base
src/Codeception/Module/Phalcon.php
Phalcon.haveServiceInDi
public function haveServiceInDi($name, $definition, $shared = false) { return $this->addServiceToContainer($name, $definition, $shared); }
php
public function haveServiceInDi($name, $definition, $shared = false) { return $this->addServiceToContainer($name, $definition, $shared); }
[ "public", "function", "haveServiceInDi", "(", "$", "name", ",", "$", "definition", ",", "$", "shared", "=", "false", ")", "{", "return", "$", "this", "->", "addServiceToContainer", "(", "$", "name", ",", "$", "definition", ",", "$", "shared", ")", ";", ...
Alias for `addServiceToContainer`. Note: Deprecated. Will be removed in Codeception 2.3. @param string $name @param mixed $definition @param boolean $shared @return mixed|null @part services
[ "Alias", "for", "addServiceToContainer", "." ]
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Module/Phalcon.php#L498-L501
44,649
Codeception/base
src/Codeception/Lib/Connector/ZF1.php
ZF1.formatResponseHeaders
private function formatResponseHeaders(\Zend_Controller_Response_Abstract $response) { $headers = []; foreach ($response->getHeaders() as $header) { $name = $header['name']; if (array_key_exists($name, $headers)) { if ($header['replace']) { $headers[$name] = $header['value']; } } else { $headers[$name] = $header['value']; } } return $headers; }
php
private function formatResponseHeaders(\Zend_Controller_Response_Abstract $response) { $headers = []; foreach ($response->getHeaders() as $header) { $name = $header['name']; if (array_key_exists($name, $headers)) { if ($header['replace']) { $headers[$name] = $header['value']; } } else { $headers[$name] = $header['value']; } } return $headers; }
[ "private", "function", "formatResponseHeaders", "(", "\\", "Zend_Controller_Response_Abstract", "$", "response", ")", "{", "$", "headers", "=", "[", "]", ";", "foreach", "(", "$", "response", "->", "getHeaders", "(", ")", "as", "$", "header", ")", "{", "$", ...
Format up the ZF1 response headers into Symfony\Component\BrowserKit\Response headers format. @param \Zend_Controller_Response_Abstract $response The ZF1 Response Object. @return array the clean key/value headers
[ "Format", "up", "the", "ZF1", "response", "headers", "into", "Symfony", "\\", "Component", "\\", "BrowserKit", "\\", "Response", "headers", "format", "." ]
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Lib/Connector/ZF1.php#L103-L117
44,650
Codeception/base
src/Codeception/Module/Yii1.php
Yii1.getDomainRegex
private function getDomainRegex($template, $parameters = []) { if ($host = parse_url($template, PHP_URL_HOST)) { $template = $host; } if (strpos($template, '<') !== false) { $template = str_replace(['<', '>'], '#', $template); } $template = preg_quote($template); foreach ($parameters as $name => $value) { $template = str_replace("#$name#", $value, $template); } return '/^' . $template . '$/u'; }
php
private function getDomainRegex($template, $parameters = []) { if ($host = parse_url($template, PHP_URL_HOST)) { $template = $host; } if (strpos($template, '<') !== false) { $template = str_replace(['<', '>'], '#', $template); } $template = preg_quote($template); foreach ($parameters as $name => $value) { $template = str_replace("#$name#", $value, $template); } return '/^' . $template . '$/u'; }
[ "private", "function", "getDomainRegex", "(", "$", "template", ",", "$", "parameters", "=", "[", "]", ")", "{", "if", "(", "$", "host", "=", "parse_url", "(", "$", "template", ",", "PHP_URL_HOST", ")", ")", "{", "$", "template", "=", "$", "host", ";"...
Getting domain regex from rule template and parameters @param string $template @param array $parameters @return string
[ "Getting", "domain", "regex", "from", "rule", "template", "and", "parameters" ]
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Module/Yii1.php#L225-L238
44,651
Codeception/base
src/Codeception/Module/Yii1.php
Yii1.getInternalDomains
public function getInternalDomains() { $domains = [$this->getDomainRegex(Yii::app()->request->getHostInfo())]; if (Yii::app()->urlManager->urlFormat === 'path') { $parent = Yii::app()->urlManager instanceof \CUrlManager ? '\CUrlManager' : null; $rules = ReflectionHelper::readPrivateProperty(Yii::app()->urlManager, '_rules', $parent); foreach ($rules as $rule) { if ($rule->hasHostInfo === true) { $domains[] = $this->getDomainRegex($rule->template, $rule->params); } } } return array_unique($domains); }
php
public function getInternalDomains() { $domains = [$this->getDomainRegex(Yii::app()->request->getHostInfo())]; if (Yii::app()->urlManager->urlFormat === 'path') { $parent = Yii::app()->urlManager instanceof \CUrlManager ? '\CUrlManager' : null; $rules = ReflectionHelper::readPrivateProperty(Yii::app()->urlManager, '_rules', $parent); foreach ($rules as $rule) { if ($rule->hasHostInfo === true) { $domains[] = $this->getDomainRegex($rule->template, $rule->params); } } } return array_unique($domains); }
[ "public", "function", "getInternalDomains", "(", ")", "{", "$", "domains", "=", "[", "$", "this", "->", "getDomainRegex", "(", "Yii", "::", "app", "(", ")", "->", "request", "->", "getHostInfo", "(", ")", ")", "]", ";", "if", "(", "Yii", "::", "app",...
Returns a list of regex patterns for recognized domain names @return array
[ "Returns", "a", "list", "of", "regex", "patterns", "for", "recognized", "domain", "names" ]
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Module/Yii1.php#L246-L259
44,652
Codeception/base
src/Codeception/Util/Debug.php
Debug.pause
public static function pause() { if (!self::$output) { return; } self::$output->writeln("<info>The execution has been paused. Press ENTER to continue</info>"); if (trim(fgets(STDIN)) != chr(13)) { return; } }
php
public static function pause() { if (!self::$output) { return; } self::$output->writeln("<info>The execution has been paused. Press ENTER to continue</info>"); if (trim(fgets(STDIN)) != chr(13)) { return; } }
[ "public", "static", "function", "pause", "(", ")", "{", "if", "(", "!", "self", "::", "$", "output", ")", "{", "return", ";", "}", "self", "::", "$", "output", "->", "writeln", "(", "\"<info>The execution has been paused. Press ENTER to continue</info>\"", ")", ...
Pauses execution and waits for user input to proceed.
[ "Pauses", "execution", "and", "waits", "for", "user", "input", "to", "proceed", "." ]
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Util/Debug.php#L42-L53
44,653
Codeception/base
src/Codeception/Module/Asserts.php
Asserts.assertEquals
public function assertEquals($expected, $actual, $message = '', $delta = 0.0) { parent::assertEquals($expected, $actual, $message, $delta); }
php
public function assertEquals($expected, $actual, $message = '', $delta = 0.0) { parent::assertEquals($expected, $actual, $message, $delta); }
[ "public", "function", "assertEquals", "(", "$", "expected", ",", "$", "actual", ",", "$", "message", "=", "''", ",", "$", "delta", "=", "0.0", ")", "{", "parent", "::", "assertEquals", "(", "$", "expected", ",", "$", "actual", ",", "$", "message", ",...
Checks that two variables are equal. If you're comparing floating-point values, you can specify the optional "delta" parameter which dictates how great of a precision error are you willing to tolerate in order to consider the two values equal. Regular example: ```php <?php $I->assertEquals(5, $element->getChildrenCount()); ``` Floating-point example: ```php <?php $I->assertEquals(0.3, $calculator->add(0.1, 0.2), 'Calculator should add the two numbers correctly.', 0.01); ``` @param $expected @param $actual @param string $message @param float $delta
[ "Checks", "that", "two", "variables", "are", "equal", ".", "If", "you", "re", "comparing", "floating", "-", "point", "values", "you", "can", "specify", "the", "optional", "delta", "parameter", "which", "dictates", "how", "great", "of", "a", "precision", "err...
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Module/Asserts.php#L34-L37
44,654
Codeception/base
src/Codeception/Module/Asserts.php
Asserts.assertNotEquals
public function assertNotEquals($expected, $actual, $message = '', $delta = 0.0) { parent::assertNotEquals($expected, $actual, $message, $delta); }
php
public function assertNotEquals($expected, $actual, $message = '', $delta = 0.0) { parent::assertNotEquals($expected, $actual, $message, $delta); }
[ "public", "function", "assertNotEquals", "(", "$", "expected", ",", "$", "actual", ",", "$", "message", "=", "''", ",", "$", "delta", "=", "0.0", ")", "{", "parent", "::", "assertNotEquals", "(", "$", "expected", ",", "$", "actual", ",", "$", "message"...
Checks that two variables are not equal. If you're comparing floating-point values, you can specify the optional "delta" parameter which dictates how great of a precision error are you willing to tolerate in order to consider the two values not equal. Regular example: ```php <?php $I->assertNotEquals(0, $element->getChildrenCount()); ``` Floating-point example: ```php <?php $I->assertNotEquals(0.4, $calculator->add(0.1, 0.2), 'Calculator should add the two numbers correctly.', 0.01); ``` @param $expected @param $actual @param string $message @param float $delta
[ "Checks", "that", "two", "variables", "are", "not", "equal", ".", "If", "you", "re", "comparing", "floating", "-", "point", "values", "you", "can", "specify", "the", "optional", "delta", "parameter", "which", "dictates", "how", "great", "of", "a", "precision...
aace5bab5593c93d8473b620f70754135a1eb4f0
https://github.com/Codeception/base/blob/aace5bab5593c93d8473b620f70754135a1eb4f0/src/Codeception/Module/Asserts.php#L61-L64
44,655
fedemotta/yii2-aws-sdk
AwsSdk.php
AwsSdk.setAwsSdk
public function setAwsSdk() { $this->_awssdk = new Aws\Sdk(array_merge([ 'credentials' => $this->credentials, 'region'=>$this->region, 'version'=>$this->version ],$this->extra)); }
php
public function setAwsSdk() { $this->_awssdk = new Aws\Sdk(array_merge([ 'credentials' => $this->credentials, 'region'=>$this->region, 'version'=>$this->version ],$this->extra)); }
[ "public", "function", "setAwsSdk", "(", ")", "{", "$", "this", "->", "_awssdk", "=", "new", "Aws", "\\", "Sdk", "(", "array_merge", "(", "[", "'credentials'", "=>", "$", "this", "->", "credentials", ",", "'region'", "=>", "$", "this", "->", "region", "...
Sets the AWS SDK instance
[ "Sets", "the", "AWS", "SDK", "instance" ]
7ef80f53a048dff3d5a3e08f09071c09f5eb803a
https://github.com/fedemotta/yii2-aws-sdk/blob/7ef80f53a048dff3d5a3e08f09071c09f5eb803a/AwsSdk.php#L57-L64
44,656
silverstripe/recipe-plugin
src/RecipeInstaller.php
RecipeInstaller.installProjectFiles
protected function installProjectFiles( $recipe, $sourceRoot, $destinationRoot, $filePatterns, $registrationKey, $name = 'project' ) { // load composer json data $composerFile = new JsonFile(Factory::getComposerFile(), null, $this->io); $composerData = $composerFile->read(); $installedFiles = isset($composerData['extra'][$registrationKey]) ? $composerData['extra'][$registrationKey] : []; // Load all project files $fileIterator = $this->getFileIterator($sourceRoot, $filePatterns); $any = false; foreach ($fileIterator as $path => $info) { // Write header on first file if (!$any) { $this->io->write("Installing {$name} files for recipe <info>{$recipe}</info>:"); $any = true; } // Install this file $relativePath = $this->installProjectFile($sourceRoot, $destinationRoot, $path, $installedFiles); // Add file to installed (even if already exists) if (!in_array($relativePath, $installedFiles)) { $installedFiles[] = $relativePath; } } // If any files are written, modify composer.json with newly installed files if ($installedFiles) { sort($installedFiles); if (!isset($composerData['extra'])) { $composerData['extra'] = []; } $composerData['extra'][$registrationKey] = $installedFiles; $composerFile->write($composerData); } }
php
protected function installProjectFiles( $recipe, $sourceRoot, $destinationRoot, $filePatterns, $registrationKey, $name = 'project' ) { // load composer json data $composerFile = new JsonFile(Factory::getComposerFile(), null, $this->io); $composerData = $composerFile->read(); $installedFiles = isset($composerData['extra'][$registrationKey]) ? $composerData['extra'][$registrationKey] : []; // Load all project files $fileIterator = $this->getFileIterator($sourceRoot, $filePatterns); $any = false; foreach ($fileIterator as $path => $info) { // Write header on first file if (!$any) { $this->io->write("Installing {$name} files for recipe <info>{$recipe}</info>:"); $any = true; } // Install this file $relativePath = $this->installProjectFile($sourceRoot, $destinationRoot, $path, $installedFiles); // Add file to installed (even if already exists) if (!in_array($relativePath, $installedFiles)) { $installedFiles[] = $relativePath; } } // If any files are written, modify composer.json with newly installed files if ($installedFiles) { sort($installedFiles); if (!isset($composerData['extra'])) { $composerData['extra'] = []; } $composerData['extra'][$registrationKey] = $installedFiles; $composerFile->write($composerData); } }
[ "protected", "function", "installProjectFiles", "(", "$", "recipe", ",", "$", "sourceRoot", ",", "$", "destinationRoot", ",", "$", "filePatterns", ",", "$", "registrationKey", ",", "$", "name", "=", "'project'", ")", "{", "// load composer json data", "$", "comp...
Install project files in the specified directory @param string $recipe Recipe name @param string $sourceRoot Base of source files (no trailing slash) @param string $destinationRoot Base of destination directory (no trailing slash) @param array $filePatterns List of file patterns in wildcard format (e.g. `code/My*.php`) @param string $registrationKey Registration key for installed files @param string $name Name of project file type being installed
[ "Install", "project", "files", "in", "the", "specified", "directory" ]
88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e
https://github.com/silverstripe/recipe-plugin/blob/88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e/src/RecipeInstaller.php#L35-L78
44,657
silverstripe/recipe-plugin
src/RecipeInstaller.php
RecipeInstaller.getFileIterator
protected function getFileIterator($sourceRoot, $patterns) { // Build regexp pattern $expressions = []; foreach ($patterns as $pattern) { $expressions[] = $this->globToRegexp($pattern); } $regExp = '#^' . $this->globToRegexp($sourceRoot . '/').'(('.implode(')|(', $expressions).'))$#'; // Build directory iterator $directoryIterator = new RecursiveDirectoryIterator( $sourceRoot, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS | FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO ); // Return filtered iterator $iterator = new RecursiveIteratorIterator($directoryIterator); return new RegexIterator($iterator, $regExp); }
php
protected function getFileIterator($sourceRoot, $patterns) { // Build regexp pattern $expressions = []; foreach ($patterns as $pattern) { $expressions[] = $this->globToRegexp($pattern); } $regExp = '#^' . $this->globToRegexp($sourceRoot . '/').'(('.implode(')|(', $expressions).'))$#'; // Build directory iterator $directoryIterator = new RecursiveDirectoryIterator( $sourceRoot, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS | FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO ); // Return filtered iterator $iterator = new RecursiveIteratorIterator($directoryIterator); return new RegexIterator($iterator, $regExp); }
[ "protected", "function", "getFileIterator", "(", "$", "sourceRoot", ",", "$", "patterns", ")", "{", "// Build regexp pattern", "$", "expressions", "=", "[", "]", ";", "foreach", "(", "$", "patterns", "as", "$", "pattern", ")", "{", "$", "expressions", "[", ...
Get iterator of matching source files to copy @param string $sourceRoot Root directory of sources (no trailing slash) @param array $patterns List of wildcard patterns to match @return Iterator File iterator, where key is path and value is file info object
[ "Get", "iterator", "of", "matching", "source", "files", "to", "copy" ]
88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e
https://github.com/silverstripe/recipe-plugin/blob/88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e/src/RecipeInstaller.php#L127-L148
44,658
silverstripe/recipe-plugin
src/RecipeInstaller.php
RecipeInstaller.globToRegexp
protected function globToRegexp($glob) { $sourceParts = explode('*', $glob); $regexParts = array_map(function ($part) { return preg_quote($part, '#'); }, $sourceParts); return implode('(.+)', $regexParts); }
php
protected function globToRegexp($glob) { $sourceParts = explode('*', $glob); $regexParts = array_map(function ($part) { return preg_quote($part, '#'); }, $sourceParts); return implode('(.+)', $regexParts); }
[ "protected", "function", "globToRegexp", "(", "$", "glob", ")", "{", "$", "sourceParts", "=", "explode", "(", "'*'", ",", "$", "glob", ")", ";", "$", "regexParts", "=", "array_map", "(", "function", "(", "$", "part", ")", "{", "return", "preg_quote", "...
Convert glob pattern to regexp @param string $glob @return string
[ "Convert", "glob", "pattern", "to", "regexp" ]
88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e
https://github.com/silverstripe/recipe-plugin/blob/88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e/src/RecipeInstaller.php#L156-L163
44,659
silverstripe/recipe-plugin
src/RecipeCommandBehaviour.php
RecipeCommandBehaviour.updateProject
protected function updateProject(OutputInterface $output) { /** @var UpdateCommand $command */ $command = $this->getApplication()->find('update'); $arguments = [ 'command' => 'update' ]; $requireInput = new ArrayInput($arguments); $returnCode = $command->run($requireInput, $output); // Flush modified composer object $this->resetComposer(); return $returnCode; }
php
protected function updateProject(OutputInterface $output) { /** @var UpdateCommand $command */ $command = $this->getApplication()->find('update'); $arguments = [ 'command' => 'update' ]; $requireInput = new ArrayInput($arguments); $returnCode = $command->run($requireInput, $output); // Flush modified composer object $this->resetComposer(); return $returnCode; }
[ "protected", "function", "updateProject", "(", "OutputInterface", "$", "output", ")", "{", "/** @var UpdateCommand $command */", "$", "command", "=", "$", "this", "->", "getApplication", "(", ")", "->", "find", "(", "'update'", ")", ";", "$", "arguments", "=", ...
Update the project @param OutputInterface $output @return int
[ "Update", "the", "project" ]
88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e
https://github.com/silverstripe/recipe-plugin/blob/88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e/src/RecipeCommandBehaviour.php#L74-L85
44,660
silverstripe/recipe-plugin
src/RecipeCommandBehaviour.php
RecipeCommandBehaviour.findInstalledVersion
protected function findInstalledVersion($recipe) { // Check locker $installed = $this->getComposer()->getLocker()->getLockedRepository()->findPackage($recipe, '*'); if ($installed) { return $installed->getPrettyVersion(); } // Check provides $provides = $this->getComposer()->getPackage()->getProvides(); if (isset($provides[$recipe])) { return $provides[$recipe]->getPrettyConstraint(); } // Check requires $requires = $this->getComposer()->getPackage()->getRequires(); if (isset($requires[$recipe])) { return $requires[$recipe]->getPrettyConstraint(); } // No existing version return null; }
php
protected function findInstalledVersion($recipe) { // Check locker $installed = $this->getComposer()->getLocker()->getLockedRepository()->findPackage($recipe, '*'); if ($installed) { return $installed->getPrettyVersion(); } // Check provides $provides = $this->getComposer()->getPackage()->getProvides(); if (isset($provides[$recipe])) { return $provides[$recipe]->getPrettyConstraint(); } // Check requires $requires = $this->getComposer()->getPackage()->getRequires(); if (isset($requires[$recipe])) { return $requires[$recipe]->getPrettyConstraint(); } // No existing version return null; }
[ "protected", "function", "findInstalledVersion", "(", "$", "recipe", ")", "{", "// Check locker", "$", "installed", "=", "$", "this", "->", "getComposer", "(", ")", "->", "getLocker", "(", ")", "->", "getLockedRepository", "(", ")", "->", "findPackage", "(", ...
Find installed version or constraint @param string $recipe @return string
[ "Find", "installed", "version", "or", "constraint" ]
88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e
https://github.com/silverstripe/recipe-plugin/blob/88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e/src/RecipeCommandBehaviour.php#L93-L115
44,661
silverstripe/recipe-plugin
src/RecipeCommandBehaviour.php
RecipeCommandBehaviour.findBestConstraint
protected function findBestConstraint($existingVersion) { // Cannot guess without existing version if (!$existingVersion) { return null; } // Existing version is already a ^1.0.0 or ~1.0.0 constraint if (preg_match('#^[~^]#', $existingVersion)) { return $existingVersion; } // Existing version is already a dev constraint if (stristr($existingVersion, 'dev') !== false) { return $existingVersion; } // Numeric-only version maps to semver constraint if (preg_match('#^([\d.]+)$#', $existingVersion)) { return "^{$existingVersion}"; } // Cannot guess; Let composer choose (equivalent to `composer require vendor/library`) return null; }
php
protected function findBestConstraint($existingVersion) { // Cannot guess without existing version if (!$existingVersion) { return null; } // Existing version is already a ^1.0.0 or ~1.0.0 constraint if (preg_match('#^[~^]#', $existingVersion)) { return $existingVersion; } // Existing version is already a dev constraint if (stristr($existingVersion, 'dev') !== false) { return $existingVersion; } // Numeric-only version maps to semver constraint if (preg_match('#^([\d.]+)$#', $existingVersion)) { return "^{$existingVersion}"; } // Cannot guess; Let composer choose (equivalent to `composer require vendor/library`) return null; }
[ "protected", "function", "findBestConstraint", "(", "$", "existingVersion", ")", "{", "// Cannot guess without existing version", "if", "(", "!", "$", "existingVersion", ")", "{", "return", "null", ";", "}", "// Existing version is already a ^1.0.0 or ~1.0.0 constraint", "i...
Guess constraint to use if not provided @param string $existingVersion Known installed version @return string
[ "Guess", "constraint", "to", "use", "if", "not", "provided" ]
88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e
https://github.com/silverstripe/recipe-plugin/blob/88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e/src/RecipeCommandBehaviour.php#L123-L147
44,662
silverstripe/recipe-plugin
src/RecipeCommandBehaviour.php
RecipeCommandBehaviour.modifyComposer
protected function modifyComposer($callable) { // Begin modification of composer.json $composerFile = new JsonFile(Factory::getComposerFile(), null, $this->getIO()); $composerData = $composerFile->read(); // Note: Respect call by ref $composerData $result = $callable($composerData); if ($result === false) { return; } if ($result) { $composerData = $result; } // Update composer.json and refresh local composer instance $composerFile->write($composerData); $this->resetComposer(); }
php
protected function modifyComposer($callable) { // Begin modification of composer.json $composerFile = new JsonFile(Factory::getComposerFile(), null, $this->getIO()); $composerData = $composerFile->read(); // Note: Respect call by ref $composerData $result = $callable($composerData); if ($result === false) { return; } if ($result) { $composerData = $result; } // Update composer.json and refresh local composer instance $composerFile->write($composerData); $this->resetComposer(); }
[ "protected", "function", "modifyComposer", "(", "$", "callable", ")", "{", "// Begin modification of composer.json", "$", "composerFile", "=", "new", "JsonFile", "(", "Factory", "::", "getComposerFile", "(", ")", ",", "null", ",", "$", "this", "->", "getIO", "("...
callback to safely modify composer.json data @param callable $callable Callable which will safely take and return the composer data. This should return false if no content changed, or the updated data
[ "callback", "to", "safely", "modify", "composer", ".", "json", "data" ]
88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e
https://github.com/silverstripe/recipe-plugin/blob/88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e/src/RecipeCommandBehaviour.php#L273-L291
44,663
silverstripe/recipe-plugin
src/RecipePlugin.php
RecipePlugin.cleanupProject
public function cleanupProject(Event $event) { $file = new JsonFile(Factory::getComposerFile()); $data = $file->read(); // Remove project and public files from project unset($data['extra'][self::PROJECT_FILES]); unset($data['extra'][self::PUBLIC_FILES]); // Remove redundant empty extra if (empty($data['extra'])) { unset($data['extra']); } // Save back to composer.json $file->write($data); }
php
public function cleanupProject(Event $event) { $file = new JsonFile(Factory::getComposerFile()); $data = $file->read(); // Remove project and public files from project unset($data['extra'][self::PROJECT_FILES]); unset($data['extra'][self::PUBLIC_FILES]); // Remove redundant empty extra if (empty($data['extra'])) { unset($data['extra']); } // Save back to composer.json $file->write($data); }
[ "public", "function", "cleanupProject", "(", "Event", "$", "event", ")", "{", "$", "file", "=", "new", "JsonFile", "(", "Factory", "::", "getComposerFile", "(", ")", ")", ";", "$", "data", "=", "$", "file", "->", "read", "(", ")", ";", "// Remove proje...
Cleanup the root package on create-project @param Event $event
[ "Cleanup", "the", "root", "package", "on", "create", "-", "project" ]
88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e
https://github.com/silverstripe/recipe-plugin/blob/88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e/src/RecipePlugin.php#L94-L110
44,664
silverstripe/recipe-plugin
src/RecipePlugin.php
RecipePlugin.getOperationPackage
protected function getOperationPackage(PackageEvent $event) { $operation = $event->getOperation(); if ($operation instanceof UpdateOperation) { return $operation->getTargetPackage(); } if ($operation instanceof InstallOperation) { return $operation->getPackage(); } return null; }
php
protected function getOperationPackage(PackageEvent $event) { $operation = $event->getOperation(); if ($operation instanceof UpdateOperation) { return $operation->getTargetPackage(); } if ($operation instanceof InstallOperation) { return $operation->getPackage(); } return null; }
[ "protected", "function", "getOperationPackage", "(", "PackageEvent", "$", "event", ")", "{", "$", "operation", "=", "$", "event", "->", "getOperation", "(", ")", ";", "if", "(", "$", "operation", "instanceof", "UpdateOperation", ")", "{", "return", "$", "ope...
Get target package from operation @param PackageEvent $event @return PackageInterface
[ "Get", "target", "package", "from", "operation" ]
88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e
https://github.com/silverstripe/recipe-plugin/blob/88cd7ed3a0c07a0b24b70ee43d855488d7f1ac7e/src/RecipePlugin.php#L118-L128
44,665
eclipxe13/CfdiUtils
src/CfdiUtils/CfdiValidator33.php
CfdiValidator33.validate
public function validate(string $xmlString, NodeInterface $node): Asserts { if ('' === $xmlString) { throw new \UnexpectedValueException('The xml string to validate cannot be empty'); } $factory = new MultiValidatorFactory(); $validator = $factory->newReceived33(); $hydrater = new Hydrater(); $hydrater->setXmlString($xmlString); $hydrater->setXmlResolver(($this->hasXmlResolver()) ? $this->getXmlResolver() : null); $hydrater->setXsltBuilder($this->getXsltBuilder()); $validator->hydrate($hydrater); $asserts = new Asserts(); $validator->validate($node, $asserts); return $asserts; }
php
public function validate(string $xmlString, NodeInterface $node): Asserts { if ('' === $xmlString) { throw new \UnexpectedValueException('The xml string to validate cannot be empty'); } $factory = new MultiValidatorFactory(); $validator = $factory->newReceived33(); $hydrater = new Hydrater(); $hydrater->setXmlString($xmlString); $hydrater->setXmlResolver(($this->hasXmlResolver()) ? $this->getXmlResolver() : null); $hydrater->setXsltBuilder($this->getXsltBuilder()); $validator->hydrate($hydrater); $asserts = new Asserts(); $validator->validate($node, $asserts); return $asserts; }
[ "public", "function", "validate", "(", "string", "$", "xmlString", ",", "NodeInterface", "$", "node", ")", ":", "Asserts", "{", "if", "(", "''", "===", "$", "xmlString", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "'The xml string to valid...
Validate and return the asserts from the validation process. This method can use a xml string and a NodeInterface, is your responsability that the node is the representation of the content. @param string $xmlString @param NodeInterface $node @return Asserts|\CfdiUtils\Validate\Assert[]
[ "Validate", "and", "return", "the", "asserts", "from", "the", "validation", "process", ".", "This", "method", "can", "use", "a", "xml", "string", "and", "a", "NodeInterface", "is", "your", "responsability", "that", "the", "node", "is", "the", "representation",...
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/CfdiValidator33.php#L44-L63
44,666
eclipxe13/CfdiUtils
src/CfdiUtils/CfdiValidator33.php
CfdiValidator33.validateXml
public function validateXml(string $xmlString): Asserts { return $this->validate($xmlString, XmlNodeUtils::nodeFromXmlString($xmlString)); }
php
public function validateXml(string $xmlString): Asserts { return $this->validate($xmlString, XmlNodeUtils::nodeFromXmlString($xmlString)); }
[ "public", "function", "validateXml", "(", "string", "$", "xmlString", ")", ":", "Asserts", "{", "return", "$", "this", "->", "validate", "(", "$", "xmlString", ",", "XmlNodeUtils", "::", "nodeFromXmlString", "(", "$", "xmlString", ")", ")", ";", "}" ]
Validate and return the asserts from the validation process based on a xml string @param string $xmlString @return Asserts|\CfdiUtils\Validate\Assert[]
[ "Validate", "and", "return", "the", "asserts", "from", "the", "validation", "process", "based", "on", "a", "xml", "string" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/CfdiValidator33.php#L71-L74
44,667
eclipxe13/CfdiUtils
src/CfdiUtils/CfdiValidator33.php
CfdiValidator33.validateNode
public function validateNode(NodeInterface $node): Asserts { return $this->validate(XmlNodeUtils::nodeToXmlString($node), $node); }
php
public function validateNode(NodeInterface $node): Asserts { return $this->validate(XmlNodeUtils::nodeToXmlString($node), $node); }
[ "public", "function", "validateNode", "(", "NodeInterface", "$", "node", ")", ":", "Asserts", "{", "return", "$", "this", "->", "validate", "(", "XmlNodeUtils", "::", "nodeToXmlString", "(", "$", "node", ")", ",", "$", "node", ")", ";", "}" ]
Validate and return the asserts from the validation process based on a node interface object @param NodeInterface $node @return Asserts|\CfdiUtils\Validate\Assert[]
[ "Validate", "and", "return", "the", "asserts", "from", "the", "validation", "process", "based", "on", "a", "node", "interface", "object" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/CfdiValidator33.php#L82-L85
44,668
eclipxe13/CfdiUtils
src/CfdiUtils/PemPrivateKey/PemPrivateKey.php
PemPrivateKey.isPEM
public static function isPEM(string $keyContents): bool { if ('' === $keyContents) { return false; } $openSSL = new OpenSSL(); return $openSSL->readPemContents($keyContents)->hasPrivateKey(); }
php
public static function isPEM(string $keyContents): bool { if ('' === $keyContents) { return false; } $openSSL = new OpenSSL(); return $openSSL->readPemContents($keyContents)->hasPrivateKey(); }
[ "public", "static", "function", "isPEM", "(", "string", "$", "keyContents", ")", ":", "bool", "{", "if", "(", "''", "===", "$", "keyContents", ")", "{", "return", "false", ";", "}", "$", "openSSL", "=", "new", "OpenSSL", "(", ")", ";", "return", "$",...
Check if a string has an obvious signature of a PEM file @param string $keyContents @return bool @deprecated 2.9.0 Replaced with OpenSSL utility @see OpenSSL
[ "Check", "if", "a", "string", "has", "an", "obvious", "signature", "of", "a", "PEM", "file" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/PemPrivateKey/PemPrivateKey.php#L128-L136
44,669
eclipxe13/CfdiUtils
src/CfdiUtils/Cfdi.php
Cfdi.newFromString
public static function newFromString(string $content): self { $document = Xml::newDocumentContent($content); // populate source since it is already available // in this way we avoid the conversion from document to string $cfdi = new self($document); $cfdi->source = $content; return $cfdi; }
php
public static function newFromString(string $content): self { $document = Xml::newDocumentContent($content); // populate source since it is already available // in this way we avoid the conversion from document to string $cfdi = new self($document); $cfdi->source = $content; return $cfdi; }
[ "public", "static", "function", "newFromString", "(", "string", "$", "content", ")", ":", "self", "{", "$", "document", "=", "Xml", "::", "newDocumentContent", "(", "$", "content", ")", ";", "// populate source since it is already available", "// in this way we avoid ...
Create a Cfdi object from a xml string @param string $content @return static
[ "Create", "a", "Cfdi", "object", "from", "a", "xml", "string" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Cfdi.php#L71-L79
44,670
eclipxe13/CfdiUtils
src/CfdiUtils/Cfdi.php
Cfdi.getSource
public function getSource(): string { if (null === $this->source) { // pass the document element to avoid xml header $this->source = $this->document->saveXML($this->document->documentElement); } return $this->source; }
php
public function getSource(): string { if (null === $this->source) { // pass the document element to avoid xml header $this->source = $this->document->saveXML($this->document->documentElement); } return $this->source; }
[ "public", "function", "getSource", "(", ")", ":", "string", "{", "if", "(", "null", "===", "$", "this", "->", "source", ")", "{", "// pass the document element to avoid xml header", "$", "this", "->", "source", "=", "$", "this", "->", "document", "->", "save...
Get the xml string source
[ "Get", "the", "xml", "string", "source" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Cfdi.php#L102-L109
44,671
eclipxe13/CfdiUtils
src/CfdiUtils/Cfdi.php
Cfdi.getNode
public function getNode(): NodeInterface { if (null === $this->node) { $this->node = XmlNodeUtils::nodeFromXmlElement($this->document->documentElement); } return $this->node; }
php
public function getNode(): NodeInterface { if (null === $this->node) { $this->node = XmlNodeUtils::nodeFromXmlElement($this->document->documentElement); } return $this->node; }
[ "public", "function", "getNode", "(", ")", ":", "NodeInterface", "{", "if", "(", "null", "===", "$", "this", "->", "node", ")", "{", "$", "this", "->", "node", "=", "XmlNodeUtils", "::", "nodeFromXmlElement", "(", "$", "this", "->", "document", "->", "...
Get the node object to iterate in the CFDI
[ "Get", "the", "node", "object", "to", "iterate", "in", "the", "CFDI" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Cfdi.php#L114-L120
44,672
eclipxe13/CfdiUtils
src/CfdiUtils/Certificado/NodeCertificado.php
NodeCertificado.extract
public function extract(): string { $version = $this->getVersion(); if ('3.2' === $version) { $attr = 'certificado'; } elseif ('3.3' === $version) { $attr = 'Certificado'; } else { throw new \RuntimeException('Unsupported or unknown version'); } $certificateBase64 = $this->comprobante->searchAttribute($attr); if ('' === $certificateBase64) { return ''; } $certificateBin = (string) base64_decode($certificateBase64, true); if ('' === $certificateBin) { throw new \RuntimeException('The certificado attribute is not a valid base64 encoded string'); } return $certificateBin; }
php
public function extract(): string { $version = $this->getVersion(); if ('3.2' === $version) { $attr = 'certificado'; } elseif ('3.3' === $version) { $attr = 'Certificado'; } else { throw new \RuntimeException('Unsupported or unknown version'); } $certificateBase64 = $this->comprobante->searchAttribute($attr); if ('' === $certificateBase64) { return ''; } $certificateBin = (string) base64_decode($certificateBase64, true); if ('' === $certificateBin) { throw new \RuntimeException('The certificado attribute is not a valid base64 encoded string'); } return $certificateBin; }
[ "public", "function", "extract", "(", ")", ":", "string", "{", "$", "version", "=", "$", "this", "->", "getVersion", "(", ")", ";", "if", "(", "'3.2'", "===", "$", "version", ")", "{", "$", "attr", "=", "'certificado'", ";", "}", "elseif", "(", "'3...
Extract the certificate from Comprobante->certificado If the node does not exists return an empty string The returned string is no longer base64 encoded @return string @throws \RuntimeException if the certificado attribute is not a valid base64 encoded string
[ "Extract", "the", "certificate", "from", "Comprobante", "-", ">", "certificado", "If", "the", "node", "does", "not", "exists", "return", "an", "empty", "string", "The", "returned", "string", "is", "no", "longer", "base64", "encoded" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Certificado/NodeCertificado.php#L26-L47
44,673
eclipxe13/CfdiUtils
src/CfdiUtils/Certificado/NodeCertificado.php
NodeCertificado.save
public function save(string $filename) { if ('' === $filename) { throw new \UnexpectedValueException('The filename to store the certificate is empty'); } $certificado = $this->extract(); if ('' === $certificado) { throw new \RuntimeException('The certificado attribute is empty'); } try { if (false === file_put_contents($filename, $certificado)) { throw new \RuntimeException('file_put_contents returns FALSE'); } } catch (\Throwable $error) { throw new \RuntimeException("Unable to write the certificate contents into $filename", 0, $error); } }
php
public function save(string $filename) { if ('' === $filename) { throw new \UnexpectedValueException('The filename to store the certificate is empty'); } $certificado = $this->extract(); if ('' === $certificado) { throw new \RuntimeException('The certificado attribute is empty'); } try { if (false === file_put_contents($filename, $certificado)) { throw new \RuntimeException('file_put_contents returns FALSE'); } } catch (\Throwable $error) { throw new \RuntimeException("Unable to write the certificate contents into $filename", 0, $error); } }
[ "public", "function", "save", "(", "string", "$", "filename", ")", "{", "if", "(", "''", "===", "$", "filename", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "'The filename to store the certificate is empty'", ")", ";", "}", "$", "certificado...
Extract and save the certificate into an specified location @see extract @param string $filename @return void @throws \UnexpectedValueException if the filename to store the certificate is empty @throws \RuntimeException if the certificado attribute is empty @throws \RuntimeException if cannot write the contents of the certificate
[ "Extract", "and", "save", "the", "certificate", "into", "an", "specified", "location" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Certificado/NodeCertificado.php#L72-L88
44,674
eclipxe13/CfdiUtils
src/CfdiUtils/Certificado/NodeCertificado.php
NodeCertificado.obtain
public function obtain(): Certificado { $temporaryFile = TemporaryFile::create(); // the temporary name was created try { $this->save($temporaryFile->getPath()); $certificado = new Certificado($temporaryFile->getPath()); return $certificado; } finally { $temporaryFile->remove(); } }
php
public function obtain(): Certificado { $temporaryFile = TemporaryFile::create(); // the temporary name was created try { $this->save($temporaryFile->getPath()); $certificado = new Certificado($temporaryFile->getPath()); return $certificado; } finally { $temporaryFile->remove(); } }
[ "public", "function", "obtain", "(", ")", ":", "Certificado", "{", "$", "temporaryFile", "=", "TemporaryFile", "::", "create", "(", ")", ";", "// the temporary name was created", "try", "{", "$", "this", "->", "save", "(", "$", "temporaryFile", "->", "getPath"...
Return a Certificado object from the Comprobante->Certificado attribute The temporary certificate is stored into a temporary folder and removed after the certificado is loaded. If you need to persist the certificate use the saveCertificado method instead @see save @return Certificado
[ "Return", "a", "Certificado", "object", "from", "the", "Comprobante", "-", ">", "Certificado", "attribute", "The", "temporary", "certificate", "is", "stored", "into", "a", "temporary", "folder", "and", "removed", "after", "the", "certificado", "is", "loaded", "....
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Certificado/NodeCertificado.php#L100-L111
44,675
eclipxe13/CfdiUtils
src/CfdiUtils/Cleaner/Cleaner.php
Cleaner.staticClean
public static function staticClean($content): string { $cleaner = new self($content); $cleaner->clean(); return $cleaner->retrieveXml(); }
php
public static function staticClean($content): string { $cleaner = new self($content); $cleaner->clean(); return $cleaner->retrieveXml(); }
[ "public", "static", "function", "staticClean", "(", "$", "content", ")", ":", "string", "{", "$", "cleaner", "=", "new", "self", "(", "$", "content", ")", ";", "$", "cleaner", "->", "clean", "(", ")", ";", "return", "$", "cleaner", "->", "retrieveXml",...
Method to clean content and return the result If an error occurs, an exception is thrown @param string $content @return string
[ "Method", "to", "clean", "content", "and", "return", "the", "result", "If", "an", "error", "occurs", "an", "exception", "is", "thrown" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Cleaner/Cleaner.php#L39-L44
44,676
eclipxe13/CfdiUtils
src/CfdiUtils/Cleaner/Cleaner.php
Cleaner.load
public function load(string $content) { try { $cfdi = Cfdi::newFromString($content); } catch (\Throwable $exception) { throw new CleanerException($exception->getMessage(), $exception->getCode(), $exception->getPrevious()); } $version = $cfdi->getVersion(); if (! $this->isVersionAllowed($version)) { throw new CleanerException("The CFDI version '$version' is not allowed"); } $this->dom = $cfdi->getDocument(); }
php
public function load(string $content) { try { $cfdi = Cfdi::newFromString($content); } catch (\Throwable $exception) { throw new CleanerException($exception->getMessage(), $exception->getCode(), $exception->getPrevious()); } $version = $cfdi->getVersion(); if (! $this->isVersionAllowed($version)) { throw new CleanerException("The CFDI version '$version' is not allowed"); } $this->dom = $cfdi->getDocument(); }
[ "public", "function", "load", "(", "string", "$", "content", ")", "{", "try", "{", "$", "cfdi", "=", "Cfdi", "::", "newFromString", "(", "$", "content", ")", ";", "}", "catch", "(", "\\", "Throwable", "$", "exception", ")", "{", "throw", "new", "Clea...
Load the string content as a CFDI This is exposed to reuse the current object instead of create a new instance @param string $content @throws CleanerException when the content is not valid xml @throws CleanerException when the document does not use the namespace http://www.sat.gob.mx/cfd/3 @throws CleanerException when cannot find a Comprobante version (or Version) attribute @throws CleanerException when the version is not compatible @return void
[ "Load", "the", "string", "content", "as", "a", "CFDI", "This", "is", "exposed", "to", "reuse", "the", "current", "object", "instead", "of", "create", "a", "new", "instance" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Cleaner/Cleaner.php#L109-L121
44,677
eclipxe13/CfdiUtils
src/CfdiUtils/Cleaner/Cleaner.php
Cleaner.removeIncompleteSchemaLocations
public function removeIncompleteSchemaLocations() { $schemaLocations = $this->obtainXsiSchemaLocations(); for ($s = 0; $s < $schemaLocations->length; $s++) { $element = $schemaLocations->item($s); if (null !== $element) { $element->nodeValue = $this->removeIncompleteSchemaLocation($element->nodeValue); } } }
php
public function removeIncompleteSchemaLocations() { $schemaLocations = $this->obtainXsiSchemaLocations(); for ($s = 0; $s < $schemaLocations->length; $s++) { $element = $schemaLocations->item($s); if (null !== $element) { $element->nodeValue = $this->removeIncompleteSchemaLocation($element->nodeValue); } } }
[ "public", "function", "removeIncompleteSchemaLocations", "(", ")", "{", "$", "schemaLocations", "=", "$", "this", "->", "obtainXsiSchemaLocations", "(", ")", ";", "for", "(", "$", "s", "=", "0", ";", "$", "s", "<", "$", "schemaLocations", "->", "length", "...
Procedure to drop schemaLocations where second part does not ends with '.xsd' @return void
[ "Procedure", "to", "drop", "schemaLocations", "where", "second", "part", "does", "not", "ends", "with", ".", "xsd" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Cleaner/Cleaner.php#L166-L175
44,678
eclipxe13/CfdiUtils
src/CfdiUtils/Cleaner/Cleaner.php
Cleaner.removeNonSatNSschemaLocations
public function removeNonSatNSschemaLocations() { $schemaLocations = $this->obtainXsiSchemaLocations(); for ($s = 0; $s < $schemaLocations->length; $s++) { $element = $schemaLocations->item($s); if (null !== $element) { $this->removeNonSatNSschemaLocation($element); } } }
php
public function removeNonSatNSschemaLocations() { $schemaLocations = $this->obtainXsiSchemaLocations(); for ($s = 0; $s < $schemaLocations->length; $s++) { $element = $schemaLocations->item($s); if (null !== $element) { $this->removeNonSatNSschemaLocation($element); } } }
[ "public", "function", "removeNonSatNSschemaLocations", "(", ")", "{", "$", "schemaLocations", "=", "$", "this", "->", "obtainXsiSchemaLocations", "(", ")", ";", "for", "(", "$", "s", "=", "0", ";", "$", "s", "<", "$", "schemaLocations", "->", "length", ";"...
Procedure to drop schemaLocations that are not allowed If the schemaLocation is empty then remove the attribute @return void
[ "Procedure", "to", "drop", "schemaLocations", "that", "are", "not", "allowed", "If", "the", "schemaLocation", "is", "empty", "then", "remove", "the", "attribute" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Cleaner/Cleaner.php#L198-L207
44,679
eclipxe13/CfdiUtils
src/CfdiUtils/Cleaner/Cleaner.php
Cleaner.removeNonSatNSNode
private function removeNonSatNSNode(string $namespace) { foreach ($this->dom()->getElementsByTagNameNS($namespace, '*') as $children) { $children->parentNode->removeChild($children); } }
php
private function removeNonSatNSNode(string $namespace) { foreach ($this->dom()->getElementsByTagNameNS($namespace, '*') as $children) { $children->parentNode->removeChild($children); } }
[ "private", "function", "removeNonSatNSNode", "(", "string", "$", "namespace", ")", "{", "foreach", "(", "$", "this", "->", "dom", "(", ")", "->", "getElementsByTagNameNS", "(", "$", "namespace", ",", "'*'", ")", "as", "$", "children", ")", "{", "$", "chi...
Procedure to remove all nodes from an specific namespace @param string $namespace @return void
[ "Procedure", "to", "remove", "all", "nodes", "from", "an", "specific", "namespace" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Cleaner/Cleaner.php#L266-L271
44,680
eclipxe13/CfdiUtils
src/CfdiUtils/Nodes/Attributes.php
Attributes.set
public function set(string $name, string $value = null): self { if (null === $value) { $this->remove($name); return $this; } if (! Xml::isValidXmlName($name)) { throw new \UnexpectedValueException(sprintf('Cannot set attribute with an invalid xml name: "%s"', $name)); } $this->attributes[$name] = $value; return $this; }
php
public function set(string $name, string $value = null): self { if (null === $value) { $this->remove($name); return $this; } if (! Xml::isValidXmlName($name)) { throw new \UnexpectedValueException(sprintf('Cannot set attribute with an invalid xml name: "%s"', $name)); } $this->attributes[$name] = $value; return $this; }
[ "public", "function", "set", "(", "string", "$", "name", ",", "string", "$", "value", "=", "null", ")", ":", "self", "{", "if", "(", "null", "===", "$", "value", ")", "{", "$", "this", "->", "remove", "(", "$", "name", ")", ";", "return", "$", ...
Set a value in the collection @param string $name @param string|null $value If null then it will remove the value instead of setting to empty string @return self
[ "Set", "a", "value", "in", "the", "collection" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Nodes/Attributes.php#L31-L42
44,681
eclipxe13/CfdiUtils
src/CfdiUtils/Validate/Cfdi33/RecepcionPagos/Pagos/DoctoRelacionado.php
DoctoRelacionado.registerInAssets
public function registerInAssets(Asserts $asserts) { foreach ($this->validators as $validator) { $validator->registerInAssets($asserts); } }
php
public function registerInAssets(Asserts $asserts) { foreach ($this->validators as $validator) { $validator->registerInAssets($asserts); } }
[ "public", "function", "registerInAssets", "(", "Asserts", "$", "asserts", ")", "{", "foreach", "(", "$", "this", "->", "validators", "as", "$", "validator", ")", "{", "$", "validator", "->", "registerInAssets", "(", "$", "asserts", ")", ";", "}", "}" ]
override registerInAssets to add validators instead of itself
[ "override", "registerInAssets", "to", "add", "validators", "instead", "of", "itself" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Validate/Cfdi33/RecepcionPagos/Pagos/DoctoRelacionado.php#L46-L51
44,682
eclipxe13/CfdiUtils
src/CfdiUtils/XmlResolver/XmlResolver.php
XmlResolver.setDownloader
public function setDownloader(DownloaderInterface $downloader = null) { if (null === $downloader) { $downloader = $this->defaultDownloader(); } $this->downloader = $downloader; }
php
public function setDownloader(DownloaderInterface $downloader = null) { if (null === $downloader) { $downloader = $this->defaultDownloader(); } $this->downloader = $downloader; }
[ "public", "function", "setDownloader", "(", "DownloaderInterface", "$", "downloader", "=", "null", ")", "{", "if", "(", "null", "===", "$", "downloader", ")", "{", "$", "downloader", "=", "$", "this", "->", "defaultDownloader", "(", ")", ";", "}", "$", "...
Set the downloader object. If send a NULL value the object return by defaultDownloader will be set. @param DownloaderInterface|null $downloader
[ "Set", "the", "downloader", "object", ".", "If", "send", "a", "NULL", "value", "the", "object", "return", "by", "defaultDownloader", "will", "be", "set", "." ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/XmlResolver/XmlResolver.php#L87-L93
44,683
eclipxe13/CfdiUtils
src/CfdiUtils/XmlResolver/XmlResolver.php
XmlResolver.resolve
public function resolve(string $resource, string $type = ''): string { if (! $this->hasLocalPath()) { return $resource; } if ('' === $type) { $type = $this->obtainTypeFromUrl($resource); } else { $type = strtoupper($type); } $retriever = $this->newRetriever($type); if (null === $retriever) { throw new \RuntimeException("Unable to handle the resource (Type: $type) $resource"); } $local = $retriever->buildPath($resource); if (! file_exists($local)) { $retriever->retrieve($resource); } return $local; }
php
public function resolve(string $resource, string $type = ''): string { if (! $this->hasLocalPath()) { return $resource; } if ('' === $type) { $type = $this->obtainTypeFromUrl($resource); } else { $type = strtoupper($type); } $retriever = $this->newRetriever($type); if (null === $retriever) { throw new \RuntimeException("Unable to handle the resource (Type: $type) $resource"); } $local = $retriever->buildPath($resource); if (! file_exists($local)) { $retriever->retrieve($resource); } return $local; }
[ "public", "function", "resolve", "(", "string", "$", "resource", ",", "string", "$", "type", "=", "''", ")", ":", "string", "{", "if", "(", "!", "$", "this", "->", "hasLocalPath", "(", ")", ")", "{", "return", "$", "resource", ";", "}", "if", "(", ...
Resolve a resource to a local path. If it does not have a localPath then it will return the exact same resource @param string $resource The url @param string $type Allows XSD, XSLT and CER @return string
[ "Resolve", "a", "resource", "to", "a", "local", "path", ".", "If", "it", "does", "not", "have", "a", "localPath", "then", "it", "will", "return", "the", "exact", "same", "resource" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/XmlResolver/XmlResolver.php#L113-L132
44,684
eclipxe13/CfdiUtils
src/CfdiUtils/XmlResolver/XmlResolver.php
XmlResolver.newRetriever
public function newRetriever(string $type) { if (! $this->hasLocalPath()) { throw new \LogicException('Cannot create a retriever if no local path was found'); } if (static::TYPE_XSLT === $type) { return $this->newXsltRetriever(); } if (static::TYPE_XSD === $type) { return $this->newXsdRetriever(); } if (static::TYPE_CER === $type) { return $this->newCerRetriever(); } return null; }
php
public function newRetriever(string $type) { if (! $this->hasLocalPath()) { throw new \LogicException('Cannot create a retriever if no local path was found'); } if (static::TYPE_XSLT === $type) { return $this->newXsltRetriever(); } if (static::TYPE_XSD === $type) { return $this->newXsdRetriever(); } if (static::TYPE_CER === $type) { return $this->newCerRetriever(); } return null; }
[ "public", "function", "newRetriever", "(", "string", "$", "type", ")", "{", "if", "(", "!", "$", "this", "->", "hasLocalPath", "(", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "'Cannot create a retriever if no local path was found'", ")", ";", ...
Create a new retriever depending on the type parameter, only allow TYPE_XSLT and TYPE_XSD @param string $type @return RetrieverInterface|null
[ "Create", "a", "new", "retriever", "depending", "on", "the", "type", "parameter", "only", "allow", "TYPE_XSLT", "and", "TYPE_XSD" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/XmlResolver/XmlResolver.php#L164-L179
44,685
eclipxe13/CfdiUtils
src/CfdiUtils/Certificado/Certificado.php
Certificado.belongsTo
public function belongsTo(string $pemKeyFile, string $passPhrase = ''): bool { $this->assertFileExists($pemKeyFile); $openSSL = $this->getOpenSSL(); $keyContents = $openSSL->readPemContents( // intentionally silence this error, if return false then cast it to string strval(@file_get_contents($pemKeyFile)) )->privateKey(); if ('' === $keyContents) { throw new \UnexpectedValueException("The file $pemKeyFile is not a PEM private key"); } $privateKey = openssl_get_privatekey($keyContents, $passPhrase); if (false === $privateKey) { throw new \RuntimeException("Cannot open the private key file $pemKeyFile"); } $belongs = openssl_x509_check_private_key($this->getPemContents(), $privateKey); openssl_free_key($privateKey); return $belongs; }
php
public function belongsTo(string $pemKeyFile, string $passPhrase = ''): bool { $this->assertFileExists($pemKeyFile); $openSSL = $this->getOpenSSL(); $keyContents = $openSSL->readPemContents( // intentionally silence this error, if return false then cast it to string strval(@file_get_contents($pemKeyFile)) )->privateKey(); if ('' === $keyContents) { throw new \UnexpectedValueException("The file $pemKeyFile is not a PEM private key"); } $privateKey = openssl_get_privatekey($keyContents, $passPhrase); if (false === $privateKey) { throw new \RuntimeException("Cannot open the private key file $pemKeyFile"); } $belongs = openssl_x509_check_private_key($this->getPemContents(), $privateKey); openssl_free_key($privateKey); return $belongs; }
[ "public", "function", "belongsTo", "(", "string", "$", "pemKeyFile", ",", "string", "$", "passPhrase", "=", "''", ")", ":", "bool", "{", "$", "this", "->", "assertFileExists", "(", "$", "pemKeyFile", ")", ";", "$", "openSSL", "=", "$", "this", "->", "g...
Check if this certificate belongs to a private key @param string $pemKeyFile @param string $passPhrase @return bool @throws \UnexpectedValueException if the file does not exists or is not readable @throws \UnexpectedValueException if the file is not a PEM private key @throws \RuntimeException if cannot open the private key file
[ "Check", "if", "this", "certificate", "belongs", "to", "a", "private", "key" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Certificado/Certificado.php#L109-L127
44,686
eclipxe13/CfdiUtils
src/CfdiUtils/Certificado/Certificado.php
Certificado.verify
public function verify(string $data, string $signature, int $algorithm = OPENSSL_ALGO_SHA256): bool { $pubKey = openssl_get_publickey($this->getPubkey()); if (false === $pubKey) { throw new \RuntimeException('Cannot open public key from certificate'); } try { $verify = openssl_verify($data, $signature, $pubKey, $algorithm); if (-1 === $verify) { throw new \RuntimeException('OpenSSL Error: ' . openssl_error_string()); } } finally { openssl_free_key($pubKey); } return (1 === $verify); }
php
public function verify(string $data, string $signature, int $algorithm = OPENSSL_ALGO_SHA256): bool { $pubKey = openssl_get_publickey($this->getPubkey()); if (false === $pubKey) { throw new \RuntimeException('Cannot open public key from certificate'); } try { $verify = openssl_verify($data, $signature, $pubKey, $algorithm); if (-1 === $verify) { throw new \RuntimeException('OpenSSL Error: ' . openssl_error_string()); } } finally { openssl_free_key($pubKey); } return (1 === $verify); }
[ "public", "function", "verify", "(", "string", "$", "data", ",", "string", "$", "signature", ",", "int", "$", "algorithm", "=", "OPENSSL_ALGO_SHA256", ")", ":", "bool", "{", "$", "pubKey", "=", "openssl_get_publickey", "(", "$", "this", "->", "getPubkey", ...
Verify the signature of some data @param string $data @param string $signature @param int $algorithm @return bool @throws \RuntimeException if cannot open the public key from certificate @throws \RuntimeException if openssl report an error
[ "Verify", "the", "signature", "of", "some", "data" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Certificado/Certificado.php#L223-L238
44,687
eclipxe13/CfdiUtils
src/CfdiUtils/CadenaOrigen/CadenaOrigenLocations.php
CadenaOrigenLocations.getXsltLocation
public function getXsltLocation(string $version): string { if (array_key_exists($version, $this->xsltLocations)) { return $this->xsltLocations[$version]; } return ''; }
php
public function getXsltLocation(string $version): string { if (array_key_exists($version, $this->xsltLocations)) { return $this->xsltLocations[$version]; } return ''; }
[ "public", "function", "getXsltLocation", "(", "string", "$", "version", ")", ":", "string", "{", "if", "(", "array_key_exists", "(", "$", "version", ",", "$", "this", "->", "xsltLocations", ")", ")", "{", "return", "$", "this", "->", "xsltLocations", "[", ...
Return the registered location of the xslt file to perform the xml transformation depending on the cfdi version. This value can be changed using setXsltLocation @see setXsltLocation @param string $version @return string
[ "Return", "the", "registered", "location", "of", "the", "xslt", "file", "to", "perform", "the", "xml", "transformation", "depending", "on", "the", "cfdi", "version", ".", "This", "value", "can", "be", "changed", "using", "setXsltLocation" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/CadenaOrigen/CadenaOrigenLocations.php#L33-L39
44,688
eclipxe13/CfdiUtils
src/CfdiUtils/Nodes/NodesSorter.php
NodesSorter.setOrder
public function setOrder(array $names): bool { $order = array_flip($this->parseNames($names)); if ($this->order === $order) { return false; } $this->order = $order; $this->count = count($order); return true; }
php
public function setOrder(array $names): bool { $order = array_flip($this->parseNames($names)); if ($this->order === $order) { return false; } $this->order = $order; $this->count = count($order); return true; }
[ "public", "function", "setOrder", "(", "array", "$", "names", ")", ":", "bool", "{", "$", "order", "=", "array_flip", "(", "$", "this", "->", "parseNames", "(", "$", "names", ")", ")", ";", "if", "(", "$", "this", "->", "order", "===", "$", "order"...
It takes only the unique string names and sort using the order of appearance @param string[] $names @return bool true if the new names list is different from previous
[ "It", "takes", "only", "the", "unique", "string", "names", "and", "sort", "using", "the", "order", "of", "appearance" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Nodes/NodesSorter.php#L26-L35
44,689
eclipxe13/CfdiUtils
src/CfdiUtils/ConsultaCfdiSat/WebService.php
WebService.doRequestConsulta
protected function doRequestConsulta(string $expression) { /** @var int $encoding Override because inspectors does not know that second argument can be NULL */ $encoding = null; return $this->getSoapClient()->__soapCall( 'Consulta', [new \SoapVar($expression, $encoding, '', '', 'expresionImpresa', 'http://tempuri.org/')], ['soapaction' => 'http://tempuri.org/IConsultaCFDIService/Consulta'] ); }
php
protected function doRequestConsulta(string $expression) { /** @var int $encoding Override because inspectors does not know that second argument can be NULL */ $encoding = null; return $this->getSoapClient()->__soapCall( 'Consulta', [new \SoapVar($expression, $encoding, '', '', 'expresionImpresa', 'http://tempuri.org/')], ['soapaction' => 'http://tempuri.org/IConsultaCFDIService/Consulta'] ); }
[ "protected", "function", "doRequestConsulta", "(", "string", "$", "expression", ")", "{", "/** @var int $encoding Override because inspectors does not know that second argument can be NULL */", "$", "encoding", "=", "null", ";", "return", "$", "this", "->", "getSoapClient", "...
This method exists to be able to mock SOAP call @internal @param string $expression @return null|\stdClass
[ "This", "method", "exists", "to", "be", "able", "to", "mock", "SOAP", "call" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/ConsultaCfdiSat/WebService.php#L100-L109
44,690
eclipxe13/CfdiUtils
src/CfdiUtils/Utils/Rfc.php
Rfc.obtainDate
public static function obtainDate(string $rfc): int { // rfc is multibyte $begin = (mb_strlen($rfc) === 12) ? 3 : 4; // strdate is not multibyte $strdate = strval(mb_substr($rfc, $begin, 6)); $parts = str_split($strdate, 2); // year 2000 is leap year (%4 & %100 & %400) /** @var int|false $date phpstan does not know that mktime can return false */ $date = mktime(0, 0, 0, (int) $parts[1], (int) $parts[2], (int) ('20' . $parts[0])); if (false === $date) { return 0; } if (date('ymd', $date) !== $strdate) { return 0; } return $date; }
php
public static function obtainDate(string $rfc): int { // rfc is multibyte $begin = (mb_strlen($rfc) === 12) ? 3 : 4; // strdate is not multibyte $strdate = strval(mb_substr($rfc, $begin, 6)); $parts = str_split($strdate, 2); // year 2000 is leap year (%4 & %100 & %400) /** @var int|false $date phpstan does not know that mktime can return false */ $date = mktime(0, 0, 0, (int) $parts[1], (int) $parts[2], (int) ('20' . $parts[0])); if (false === $date) { return 0; } if (date('ymd', $date) !== $strdate) { return 0; } return $date; }
[ "public", "static", "function", "obtainDate", "(", "string", "$", "rfc", ")", ":", "int", "{", "// rfc is multibyte", "$", "begin", "=", "(", "mb_strlen", "(", "$", "rfc", ")", "===", "12", ")", "?", "3", ":", "4", ";", "// strdate is not multibyte", "$"...
The date is always from the year 2000 since RFC does not provide century and 000229 is valid. Please, change this function on year 2100! @param string $rfc @return int
[ "The", "date", "is", "always", "from", "the", "year", "2000", "since", "RFC", "does", "not", "provide", "century", "and", "000229", "is", "valid", ".", "Please", "change", "this", "function", "on", "year", "2100!" ]
e252bc8f8272aecb82646523809dcc4640a3fb60
https://github.com/eclipxe13/CfdiUtils/blob/e252bc8f8272aecb82646523809dcc4640a3fb60/src/CfdiUtils/Utils/Rfc.php#L142-L159
44,691
commercetools/commercetools-php-sdk
src/Core/Cache/CacheAdapterFactory.php
CacheAdapterFactory.get
public function get($cache = null) { if (is_null($cache)) { $cache = $this->getDefaultCache(); } if ($cache instanceof CacheItemPoolInterface) { return $cache; } if ($cache instanceof CacheInterface) { return $cache; } foreach ($this->callbacks as $callBack) { $result = call_user_func($callBack, $cache); if ($result instanceof CacheItemPoolInterface) { return $result; } if ($result instanceof CacheInterface) { return $result; } } throw new InvalidArgumentException(Message::INVALID_CACHE_ADAPTER); }
php
public function get($cache = null) { if (is_null($cache)) { $cache = $this->getDefaultCache(); } if ($cache instanceof CacheItemPoolInterface) { return $cache; } if ($cache instanceof CacheInterface) { return $cache; } foreach ($this->callbacks as $callBack) { $result = call_user_func($callBack, $cache); if ($result instanceof CacheItemPoolInterface) { return $result; } if ($result instanceof CacheInterface) { return $result; } } throw new InvalidArgumentException(Message::INVALID_CACHE_ADAPTER); }
[ "public", "function", "get", "(", "$", "cache", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "cache", ")", ")", "{", "$", "cache", "=", "$", "this", "->", "getDefaultCache", "(", ")", ";", "}", "if", "(", "$", "cache", "instanceof", "Ca...
returns the cache adapter interface for the application cache @param $cache @return CacheItemPoolInterface|CacheInterface @throws \InvalidArgumentException
[ "returns", "the", "cache", "adapter", "interface", "for", "the", "application", "cache" ]
53ac8b0929b56e10bc7f05d1b363688cd7038184
https://github.com/commercetools/commercetools-php-sdk/blob/53ac8b0929b56e10bc7f05d1b363688cd7038184/src/Core/Cache/CacheAdapterFactory.php#L77-L101
44,692
commercetools/commercetools-php-sdk
src/Core/Cache/CacheAdapterFactory.php
CacheAdapterFactory.getDefaultCache
protected function getDefaultCache() { if (extension_loaded('apcu')) { return new ApcuCachePool(); } if (class_exists('\Cache\Adapter\Filesystem\FilesystemCachePool')) { $filesystemAdapter = new Local($this->cacheDir); $filesystem = new Filesystem($filesystemAdapter); return new FilesystemCachePool($filesystem); } return null; }
php
protected function getDefaultCache() { if (extension_loaded('apcu')) { return new ApcuCachePool(); } if (class_exists('\Cache\Adapter\Filesystem\FilesystemCachePool')) { $filesystemAdapter = new Local($this->cacheDir); $filesystem = new Filesystem($filesystemAdapter); return new FilesystemCachePool($filesystem); } return null; }
[ "protected", "function", "getDefaultCache", "(", ")", "{", "if", "(", "extension_loaded", "(", "'apcu'", ")", ")", "{", "return", "new", "ApcuCachePool", "(", ")", ";", "}", "if", "(", "class_exists", "(", "'\\Cache\\Adapter\\Filesystem\\FilesystemCachePool'", ")"...
creates a default cache adapter if no cache has been provided @return CacheItemPoolInterface|null
[ "creates", "a", "default", "cache", "adapter", "if", "no", "cache", "has", "been", "provided" ]
53ac8b0929b56e10bc7f05d1b363688cd7038184
https://github.com/commercetools/commercetools-php-sdk/blob/53ac8b0929b56e10bc7f05d1b363688cd7038184/src/Core/Cache/CacheAdapterFactory.php#L108-L121
44,693
commercetools/commercetools-php-sdk
src/Core/Helper/State/Renderer.php
Renderer.getNodeRendererByStateName
public function getNodeRendererByStateName($stateName) { if (isset($this->nodeRenderers[$stateName])) { return $this->nodeRenderers[$stateName]; } return new NodeRenderer(); }
php
public function getNodeRendererByStateName($stateName) { if (isset($this->nodeRenderers[$stateName])) { return $this->nodeRenderers[$stateName]; } return new NodeRenderer(); }
[ "public", "function", "getNodeRendererByStateName", "(", "$", "stateName", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "nodeRenderers", "[", "$", "stateName", "]", ")", ")", "{", "return", "$", "this", "->", "nodeRenderers", "[", "$", "stateName"...
Get the renderer for the given state name. If no renderer was set the default renderer Bob_StateMachine_Renderer_Node_DefaultRenderer() is returned @param $stateName @return NodeRenderer
[ "Get", "the", "renderer", "for", "the", "given", "state", "name", "." ]
53ac8b0929b56e10bc7f05d1b363688cd7038184
https://github.com/commercetools/commercetools-php-sdk/blob/53ac8b0929b56e10bc7f05d1b363688cd7038184/src/Core/Helper/State/Renderer.php#L155-L161
44,694
commercetools/commercetools-php-sdk
src/Core/Helper/State/Renderer.php
Renderer.runDot
public function runDot($dotString) { $descriptorSpec = array( 0 => array("pipe", "r"), // stdin 1 => array("pipe", "w"), // stdout 2 => array("pipe", "a") // stderr ); $process = proc_open('dot -Tsvg', $descriptorSpec, $pipes); if (is_resource($process)) { fwrite($pipes[0], $dotString); fclose($pipes[0]); $svg = stream_get_contents($pipes[1]); fclose($pipes[1]); proc_close($process); $svg = explode('<svg ', $svg); // has it worked out? if (count($svg) < 2) { return false; } return '<svg ' . $svg[1]; } return false; }
php
public function runDot($dotString) { $descriptorSpec = array( 0 => array("pipe", "r"), // stdin 1 => array("pipe", "w"), // stdout 2 => array("pipe", "a") // stderr ); $process = proc_open('dot -Tsvg', $descriptorSpec, $pipes); if (is_resource($process)) { fwrite($pipes[0], $dotString); fclose($pipes[0]); $svg = stream_get_contents($pipes[1]); fclose($pipes[1]); proc_close($process); $svg = explode('<svg ', $svg); // has it worked out? if (count($svg) < 2) { return false; } return '<svg ' . $svg[1]; } return false; }
[ "public", "function", "runDot", "(", "$", "dotString", ")", "{", "$", "descriptorSpec", "=", "array", "(", "0", "=>", "array", "(", "\"pipe\"", ",", "\"r\"", ")", ",", "// stdin", "1", "=>", "array", "(", "\"pipe\"", ",", "\"w\"", ")", ",", "// stdout"...
Renders a dot graph into an svg @param string $dotString The dot graph that is fed into the @return string|bool the resulting SVG
[ "Renders", "a", "dot", "graph", "into", "an", "svg" ]
53ac8b0929b56e10bc7f05d1b363688cd7038184
https://github.com/commercetools/commercetools-php-sdk/blob/53ac8b0929b56e10bc7f05d1b363688cd7038184/src/Core/Helper/State/Renderer.php#L177-L206
44,695
commercetools/commercetools-php-sdk
src/Core/Helper/State/Renderer.php
Renderer.renderDot
public function renderDot(StateCollection $stateCollection) { // define the graph $graph = 'digraph ' . 'test' . ' { dpi="56";compound="true";fontname="Arial";margin="";nodesep="0.6";rankdir="TD";ranksep="0.4";' . PHP_EOL; // add all states to the graph foreach ($stateCollection as $state) { $nodeRenderer = $this->getNodeRendererByStateName($state->getKey()); $graph .= ' ' . $nodeRenderer->render($state); } // add all transitions to the graph foreach ($stateCollection as $state) { $nodeRenderer = $this->getTransitionRendererByStateName($state->getKey()); $graph .= ' ' . $nodeRenderer->render($state); } $graph .= '}' . PHP_EOL; return $graph; }
php
public function renderDot(StateCollection $stateCollection) { // define the graph $graph = 'digraph ' . 'test' . ' { dpi="56";compound="true";fontname="Arial";margin="";nodesep="0.6";rankdir="TD";ranksep="0.4";' . PHP_EOL; // add all states to the graph foreach ($stateCollection as $state) { $nodeRenderer = $this->getNodeRendererByStateName($state->getKey()); $graph .= ' ' . $nodeRenderer->render($state); } // add all transitions to the graph foreach ($stateCollection as $state) { $nodeRenderer = $this->getTransitionRendererByStateName($state->getKey()); $graph .= ' ' . $nodeRenderer->render($state); } $graph .= '}' . PHP_EOL; return $graph; }
[ "public", "function", "renderDot", "(", "StateCollection", "$", "stateCollection", ")", "{", "// define the graph", "$", "graph", "=", "'digraph '", ".", "'test'", ".", "' { dpi=\"56\";compound=\"true\";fontname=\"Arial\";margin=\"\";nodesep=\"0.6\";rankdir=\"TD\";ranksep=\"0.4\";'...
Creates a dot graph for a process @param StateCollection $stateCollection @return string A dot graph
[ "Creates", "a", "dot", "graph", "for", "a", "process" ]
53ac8b0929b56e10bc7f05d1b363688cd7038184
https://github.com/commercetools/commercetools-php-sdk/blob/53ac8b0929b56e10bc7f05d1b363688cd7038184/src/Core/Helper/State/Renderer.php#L214-L237
44,696
commercetools/commercetools-php-sdk
src/Core/Response/AbstractApiResponse.php
AbstractApiResponse.wait
public function wait() { if (!$this->getResponse() instanceof AdapterPromiseInterface) { throw new \BadMethodCallException(Message::FUTURE_BAD_METHOD_CALL); } return $this->getResponse()->wait(); }
php
public function wait() { if (!$this->getResponse() instanceof AdapterPromiseInterface) { throw new \BadMethodCallException(Message::FUTURE_BAD_METHOD_CALL); } return $this->getResponse()->wait(); }
[ "public", "function", "wait", "(", ")", "{", "if", "(", "!", "$", "this", "->", "getResponse", "(", ")", "instanceof", "AdapterPromiseInterface", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "Message", "::", "FUTURE_BAD_METHOD_CALL", ")", ";"...
Returns the result of the future either from cache or by blocking until it is complete. This method must block until the future has a result or is cancelled. Throwing an exception in the wait() method will mark the future as realized and will throw the exception each time wait() is called. Throwing an instance of GuzzleHttp\Ring\CancelledException will mark the future as realized, will not throw immediately, but will throw the exception if the future's wait() method is called again. @return mixed
[ "Returns", "the", "result", "of", "the", "future", "either", "from", "cache", "or", "by", "blocking", "until", "it", "is", "complete", "." ]
53ac8b0929b56e10bc7f05d1b363688cd7038184
https://github.com/commercetools/commercetools-php-sdk/blob/53ac8b0929b56e10bc7f05d1b363688cd7038184/src/Core/Response/AbstractApiResponse.php#L190-L197
44,697
commercetools/commercetools-php-sdk
src/Core/Client.php
Client.execute
public function execute(ClientRequestInterface $request, array $headers = null, array $clientOptions = []) { if ($request instanceof ContextAwareInterface) { $request->setContextIfNull($this->getConfig()->getContext()); } $httpRequest = $this->createHttpRequest($request, $headers); try { $client = $this->getHttpClient(); if ($client instanceof AdapterOptionInterface) { $httpResponse = $client->execute($httpRequest, $clientOptions); } else { $httpResponse = $client->execute($httpRequest); } $response = $request->buildResponse($httpResponse); } catch (ApiException $exception) { if ($exception instanceof InvalidTokenException && !$this->tokenRefreshed) { $this->tokenRefreshed = true; $this->getOauthManager()->refreshToken(); return $this->execute($request); } if ($this->getConfig()->getThrowExceptions() || !$exception->getResponse() instanceof ResponseInterface) { throw $exception; } $httpResponse = $exception->getResponse(); $this->logException($exception); $response = new ErrorResponse($exception, $request, $httpResponse); } $this->logDeprecatedRequest($httpResponse, $httpRequest); return $response; }
php
public function execute(ClientRequestInterface $request, array $headers = null, array $clientOptions = []) { if ($request instanceof ContextAwareInterface) { $request->setContextIfNull($this->getConfig()->getContext()); } $httpRequest = $this->createHttpRequest($request, $headers); try { $client = $this->getHttpClient(); if ($client instanceof AdapterOptionInterface) { $httpResponse = $client->execute($httpRequest, $clientOptions); } else { $httpResponse = $client->execute($httpRequest); } $response = $request->buildResponse($httpResponse); } catch (ApiException $exception) { if ($exception instanceof InvalidTokenException && !$this->tokenRefreshed) { $this->tokenRefreshed = true; $this->getOauthManager()->refreshToken(); return $this->execute($request); } if ($this->getConfig()->getThrowExceptions() || !$exception->getResponse() instanceof ResponseInterface) { throw $exception; } $httpResponse = $exception->getResponse(); $this->logException($exception); $response = new ErrorResponse($exception, $request, $httpResponse); } $this->logDeprecatedRequest($httpResponse, $httpRequest); return $response; }
[ "public", "function", "execute", "(", "ClientRequestInterface", "$", "request", ",", "array", "$", "headers", "=", "null", ",", "array", "$", "clientOptions", "=", "[", "]", ")", "{", "if", "(", "$", "request", "instanceof", "ContextAwareInterface", ")", "{"...
Executes an API request synchronously @param ClientRequestInterface $request @param array $headers @param array $clientOptions @return ApiResponseInterface @throws ApiException @throws InvalidTokenException
[ "Executes", "an", "API", "request", "synchronously" ]
53ac8b0929b56e10bc7f05d1b363688cd7038184
https://github.com/commercetools/commercetools-php-sdk/blob/53ac8b0929b56e10bc7f05d1b363688cd7038184/src/Core/Client.php#L250-L282
44,698
commercetools/commercetools-php-sdk
src/Core/Client.php
Client.executeAsync
public function executeAsync(ClientRequestInterface $request, array $headers = null, array $clientOptions = []) { if ($request instanceof ContextAwareInterface) { $request->setContextIfNull($this->getConfig()->getContext()); } $httpRequest = $this->createHttpRequest($request, $headers); $client = $this->getHttpClient(); if ($client instanceof AdapterOptionInterface) { $response = $request->buildResponse($client->executeAsync($httpRequest, $clientOptions)); } else { $response = $request->buildResponse($client->executeAsync($httpRequest)); } $response = $response->then( function ($httpResponse) use ($httpRequest) { $this->logDeprecatedRequest($httpResponse, $httpRequest); return $httpResponse; } ); return $response; }
php
public function executeAsync(ClientRequestInterface $request, array $headers = null, array $clientOptions = []) { if ($request instanceof ContextAwareInterface) { $request->setContextIfNull($this->getConfig()->getContext()); } $httpRequest = $this->createHttpRequest($request, $headers); $client = $this->getHttpClient(); if ($client instanceof AdapterOptionInterface) { $response = $request->buildResponse($client->executeAsync($httpRequest, $clientOptions)); } else { $response = $request->buildResponse($client->executeAsync($httpRequest)); } $response = $response->then( function ($httpResponse) use ($httpRequest) { $this->logDeprecatedRequest($httpResponse, $httpRequest); return $httpResponse; } ); return $response; }
[ "public", "function", "executeAsync", "(", "ClientRequestInterface", "$", "request", ",", "array", "$", "headers", "=", "null", ",", "array", "$", "clientOptions", "=", "[", "]", ")", "{", "if", "(", "$", "request", "instanceof", "ContextAwareInterface", ")", ...
Executes an API request asynchronously @param ClientRequestInterface $request @param array $clientOptions @return ApiResponseInterface
[ "Executes", "an", "API", "request", "asynchronously" ]
53ac8b0929b56e10bc7f05d1b363688cd7038184
https://github.com/commercetools/commercetools-php-sdk/blob/53ac8b0929b56e10bc7f05d1b363688cd7038184/src/Core/Client.php#L290-L311
44,699
commercetools/commercetools-php-sdk
src/Core/Client.php
Client.executeBatch
public function executeBatch(array $headers = null, array $clientOptions = []) { $requests = $this->getBatchHttpRequests($headers); $client = $this->getHttpClient(); if ($client instanceof AdapterOptionInterface) { $httpResponses = $client->executeBatch($requests, $clientOptions); } else { $httpResponses = $client->executeBatch($requests); } $responses = []; foreach ($httpResponses as $key => $httpResponse) { $request = $this->batchRequests[$key]; $httpRequest = $requests[$key]; if ($httpResponse instanceof ApiException) { $exception = $httpResponse; if ($this->getConfig()->getThrowExceptions() || !$httpResponse->getResponse() instanceof ResponseInterface ) { throw $exception; } $this->logException($httpResponse); $httpResponse = $exception->getResponse(); $responses[$request->getIdentifier()] = new ErrorResponse( $exception, $request, $httpResponse ); } else { $responses[$request->getIdentifier()] = $request->buildResponse($httpResponse); } $this->logDeprecatedRequest($httpResponse, $httpRequest); } unset($this->batchRequests); $this->batchRequests = []; return $responses; }
php
public function executeBatch(array $headers = null, array $clientOptions = []) { $requests = $this->getBatchHttpRequests($headers); $client = $this->getHttpClient(); if ($client instanceof AdapterOptionInterface) { $httpResponses = $client->executeBatch($requests, $clientOptions); } else { $httpResponses = $client->executeBatch($requests); } $responses = []; foreach ($httpResponses as $key => $httpResponse) { $request = $this->batchRequests[$key]; $httpRequest = $requests[$key]; if ($httpResponse instanceof ApiException) { $exception = $httpResponse; if ($this->getConfig()->getThrowExceptions() || !$httpResponse->getResponse() instanceof ResponseInterface ) { throw $exception; } $this->logException($httpResponse); $httpResponse = $exception->getResponse(); $responses[$request->getIdentifier()] = new ErrorResponse( $exception, $request, $httpResponse ); } else { $responses[$request->getIdentifier()] = $request->buildResponse($httpResponse); } $this->logDeprecatedRequest($httpResponse, $httpRequest); } unset($this->batchRequests); $this->batchRequests = []; return $responses; }
[ "public", "function", "executeBatch", "(", "array", "$", "headers", "=", "null", ",", "array", "$", "clientOptions", "=", "[", "]", ")", "{", "$", "requests", "=", "$", "this", "->", "getBatchHttpRequests", "(", "$", "headers", ")", ";", "$", "client", ...
Executes API requests in batch @param array $headers @param array $clientOptions @return ApiResponseInterface[] @throws ApiException
[ "Executes", "API", "requests", "in", "batch" ]
53ac8b0929b56e10bc7f05d1b363688cd7038184
https://github.com/commercetools/commercetools-php-sdk/blob/53ac8b0929b56e10bc7f05d1b363688cd7038184/src/Core/Client.php#L345-L382