repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
webforge-labs/psc-cms
lib/Psc/URL/Helper.php
Helper.getURL
public static function getURL($section, $flags = 0x000000, Array $queryVars = array()) { /* Query Vars Handling */ if ($section === NULL) { $url = $_SERVER['PHP_SELF']; // da bin ich mir hier noch nicht ganz sicher if (!isset($_SERVER['PHP_SELF'])) { throw new \Psc\Exception('SERVE...
php
public static function getURL($section, $flags = 0x000000, Array $queryVars = array()) { /* Query Vars Handling */ if ($section === NULL) { $url = $_SERVER['PHP_SELF']; // da bin ich mir hier noch nicht ganz sicher if (!isset($_SERVER['PHP_SELF'])) { throw new \Psc\Exception('SERVE...
[ "public", "static", "function", "getURL", "(", "$", "section", ",", "$", "flags", "=", "0x000000", ",", "Array", "$", "queryVars", "=", "array", "(", ")", ")", "{", "/*\n Query Vars Handling\n */", "if", "(", "$", "section", "===", "NULL", ")", "{"...
Konstruiert eine URL @param string|NULL|\Psc\URL\Routable $section wenn $section NULL ist, wird der Teil dynamisch bestimmt (aktuelle Seite)
[ "Konstruiert", "eine", "URL" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/URL/Helper.php#L54-L91
seeruo/framework
src/Library/Filesystem.php
Filesystem.create
public function create($file_path, $content='') { $file_dir = dirname($file_path); $new_path = $file_path; if (strstr(PHP_OS, 'WIN')) { $file_dir = mb_convert_encoding($file_dir, 'gbk', 'UTF-8'); $new_path = mb_convert_encoding($file_path, 'gbk', 'UTF-8'); } ...
php
public function create($file_path, $content='') { $file_dir = dirname($file_path); $new_path = $file_path; if (strstr(PHP_OS, 'WIN')) { $file_dir = mb_convert_encoding($file_dir, 'gbk', 'UTF-8'); $new_path = mb_convert_encoding($file_path, 'gbk', 'UTF-8'); } ...
[ "public", "function", "create", "(", "$", "file_path", ",", "$", "content", "=", "''", ")", "{", "$", "file_dir", "=", "dirname", "(", "$", "file_path", ")", ";", "$", "new_path", "=", "$", "file_path", ";", "if", "(", "strstr", "(", "PHP_OS", ",", ...
创建文件 @param [type] $file_path[文件路径] @param string $content [文件内容]
[ "创建文件" ]
train
https://github.com/seeruo/framework/blob/689c6e95bc95fe2ae037e056d8228820dd08d7e9/src/Library/Filesystem.php#L28-L43
seeruo/framework
src/Library/Filesystem.php
Filesystem.getContent
public function getContent($file_path) { $file = []; // 文件解析完之后的数据 $file_path = trim($file_path); // 初始配置 $file_set = [ 'file_name' => basename($file_path), 'file_dire' => dirname($file_path), 'file_path' => dirname($file_path). DIRECTORY_SEPARATOR...
php
public function getContent($file_path) { $file = []; // 文件解析完之后的数据 $file_path = trim($file_path); // 初始配置 $file_set = [ 'file_name' => basename($file_path), 'file_dire' => dirname($file_path), 'file_path' => dirname($file_path). DIRECTORY_SEPARATOR...
[ "public", "function", "getContent", "(", "$", "file_path", ")", "{", "$", "file", "=", "[", "]", ";", "// 文件解析完之后的数据", "$", "file_path", "=", "trim", "(", "$", "file_path", ")", ";", "// 初始配置", "$", "file_set", "=", "[", "'file_name'", "=>", "basename", ...
获取文件内容 @param [type] $fileName [文件名]
[ "获取文件内容" ]
train
https://github.com/seeruo/framework/blob/689c6e95bc95fe2ae037e056d8228820dd08d7e9/src/Library/Filesystem.php#L48-L94
seeruo/framework
src/Library/Filesystem.php
Filesystem.getFiles
public function getFiles($directory='') { if (empty($directory)) { throw new Exception("without $directory param"); } if($dir = opendir($directory)) { $tmp = Array(); while($file = readdir($dir)) { if($file != "." && $file != ".." && $file[0] !...
php
public function getFiles($directory='') { if (empty($directory)) { throw new Exception("without $directory param"); } if($dir = opendir($directory)) { $tmp = Array(); while($file = readdir($dir)) { if($file != "." && $file != ".." && $file[0] !...
[ "public", "function", "getFiles", "(", "$", "directory", "=", "''", ")", "{", "if", "(", "empty", "(", "$", "directory", ")", ")", "{", "throw", "new", "Exception", "(", "\"without $directory param\"", ")", ";", "}", "if", "(", "$", "dir", "=", "opendi...
获取文件列表 @param [type] $directory [文件仓库路径] @return [type] [所有文件列表]
[ "获取文件列表" ]
train
https://github.com/seeruo/framework/blob/689c6e95bc95fe2ae037e056d8228820dd08d7e9/src/Library/Filesystem.php#L101-L126
infinity-next/braintree
src/BraintreeGateway.php
BraintreeGateway.charge
public function charge($amount, array $options = array()) { // $options = array_merge([ // 'currency' => $this->getCurrency(), // ], $options); $options['amount'] = $amount / 100; // if (! array_key_exists('source', $options) && $this->billable->hasBraintreeId()) { // $options['customer'] ...
php
public function charge($amount, array $options = array()) { // $options = array_merge([ // 'currency' => $this->getCurrency(), // ], $options); $options['amount'] = $amount / 100; // if (! array_key_exists('source', $options) && $this->billable->hasBraintreeId()) { // $options['customer'] ...
[ "public", "function", "charge", "(", "$", "amount", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "// $options = array_merge([\r", "// \t'currency' => $this->getCurrency(),\r", "// ], $options);\r", "$", "options", "[", "'amount'", "]", "=", "$", ...
Make a "one off" charge on the customer for the given amount. @param int $amount @param array $options @return bool|mixed
[ "Make", "a", "one", "off", "charge", "on", "the", "customer", "for", "the", "given", "amount", "." ]
train
https://github.com/infinity-next/braintree/blob/4bf6f49d4d8a05734a295003137f360e331cc10f/src/BraintreeGateway.php#L91-L115
infinity-next/braintree
src/BraintreeGateway.php
BraintreeGateway.create
public function create($token, array $properties = array(), $customer = null) { $parameters = array_merge([ 'paymentMethodNonce' => $token, ], $properties); $response = BraintreeCustomer::create($parameters); return $response; }
php
public function create($token, array $properties = array(), $customer = null) { $parameters = array_merge([ 'paymentMethodNonce' => $token, ], $properties); $response = BraintreeCustomer::create($parameters); return $response; }
[ "public", "function", "create", "(", "$", "token", ",", "array", "$", "properties", "=", "array", "(", ")", ",", "$", "customer", "=", "null", ")", "{", "$", "parameters", "=", "array_merge", "(", "[", "'paymentMethodNonce'", "=>", "$", "token", ",", "...
Subscribe to the plan for the first time. @param string $token @param array $properties @param object|null $customer @return void
[ "Subscribe", "to", "the", "plan", "for", "the", "first", "time", "." ]
train
https://github.com/infinity-next/braintree/blob/4bf6f49d4d8a05734a295003137f360e331cc10f/src/BraintreeGateway.php#L124-L134
steeffeen/FancyManiaLinks
FML/Script/Features/RadioButtonGroupFeature.php
RadioButtonGroupFeature.addRadioButton
public function addRadioButton(CheckBox $radioButton) { if (!in_array($radioButton, $this->radioButtons, true)) { array_push($this->radioButtons, $radioButton); } return $this; }
php
public function addRadioButton(CheckBox $radioButton) { if (!in_array($radioButton, $this->radioButtons, true)) { array_push($this->radioButtons, $radioButton); } return $this; }
[ "public", "function", "addRadioButton", "(", "CheckBox", "$", "radioButton", ")", "{", "if", "(", "!", "in_array", "(", "$", "radioButton", ",", "$", "this", "->", "radioButtons", ",", "true", ")", ")", "{", "array_push", "(", "$", "this", "->", "radioBu...
Add a new RadioButton @api @param CheckBox $radioButton RadioButton @return static
[ "Add", "a", "new", "RadioButton" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/RadioButtonGroupFeature.php#L106-L112
steeffeen/FancyManiaLinks
FML/Script/Features/RadioButtonGroupFeature.php
RadioButtonGroupFeature.prepareRadioButtonIdsConstant
protected function prepareRadioButtonIdsConstant(Script $script) { $radioButtonIds = array(); foreach ($this->radioButtons as $radioButton) { $radioButtonIds[$radioButton->getName()] = Builder::getId($radioButton->getQuad()); } $script->addScriptConstant($this->getRadioBu...
php
protected function prepareRadioButtonIdsConstant(Script $script) { $radioButtonIds = array(); foreach ($this->radioButtons as $radioButton) { $radioButtonIds[$radioButton->getName()] = Builder::getId($radioButton->getQuad()); } $script->addScriptConstant($this->getRadioBu...
[ "protected", "function", "prepareRadioButtonIdsConstant", "(", "Script", "$", "script", ")", "{", "$", "radioButtonIds", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "radioButtons", "as", "$", "radioButton", ")", "{", "$", "radioButtonIds", ...
Prepare the Constant containing the RadioButton Ids @param Script $script Script @return static
[ "Prepare", "the", "Constant", "containing", "the", "RadioButton", "Ids" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/RadioButtonGroupFeature.php#L171-L179
steeffeen/FancyManiaLinks
FML/Script/Features/RadioButtonGroupFeature.php
RadioButtonGroupFeature.prepareOnRadioButtonClickFunction
protected function prepareOnRadioButtonClickFunction(Script $script) { $script->addScriptFunction(self::FUNCTION_ON_RADIO_BUTTON_CLICK, " Void " . self::FUNCTION_ON_RADIO_BUTTON_CLICK . "(CMlQuad _RadioButtonQuad, CMlEntry _RadioButtonGroupEntry, Text[Text] _RadioButtonIds) { // update group entry with ...
php
protected function prepareOnRadioButtonClickFunction(Script $script) { $script->addScriptFunction(self::FUNCTION_ON_RADIO_BUTTON_CLICK, " Void " . self::FUNCTION_ON_RADIO_BUTTON_CLICK . "(CMlQuad _RadioButtonQuad, CMlEntry _RadioButtonGroupEntry, Text[Text] _RadioButtonIds) { // update group entry with ...
[ "protected", "function", "prepareOnRadioButtonClickFunction", "(", "Script", "$", "script", ")", "{", "$", "script", "->", "addScriptFunction", "(", "self", "::", "FUNCTION_ON_RADIO_BUTTON_CLICK", ",", "\"\nVoid \"", ".", "self", "::", "FUNCTION_ON_RADIO_BUTTON_CLICK", ...
Build the RadioButton click handler function @param Script $script Script @return static
[ "Build", "the", "RadioButton", "click", "handler", "function" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/RadioButtonGroupFeature.php#L187-L214
steeffeen/FancyManiaLinks
FML/Script/Features/RadioButtonGroupFeature.php
RadioButtonGroupFeature.prepareRadioButtonClickScript
protected function prepareRadioButtonClickScript(Script $script) { $script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK2, " if (" . $this->getRadioButtonIdsConstantName() . ".exists(Event.ControlId)) { declare RadioButtonQuad <=> (Event.Control as CMlQuad); declare RadioButtonGroupEntry <=> (Page.Get...
php
protected function prepareRadioButtonClickScript(Script $script) { $script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK2, " if (" . $this->getRadioButtonIdsConstantName() . ".exists(Event.ControlId)) { declare RadioButtonQuad <=> (Event.Control as CMlQuad); declare RadioButtonGroupEntry <=> (Page.Get...
[ "protected", "function", "prepareRadioButtonClickScript", "(", "Script", "$", "script", ")", "{", "$", "script", "->", "appendGenericScriptLabel", "(", "ScriptLabel", "::", "MOUSECLICK2", ",", "\"\nif (\"", ".", "$", "this", "->", "getRadioButtonIdsConstantName", "(",...
Prepare the script for RadioButton clicks @param Script $script Script @return static
[ "Prepare", "the", "script", "for", "RadioButton", "clicks" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/RadioButtonGroupFeature.php#L222-L231
AbuseIO/parser-google
src/Google.php
Google.parse
public function parse() { try { $xml = simplexml_load_string($this->parsedMail->getMessageBody()); } catch(\Exception $e) { $this->warningCount++; return $this->failed('XML expected, but got something else. Make sure google is set to send XML based reports!...
php
public function parse() { try { $xml = simplexml_load_string($this->parsedMail->getMessageBody()); } catch(\Exception $e) { $this->warningCount++; return $this->failed('XML expected, but got something else. Make sure google is set to send XML based reports!...
[ "public", "function", "parse", "(", ")", "{", "try", "{", "$", "xml", "=", "simplexml_load_string", "(", "$", "this", "->", "parsedMail", "->", "getMessageBody", "(", ")", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "this...
Parse attachments @return array Returns array with failed or success data (See parser-common/src/Parser.php) for more info.
[ "Parse", "attachments" ]
train
https://github.com/AbuseIO/parser-google/blob/93efb2cb6e3a15d4d42b7e1a8769e425c91b8964/src/Google.php#L29-L97
redaigbaria/oauth2
src/Grant/AuthCodeGrant.php
AuthCodeGrant.checkAuthorizeParams
public function checkAuthorizeParams() { // Get required params $clientId = $this->server->getRequest()->query->get('client_id', null); if (is_null($clientId)) { throw new Exception\InvalidRequestException('client_id'); } $redirectUri = $this->server->getRequest(...
php
public function checkAuthorizeParams() { // Get required params $clientId = $this->server->getRequest()->query->get('client_id', null); if (is_null($clientId)) { throw new Exception\InvalidRequestException('client_id'); } $redirectUri = $this->server->getRequest(...
[ "public", "function", "checkAuthorizeParams", "(", ")", "{", "// Get required params", "$", "clientId", "=", "$", "this", "->", "server", "->", "getRequest", "(", ")", "->", "query", "->", "get", "(", "'client_id'", ",", "null", ")", ";", "if", "(", "is_nu...
Check authorize parameters @return array Authorize request parameters @throws
[ "Check", "authorize", "parameters" ]
train
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Grant/AuthCodeGrant.php#L111-L163
redaigbaria/oauth2
src/Grant/AuthCodeGrant.php
AuthCodeGrant.completeFlow
public function completeFlow() { // Get the required params $clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser()); if (is_null($clientId)) { throw new Exception\InvalidRequestException('client_id'); } $clientSe...
php
public function completeFlow() { // Get the required params $clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser()); if (is_null($clientId)) { throw new Exception\InvalidRequestException('client_id'); } $clientSe...
[ "public", "function", "completeFlow", "(", ")", "{", "// Get the required params", "$", "clientId", "=", "$", "this", "->", "server", "->", "getRequest", "(", ")", "->", "request", "->", "get", "(", "'client_id'", ",", "$", "this", "->", "server", "->", "g...
Complete the auth code grant @return array @throws
[ "Complete", "the", "auth", "code", "grant" ]
train
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Grant/AuthCodeGrant.php#L206-L302
nyeholt/silverstripe-external-content
thirdparty/Zend/Feed/Rss.php
Zend_Feed_Rss._mapFeedHeaders
protected function _mapFeedHeaders($array) { $channel = $this->_element->createElement('channel'); $title = $this->_element->createElement('title'); $title->appendChild($this->_element->createCDATASection($array->title)); $channel->appendChild($title); $link = $this->_eleme...
php
protected function _mapFeedHeaders($array) { $channel = $this->_element->createElement('channel'); $title = $this->_element->createElement('title'); $title->appendChild($this->_element->createCDATASection($array->title)); $channel->appendChild($title); $link = $this->_eleme...
[ "protected", "function", "_mapFeedHeaders", "(", "$", "array", ")", "{", "$", "channel", "=", "$", "this", "->", "_element", "->", "createElement", "(", "'channel'", ")", ";", "$", "title", "=", "$", "this", "->", "_element", "->", "createElement", "(", ...
Generate the header of the feed when working in write mode @param array $array the data to use @return DOMElement root node
[ "Generate", "the", "header", "of", "the", "feed", "when", "working", "in", "write", "mode" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Rss.php#L133-L258
nyeholt/silverstripe-external-content
thirdparty/Zend/Feed/Rss.php
Zend_Feed_Rss._buildiTunes
private function _buildiTunes(DOMElement $root, $array) { /* author node */ $author = ''; if (isset($array->itunes->author)) { $author = $array->itunes->author; } elseif (isset($array->author)) { $author = $array->author; } if (!empty($author))...
php
private function _buildiTunes(DOMElement $root, $array) { /* author node */ $author = ''; if (isset($array->itunes->author)) { $author = $array->itunes->author; } elseif (isset($array->author)) { $author = $array->author; } if (!empty($author))...
[ "private", "function", "_buildiTunes", "(", "DOMElement", "$", "root", ",", "$", "array", ")", "{", "/* author node */", "$", "author", "=", "''", ";", "if", "(", "isset", "(", "$", "array", "->", "itunes", "->", "author", ")", ")", "{", "$", "author",...
Adds the iTunes extensions to a root node @param DOMElement $root @param array $array @return void
[ "Adds", "the", "iTunes", "extensions", "to", "a", "root", "node" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Rss.php#L267-L375
nyeholt/silverstripe-external-content
thirdparty/Zend/Feed/Rss.php
Zend_Feed_Rss._mapFeedEntries
protected function _mapFeedEntries(DOMElement $root, $array) { Zend_Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); foreach ($array as $dataentry) { $item = $this->_element->createElement('item'); $title = $this->_element->createElement('titl...
php
protected function _mapFeedEntries(DOMElement $root, $array) { Zend_Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); foreach ($array as $dataentry) { $item = $this->_element->createElement('item'); $title = $this->_element->createElement('titl...
[ "protected", "function", "_mapFeedEntries", "(", "DOMElement", "$", "root", ",", "$", "array", ")", "{", "Zend_Feed", "::", "registerNamespace", "(", "'content'", ",", "'http://purl.org/rss/1.0/modules/content/'", ")", ";", "foreach", "(", "$", "array", "as", "$",...
Generate the entries of the feed when working in write mode The following nodes are constructed for each feed entry <item> <title>entry title</title> <link>url to feed entry</link> <guid>url to feed entry</guid> <description>short text</description> <content:encoded>long version, can contain html</content:encoded> </i...
[ "Generate", "the", "entries", "of", "the", "feed", "when", "working", "in", "write", "mode" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Rss.php#L393-L475
nyeholt/silverstripe-external-content
thirdparty/Zend/Feed/Rss.php
Zend_Feed_Rss.saveXml
public function saveXml() { // Return a complete document including XML prologue. $doc = new DOMDocument($this->_element->ownerDocument->version, $this->_element->ownerDocument->actualEncoding); $root = $doc->createElement('rss'); // Use rss version 2....
php
public function saveXml() { // Return a complete document including XML prologue. $doc = new DOMDocument($this->_element->ownerDocument->version, $this->_element->ownerDocument->actualEncoding); $root = $doc->createElement('rss'); // Use rss version 2....
[ "public", "function", "saveXml", "(", ")", "{", "// Return a complete document including XML prologue.", "$", "doc", "=", "new", "DOMDocument", "(", "$", "this", "->", "_element", "->", "ownerDocument", "->", "version", ",", "$", "this", "->", "_element", "->", ...
Override Zend_Feed_Element to include <rss> root node @return string
[ "Override", "Zend_Feed_Element", "to", "include", "<rss", ">", "root", "node" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Rss.php#L482-L503
fond-of/spryker-brand
src/FondOfSpryker/Zed/Brand/Persistence/Mapper/BrandMapper.php
BrandMapper.mapCollectionTransfer
public function mapCollectionTransfer(array $brandEntityTransferCollection): BrandCollectionTransfer { $brandCollectionTransfer = new BrandCollectionTransfer(); foreach ($brandEntityTransferCollection as $brandEntityTransfer) { $brandTransfer = $this->mapBrandTransfer($brandEntityTransfe...
php
public function mapCollectionTransfer(array $brandEntityTransferCollection): BrandCollectionTransfer { $brandCollectionTransfer = new BrandCollectionTransfer(); foreach ($brandEntityTransferCollection as $brandEntityTransfer) { $brandTransfer = $this->mapBrandTransfer($brandEntityTransfe...
[ "public", "function", "mapCollectionTransfer", "(", "array", "$", "brandEntityTransferCollection", ")", ":", "BrandCollectionTransfer", "{", "$", "brandCollectionTransfer", "=", "new", "BrandCollectionTransfer", "(", ")", ";", "foreach", "(", "$", "brandEntityTransferColl...
@param \Generated\Shared\Transfer\FosBrandEntityTransfer[] $brandEntityTransferCollection @return \Generated\Shared\Transfer\BrandCollectionTransfer
[ "@param", "\\", "Generated", "\\", "Shared", "\\", "Transfer", "\\", "FosBrandEntityTransfer", "[]", "$brandEntityTransferCollection" ]
train
https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Persistence/Mapper/BrandMapper.php#L32-L41
fond-of/spryker-brand
src/FondOfSpryker/Zed/Brand/Persistence/Mapper/BrandMapper.php
BrandMapper.mapBrandTransfer
public function mapBrandTransfer(FosBrandEntityTransfer $brandEntityTransfer): BrandTransfer { $brandTransfer = new BrandTransfer(); $brandTransfer->fromArray($brandEntityTransfer->toArray(), true); return $brandTransfer; }
php
public function mapBrandTransfer(FosBrandEntityTransfer $brandEntityTransfer): BrandTransfer { $brandTransfer = new BrandTransfer(); $brandTransfer->fromArray($brandEntityTransfer->toArray(), true); return $brandTransfer; }
[ "public", "function", "mapBrandTransfer", "(", "FosBrandEntityTransfer", "$", "brandEntityTransfer", ")", ":", "BrandTransfer", "{", "$", "brandTransfer", "=", "new", "BrandTransfer", "(", ")", ";", "$", "brandTransfer", "->", "fromArray", "(", "$", "brandEntityTran...
@param \Generated\Shared\Transfer\FosBrandEntityTransfer $brandEntityTransfer @return \Generated\Shared\Transfer\BrandTransfer
[ "@param", "\\", "Generated", "\\", "Shared", "\\", "Transfer", "\\", "FosBrandEntityTransfer", "$brandEntityTransfer" ]
train
https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Persistence/Mapper/BrandMapper.php#L48-L55
rayrutjes/domain-foundation
src/Domain/Event/Container/DefaultEventContainer.php
DefaultEventContainer.addEvent
public function addEvent(Event $event) { $expectedSequenceNumber = $this->nextSequenceNumber(); if ($expectedSequenceNumber !== $event->sequenceNumber()) { throw new \RuntimeException('Corrupted sequence number.'); } $this->events[] = $this->applyRegistrationCallbacks($e...
php
public function addEvent(Event $event) { $expectedSequenceNumber = $this->nextSequenceNumber(); if ($expectedSequenceNumber !== $event->sequenceNumber()) { throw new \RuntimeException('Corrupted sequence number.'); } $this->events[] = $this->applyRegistrationCallbacks($e...
[ "public", "function", "addEvent", "(", "Event", "$", "event", ")", "{", "$", "expectedSequenceNumber", "=", "$", "this", "->", "nextSequenceNumber", "(", ")", ";", "if", "(", "$", "expectedSequenceNumber", "!==", "$", "event", "->", "sequenceNumber", "(", ")...
@param Event $event @throws \Exception
[ "@param", "Event", "$event" ]
train
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Domain/Event/Container/DefaultEventContainer.php#L65-L73
rayrutjes/domain-foundation
src/Domain/Event/Container/DefaultEventContainer.php
DefaultEventContainer.applyRegistrationCallbacks
private function applyRegistrationCallbacks(Event $event) { foreach ($this->registrationCallbacks as $callback) { $event = $callback->onEventRegistration($event); } return $event; }
php
private function applyRegistrationCallbacks(Event $event) { foreach ($this->registrationCallbacks as $callback) { $event = $callback->onEventRegistration($event); } return $event; }
[ "private", "function", "applyRegistrationCallbacks", "(", "Event", "$", "event", ")", "{", "foreach", "(", "$", "this", "->", "registrationCallbacks", "as", "$", "callback", ")", "{", "$", "event", "=", "$", "callback", "->", "onEventRegistration", "(", "$", ...
@param Event $event @return Event
[ "@param", "Event", "$event" ]
train
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Domain/Event/Container/DefaultEventContainer.php#L146-L153
parsnick/steak
src/Application.php
Application.configureOutput
protected function configureOutput() { $this->output = new ConsoleOutput(); $this->output->getFormatter()->setStyle('path', new OutputFormatterStyle('green', null, ['bold'])); $this->output->getFormatter()->setStyle('time', new OutputFormatterStyle('cyan', null, ['bold'])); $this->o...
php
protected function configureOutput() { $this->output = new ConsoleOutput(); $this->output->getFormatter()->setStyle('path', new OutputFormatterStyle('green', null, ['bold'])); $this->output->getFormatter()->setStyle('time', new OutputFormatterStyle('cyan', null, ['bold'])); $this->o...
[ "protected", "function", "configureOutput", "(", ")", "{", "$", "this", "->", "output", "=", "new", "ConsoleOutput", "(", ")", ";", "$", "this", "->", "output", "->", "getFormatter", "(", ")", "->", "setStyle", "(", "'path'", ",", "new", "OutputFormatterSt...
Configure the console output with custom styles.
[ "Configure", "the", "console", "output", "with", "custom", "styles", "." ]
train
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L67-L74
parsnick/steak
src/Application.php
Application.loadExternalConfig
protected function loadExternalConfig() { $config = new Repository(static::getDefaultConfig()); $filesystem = new Filesystem(); foreach ($this->getConfigFiles($filesystem) as $filename) { $this->output->writeln("<info>Reading config from <path>{$filename}</path></info>"); ...
php
protected function loadExternalConfig() { $config = new Repository(static::getDefaultConfig()); $filesystem = new Filesystem(); foreach ($this->getConfigFiles($filesystem) as $filename) { $this->output->writeln("<info>Reading config from <path>{$filename}</path></info>"); ...
[ "protected", "function", "loadExternalConfig", "(", ")", "{", "$", "config", "=", "new", "Repository", "(", "static", "::", "getDefaultConfig", "(", ")", ")", ";", "$", "filesystem", "=", "new", "Filesystem", "(", ")", ";", "foreach", "(", "$", "this", "...
Load the external config files specified by the command line option.
[ "Load", "the", "external", "config", "files", "specified", "by", "the", "command", "line", "option", "." ]
train
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L80-L99
parsnick/steak
src/Application.php
Application.getConfigFiles
protected function getConfigFiles($files, array $defaults = ['steak.yml', 'steak.php']) { $option = (new ArgvInput())->getParameterOption(['--config', '-c']); if ( ! $option) { foreach ($defaults as $default) { if ($files->exists($default)) { $option ...
php
protected function getConfigFiles($files, array $defaults = ['steak.yml', 'steak.php']) { $option = (new ArgvInput())->getParameterOption(['--config', '-c']); if ( ! $option) { foreach ($defaults as $default) { if ($files->exists($default)) { $option ...
[ "protected", "function", "getConfigFiles", "(", "$", "files", ",", "array", "$", "defaults", "=", "[", "'steak.yml'", ",", "'steak.php'", "]", ")", "{", "$", "option", "=", "(", "new", "ArgvInput", "(", ")", ")", "->", "getParameterOption", "(", "[", "'-...
Parse the command line option for config file to use. Multiple files can be given as a comma-separated list. If no option is given, defaults as used. @param Filesystem $files @param array $defaults @return array
[ "Parse", "the", "command", "line", "option", "for", "config", "file", "to", "use", "." ]
train
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L111-L124
parsnick/steak
src/Application.php
Application.bootstrap
protected function bootstrap() { return array_walk($this->bootClasses, function ($bootstrapClass) { $this->container->make($bootstrapClass)->boot($this->container); }); }
php
protected function bootstrap() { return array_walk($this->bootClasses, function ($bootstrapClass) { $this->container->make($bootstrapClass)->boot($this->container); }); }
[ "protected", "function", "bootstrap", "(", ")", "{", "return", "array_walk", "(", "$", "this", "->", "bootClasses", ",", "function", "(", "$", "bootstrapClass", ")", "{", "$", "this", "->", "container", "->", "make", "(", "$", "bootstrapClass", ")", "->", ...
Bootstrap the application. @return bool
[ "Bootstrap", "the", "application", "." ]
train
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L131-L136
parsnick/steak
src/Application.php
Application.registerCommand
public function registerCommand($commandClass) { $command = $this->container->make($commandClass); $command->setContainer($this->container); return $this->symfony->add($command); }
php
public function registerCommand($commandClass) { $command = $this->container->make($commandClass); $command->setContainer($this->container); return $this->symfony->add($command); }
[ "public", "function", "registerCommand", "(", "$", "commandClass", ")", "{", "$", "command", "=", "$", "this", "->", "container", "->", "make", "(", "$", "commandClass", ")", ";", "$", "command", "->", "setContainer", "(", "$", "this", "->", "container", ...
Register a single command. @param string $commandClass @return \Symfony\Component\Console\Command\Command
[ "Register", "a", "single", "command", "." ]
train
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L159-L166
parsnick/steak
src/Application.php
Application.run
public function run() { $this->symfony->getDefinition()->addOption( new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Path to steak configuration file', null) ); return $this->symfony->run(null, $this->output); }
php
public function run() { $this->symfony->getDefinition()->addOption( new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Path to steak configuration file', null) ); return $this->symfony->run(null, $this->output); }
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "symfony", "->", "getDefinition", "(", ")", "->", "addOption", "(", "new", "InputOption", "(", "'config'", ",", "'c'", ",", "InputOption", "::", "VALUE_REQUIRED", ",", "'Path to steak configuration...
Run the application. @return int @throws \Exception
[ "Run", "the", "application", "." ]
train
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Application.php#L174-L181
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.setScriptInclude
public function setScriptInclude($file, $namespace = null) { if ($file instanceof ScriptInclude) { $scriptInclude = $file; } else { $scriptInclude = new ScriptInclude($file, $namespace); } $this->includes[$scriptInclude->getNamespace()] = $scriptInclude; ...
php
public function setScriptInclude($file, $namespace = null) { if ($file instanceof ScriptInclude) { $scriptInclude = $file; } else { $scriptInclude = new ScriptInclude($file, $namespace); } $this->includes[$scriptInclude->getNamespace()] = $scriptInclude; ...
[ "public", "function", "setScriptInclude", "(", "$", "file", ",", "$", "namespace", "=", "null", ")", "{", "if", "(", "$", "file", "instanceof", "ScriptInclude", ")", "{", "$", "scriptInclude", "=", "$", "file", ";", "}", "else", "{", "$", "scriptInclude"...
Set a Script Include @api @param string|ScriptInclude $file Include file or ScriptInclude @param string $namespace Include namespace @return static
[ "Set", "a", "Script", "Include" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L75-L84
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.addScriptConstant
public function addScriptConstant($name, $value = null) { if ($name instanceof ScriptConstant) { $scriptConstant = $name; } else { $scriptConstant = new ScriptConstant($name, $value); } if (!in_array($scriptConstant, $this->constants)) { array_push...
php
public function addScriptConstant($name, $value = null) { if ($name instanceof ScriptConstant) { $scriptConstant = $name; } else { $scriptConstant = new ScriptConstant($name, $value); } if (!in_array($scriptConstant, $this->constants)) { array_push...
[ "public", "function", "addScriptConstant", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "if", "(", "$", "name", "instanceof", "ScriptConstant", ")", "{", "$", "scriptConstant", "=", "$", "name", ";", "}", "else", "{", "$", "scriptConstant"...
Add a Script Constant @api @param string|ScriptConstant $name Constant name or ScriptConstant @param string $value Constant value @return static
[ "Add", "a", "Script", "Constant" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L104-L115
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.addScriptFunction
public function addScriptFunction($name, $text = null) { if ($name instanceof ScriptFunction) { $scriptFunction = $name; } else { $scriptFunction = new ScriptFunction($name, $text); } if (!in_array($scriptFunction, $this->functions)) { array_push($...
php
public function addScriptFunction($name, $text = null) { if ($name instanceof ScriptFunction) { $scriptFunction = $name; } else { $scriptFunction = new ScriptFunction($name, $text); } if (!in_array($scriptFunction, $this->functions)) { array_push($...
[ "public", "function", "addScriptFunction", "(", "$", "name", ",", "$", "text", "=", "null", ")", "{", "if", "(", "$", "name", "instanceof", "ScriptFunction", ")", "{", "$", "scriptFunction", "=", "$", "name", ";", "}", "else", "{", "$", "scriptFunction",...
Add a Script Function @api @param string|ScriptFunction $name Function name or ScriptFunction @param string $text Function text @return static
[ "Add", "a", "Script", "Function" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L135-L146
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.addCustomScriptLabel
public function addCustomScriptLabel($name, $text = null) { if ($name instanceof ScriptLabel) { $scriptLabel = $name; } else { $scriptLabel = new ScriptLabel($name, $text); } if (!in_array($scriptLabel, $this->customLabels)) { array_push($this->cus...
php
public function addCustomScriptLabel($name, $text = null) { if ($name instanceof ScriptLabel) { $scriptLabel = $name; } else { $scriptLabel = new ScriptLabel($name, $text); } if (!in_array($scriptLabel, $this->customLabels)) { array_push($this->cus...
[ "public", "function", "addCustomScriptLabel", "(", "$", "name", ",", "$", "text", "=", "null", ")", "{", "if", "(", "$", "name", "instanceof", "ScriptLabel", ")", "{", "$", "scriptLabel", "=", "$", "name", ";", "}", "else", "{", "$", "scriptLabel", "="...
Add a custom Script text @api @param string|ScriptLabel $name Label name or ScriptLabel @param string $text Script text @return static
[ "Add", "a", "custom", "Script", "text" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L156-L167
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.appendGenericScriptLabel
public function appendGenericScriptLabel($name, $text = null, $isolated = false) { if ($name instanceof ScriptLabel) { $scriptLabel = $name; } else { $scriptLabel = new ScriptLabel($name, $text, $isolated); } if (!in_array($scriptLabel, $this->genericLabels)) ...
php
public function appendGenericScriptLabel($name, $text = null, $isolated = false) { if ($name instanceof ScriptLabel) { $scriptLabel = $name; } else { $scriptLabel = new ScriptLabel($name, $text, $isolated); } if (!in_array($scriptLabel, $this->genericLabels)) ...
[ "public", "function", "appendGenericScriptLabel", "(", "$", "name", ",", "$", "text", "=", "null", ",", "$", "isolated", "=", "false", ")", "{", "if", "(", "$", "name", "instanceof", "ScriptLabel", ")", "{", "$", "scriptLabel", "=", "$", "name", ";", "...
Append a generic Script text for the next rendering @TODO: get rid of generic script labels approach @param string|ScriptLabel $name Label name or ScriptLabel @param string $text Script text @param bool $isolated (optional) Whether to isolate the Label Script @return static
[ "Append", "a", "generic", "Script", "text", "for", "the", "next", "rendering" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L188-L199
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.addFeature
public function addFeature(ScriptFeature $feature) { if (!in_array($feature, $this->features, true)) { array_push($this->features, $feature); } return $this; }
php
public function addFeature(ScriptFeature $feature) { if (!in_array($feature, $this->features, true)) { array_push($this->features, $feature); } return $this; }
[ "public", "function", "addFeature", "(", "ScriptFeature", "$", "feature", ")", "{", "if", "(", "!", "in_array", "(", "$", "feature", ",", "$", "this", "->", "features", ",", "true", ")", ")", "{", "array_push", "(", "$", "this", "->", "features", ",", ...
Add a Script Feature @api @param ScriptFeature $feature Script Feature @return static
[ "Add", "a", "Script", "Feature" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L220-L226
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.buildScriptText
public function buildScriptText() { $scriptText = PHP_EOL; $scriptText .= $this->getHeaderComment(); $scriptText .= $this->getIncludes(); $scriptText .= $this->getConstants(); $scriptText .= $this->getFunctions(); $scriptText .= $this->getLabels(); $scriptText...
php
public function buildScriptText() { $scriptText = PHP_EOL; $scriptText .= $this->getHeaderComment(); $scriptText .= $this->getIncludes(); $scriptText .= $this->getConstants(); $scriptText .= $this->getFunctions(); $scriptText .= $this->getLabels(); $scriptText...
[ "public", "function", "buildScriptText", "(", ")", "{", "$", "scriptText", "=", "PHP_EOL", ";", "$", "scriptText", ".=", "$", "this", "->", "getHeaderComment", "(", ")", ";", "$", "scriptText", ".=", "$", "this", "->", "getIncludes", "(", ")", ";", "$", ...
Build the complete Script text @return string
[ "Build", "the", "complete", "Script", "text" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L272-L282
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.render
public function render(\DOMDocument $domDocument) { $this->loadFeatures($this->features); $scriptXml = $domDocument->createElement("script"); $scriptText = $this->buildScriptText(); $scriptComment = $domDocument->createComment($scriptText); $scriptXml->appendChild($scriptC...
php
public function render(\DOMDocument $domDocument) { $this->loadFeatures($this->features); $scriptXml = $domDocument->createElement("script"); $scriptText = $this->buildScriptText(); $scriptComment = $domDocument->createComment($scriptText); $scriptXml->appendChild($scriptC...
[ "public", "function", "render", "(", "\\", "DOMDocument", "$", "domDocument", ")", "{", "$", "this", "->", "loadFeatures", "(", "$", "this", "->", "features", ")", ";", "$", "scriptXml", "=", "$", "domDocument", "->", "createElement", "(", "\"script\"", ")...
Render the Script @param \DOMDocument $domDocument DOMDocument for which the Script should be created @return \DOMElement
[ "Render", "the", "Script" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L290-L301
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.getLabels
protected function getLabels() { $customLabelsText = implode(PHP_EOL, $this->customLabels); $genericLabelsText = implode(PHP_EOL, $this->genericLabels); return $customLabelsText . $genericLabelsText; }
php
protected function getLabels() { $customLabelsText = implode(PHP_EOL, $this->customLabels); $genericLabelsText = implode(PHP_EOL, $this->genericLabels); return $customLabelsText . $genericLabelsText; }
[ "protected", "function", "getLabels", "(", ")", "{", "$", "customLabelsText", "=", "implode", "(", "PHP_EOL", ",", "$", "this", "->", "customLabels", ")", ";", "$", "genericLabelsText", "=", "implode", "(", "PHP_EOL", ",", "$", "this", "->", "genericLabels",...
Get the Labels text @return string
[ "Get", "the", "Labels", "text" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L361-L366
steeffeen/FancyManiaLinks
FML/Script/Script.php
Script.getMainFunction
protected function getMainFunction() { $mainFunction = ' Void FML_Dummy() {} main() { declare ' . self::VAR_ScriptStart . ' = Now; +++' . ScriptLabel::ONINIT . '+++ declare ' . self::VAR_LoopCounter . ' = 0; declare ' . self::VAR_LastTick . ' = 0; while (True) { yield; foreach (Event in PendingEven...
php
protected function getMainFunction() { $mainFunction = ' Void FML_Dummy() {} main() { declare ' . self::VAR_ScriptStart . ' = Now; +++' . ScriptLabel::ONINIT . '+++ declare ' . self::VAR_LoopCounter . ' = 0; declare ' . self::VAR_LastTick . ' = 0; while (True) { yield; foreach (Event in PendingEven...
[ "protected", "function", "getMainFunction", "(", ")", "{", "$", "mainFunction", "=", "'\nVoid FML_Dummy() {}\nmain() {\n\tdeclare '", ".", "self", "::", "VAR_ScriptStart", ".", "' = Now;\n\t+++'", ".", "ScriptLabel", "::", "ONINIT", ".", "'+++\n\tdeclare '", ".", "self"...
Get the main function text @return string
[ "Get", "the", "main", "function", "text" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Script.php#L373-L412
Chill-project/Main
Command/LoadAndUpdateLanguagesCommand.php
LoadAndUpdateLanguagesCommand.configure
protected function configure() { $this ->setName('chill:main:languages:populate') ->setDescription('Load or update languages in db. This command does not delete existing '. 'languages, but will update names according to available languages') ->addOption( ...
php
protected function configure() { $this ->setName('chill:main:languages:populate') ->setDescription('Load or update languages in db. This command does not delete existing '. 'languages, but will update names according to available languages') ->addOption( ...
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "setName", "(", "'chill:main:languages:populate'", ")", "->", "setDescription", "(", "'Load or update languages in db. This command does not delete existing '", ".", "'languages, but will update names accordi...
/* (non-PHPdoc) @see \Symfony\Component\Console\Command\Command::configure()
[ "/", "*", "(", "non", "-", "PHPdoc", ")" ]
train
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Command/LoadAndUpdateLanguagesCommand.php#L48-L67
Chill-project/Main
Command/LoadAndUpdateLanguagesCommand.php
LoadAndUpdateLanguagesCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $em = $this->getContainer()->get('doctrine.orm.entity_manager'); $chillAvailableLanguages = $this->getContainer()->getParameter('chill_main.available_languages'); $languageBundle = Intl::getLanguageBundle(); ...
php
protected function execute(InputInterface $input, OutputInterface $output) { $em = $this->getContainer()->get('doctrine.orm.entity_manager'); $chillAvailableLanguages = $this->getContainer()->getParameter('chill_main.available_languages'); $languageBundle = Intl::getLanguageBundle(); ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "em", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'doctrine.orm.entity_manager'", ")", ";", "$", "chillAva...
/* (non-PHPdoc) @see \Symfony\Component\Console\Command\Command::execute()
[ "/", "*", "(", "non", "-", "PHPdoc", ")" ]
train
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Command/LoadAndUpdateLanguagesCommand.php#L73-L123
simple-php-mvc/simple-php-mvc
src/MVC/REST/REST.php
REST.getConnect
protected function getConnect($uri, $method, $content_type) { $connect = curl_init($this->baseUrl . $uri); curl_setopt($connect, CURLOPT_USERAGENT, "MVC REST by Ramón Serrano"); curl_setopt($connect, CURLOPT_SSLVERSION, 3); curl_setopt($connect, CURLOPT_RETURNTRANSFER, true); ...
php
protected function getConnect($uri, $method, $content_type) { $connect = curl_init($this->baseUrl . $uri); curl_setopt($connect, CURLOPT_USERAGENT, "MVC REST by Ramón Serrano"); curl_setopt($connect, CURLOPT_SSLVERSION, 3); curl_setopt($connect, CURLOPT_RETURNTRANSFER, true); ...
[ "protected", "function", "getConnect", "(", "$", "uri", ",", "$", "method", ",", "$", "content_type", ")", "{", "$", "connect", "=", "curl_init", "(", "$", "this", "->", "baseUrl", ".", "$", "uri", ")", ";", "curl_setopt", "(", "$", "connect", ",", "...
Init curl resource @access protected @param string $uri @param string $method @param string $content_type @return resource
[ "Init", "curl", "resource" ]
train
https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/REST/REST.php#L50-L61
simple-php-mvc/simple-php-mvc
src/MVC/REST/REST.php
REST.setData
protected function setData(&$connect, $data, $content_type) { if ($content_type == "application/json") { if (gettype($data) == "string") { json_decode($data, true); } else { $data = json_encode($data); } if (function_exists('js...
php
protected function setData(&$connect, $data, $content_type) { if ($content_type == "application/json") { if (gettype($data) == "string") { json_decode($data, true); } else { $data = json_encode($data); } if (function_exists('js...
[ "protected", "function", "setData", "(", "&", "$", "connect", ",", "$", "data", ",", "$", "content_type", ")", "{", "if", "(", "$", "content_type", "==", "\"application/json\"", ")", "{", "if", "(", "gettype", "(", "$", "data", ")", "==", "\"string\"", ...
Sets the data request @access protected @param resource $connect @param type $data @param string $content_type @return void @throws \Exception
[ "Sets", "the", "data", "request" ]
train
https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/REST/REST.php#L72-L90
simple-php-mvc/simple-php-mvc
src/MVC/REST/REST.php
REST.exec
protected function exec($method, $uri, $data, $content_type) { $connect = $this->getConnect($uri, $method, $content_type); if ($data) { $this->setData($connect, $data, $content_type); } $api_result = curl_exec($connect); $api_http_code = curl_getinfo($connect, CU...
php
protected function exec($method, $uri, $data, $content_type) { $connect = $this->getConnect($uri, $method, $content_type); if ($data) { $this->setData($connect, $data, $content_type); } $api_result = curl_exec($connect); $api_http_code = curl_getinfo($connect, CU...
[ "protected", "function", "exec", "(", "$", "method", ",", "$", "uri", ",", "$", "data", ",", "$", "content_type", ")", "{", "$", "connect", "=", "$", "this", "->", "getConnect", "(", "$", "uri", ",", "$", "method", ",", "$", "content_type", ")", ";...
Executes the request @access protected @param string $method @param string $uri @param type $data @param string $content_type @return array @throws \Exception
[ "Executes", "the", "request" ]
train
https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/REST/REST.php#L102-L131
zircote/AMQP
library/AMQP/Wire/Reader.php
Reader.readPhpInt
public function readPhpInt() { list(, $res) = unpack('N', $this->_rawread(4)); if ($this->_is64bits) { $sres = sprintf("%u", $res); return (int)$sres; } else { return $res; } }
php
public function readPhpInt() { list(, $res) = unpack('N', $this->_rawread(4)); if ($this->_is64bits) { $sres = sprintf("%u", $res); return (int)$sres; } else { return $res; } }
[ "public", "function", "readPhpInt", "(", ")", "{", "list", "(", ",", "$", "res", ")", "=", "unpack", "(", "'N'", ",", "$", "this", "->", "_rawread", "(", "4", ")", ")", ";", "if", "(", "$", "this", "->", "_is64bits", ")", "{", "$", "sres", "=",...
Reads 32 bit integer in big-endian byte order. On 64 bit systems it will return always usngined int value in 0..2^32 range. On 32 bit systems it will return signed int value in -2^31...+2^31 range. Use with caution! @return int
[ "Reads", "32", "bit", "integer", "in", "big", "-", "endian", "byte", "order", "." ]
train
https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/Reader.php#L144-L153
zircote/AMQP
library/AMQP/Wire/Reader.php
Reader.readLong
public function readLong() { $this->_bitcount = $this->_bits = 0; list(, $res) = unpack('N', $this->_rawread(4)); $sres = sprintf("%u", $res); return $sres; }
php
public function readLong() { $this->_bitcount = $this->_bits = 0; list(, $res) = unpack('N', $this->_rawread(4)); $sres = sprintf("%u", $res); return $sres; }
[ "public", "function", "readLong", "(", ")", "{", "$", "this", "->", "_bitcount", "=", "$", "this", "->", "_bits", "=", "0", ";", "list", "(", ",", "$", "res", ")", "=", "unpack", "(", "'N'", ",", "$", "this", "->", "_rawread", "(", "4", ")", ")...
PHP does not have unsigned 32 bit int, so we return it as a string @return string
[ "PHP", "does", "not", "have", "unsigned", "32", "bit", "int", "so", "we", "return", "it", "as", "a", "string" ]
train
https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/Reader.php#L160-L166
zircote/AMQP
library/AMQP/Wire/Reader.php
Reader.readShortstr
public function readShortstr() { $this->_bitcount = $this->_bits = 0; list(, $slen) = unpack('C', $this->_rawread(1)); return $this->_rawread($slen); }
php
public function readShortstr() { $this->_bitcount = $this->_bits = 0; list(, $slen) = unpack('C', $this->_rawread(1)); return $this->_rawread($slen); }
[ "public", "function", "readShortstr", "(", ")", "{", "$", "this", "->", "_bitcount", "=", "$", "this", "->", "_bits", "=", "0", ";", "list", "(", ",", "$", "slen", ")", "=", "unpack", "(", "'C'", ",", "$", "this", "->", "_rawread", "(", "1", ")",...
Read a utf-8 encoded string that's stored in up to 255 bytes. Return it decoded as a PHP unicode object. @return string
[ "Read", "a", "utf", "-", "8", "encoded", "string", "that", "s", "stored", "in", "up", "to", "255", "bytes", ".", "Return", "it", "decoded", "as", "a", "PHP", "unicode", "object", "." ]
train
https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/Reader.php#L198-L203
zircote/AMQP
library/AMQP/Wire/Reader.php
Reader.readLongstr
public function readLongstr() { $this->_bitcount = $this->_bits = 0; $slen = $this->readPhpInt(); if ($slen < 0) { throw new \Exception("Strings longer than supported on this platform"); } return $this->_rawread($slen); }
php
public function readLongstr() { $this->_bitcount = $this->_bits = 0; $slen = $this->readPhpInt(); if ($slen < 0) { throw new \Exception("Strings longer than supported on this platform"); } return $this->_rawread($slen); }
[ "public", "function", "readLongstr", "(", ")", "{", "$", "this", "->", "_bitcount", "=", "$", "this", "->", "_bits", "=", "0", ";", "$", "slen", "=", "$", "this", "->", "readPhpInt", "(", ")", ";", "if", "(", "$", "slen", "<", "0", ")", "{", "t...
Read a string that's up to 2**32 bytes, the encoding isn't specified in the AMQP spec, so just return it as a plain PHP string. @return string @throws \Exception
[ "Read", "a", "string", "that", "s", "up", "to", "2", "**", "32", "bytes", "the", "encoding", "isn", "t", "specified", "in", "the", "AMQP", "spec", "so", "just", "return", "it", "as", "a", "plain", "PHP", "string", "." ]
train
https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/Reader.php#L213-L221
zircote/AMQP
library/AMQP/Wire/Reader.php
Reader.readTable
public function readTable() { $this->_bitcount = $this->_bits = 0; $tlen = $this->readPhpInt(); if ($tlen < 0) { throw new \Exception('Table is longer than supported'); } $tableData = new Reader($this->_rawread($tlen)); $result = array(); while ($t...
php
public function readTable() { $this->_bitcount = $this->_bits = 0; $tlen = $this->readPhpInt(); if ($tlen < 0) { throw new \Exception('Table is longer than supported'); } $tableData = new Reader($this->_rawread($tlen)); $result = array(); while ($t...
[ "public", "function", "readTable", "(", ")", "{", "$", "this", "->", "_bitcount", "=", "$", "this", "->", "_bits", "=", "0", ";", "$", "tlen", "=", "$", "this", "->", "readPhpInt", "(", ")", ";", "if", "(", "$", "tlen", "<", "0", ")", "{", "thr...
Read an AMQP table, and return as a PHP array. keys are strings, values are (type,value) tuples. @return array @throws \Exception
[ "Read", "an", "AMQP", "table", "and", "return", "as", "a", "PHP", "array", ".", "keys", "are", "strings", "values", "are", "(", "type", "value", ")", "tuples", "." ]
train
https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/Reader.php#L241-L272
zircote/AMQP
library/AMQP/Wire/Reader.php
Reader._rawread
protected function _rawread($n) { if ($this->_bufferedInput) { $result = ''; $read = 0; while ($read < $n && !feof($this->_bufferedInput->realSock()) && (false !== ($buffer = fread($this->_bufferedInput->realSock(), $n - $read))) ) { ...
php
protected function _rawread($n) { if ($this->_bufferedInput) { $result = ''; $read = 0; while ($read < $n && !feof($this->_bufferedInput->realSock()) && (false !== ($buffer = fread($this->_bufferedInput->realSock(), $n - $read))) ) { ...
[ "protected", "function", "_rawread", "(", "$", "n", ")", "{", "if", "(", "$", "this", "->", "_bufferedInput", ")", "{", "$", "result", "=", "''", ";", "$", "read", "=", "0", ";", "while", "(", "$", "read", "<", "$", "n", "&&", "!", "feof", "(",...
@param $n @return string @throws \Exception
[ "@param", "$n" ]
train
https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/Reader.php#L280-L322
Double-Opt-in/php-client-api
src/Client/Commands/Responses/StatusResponse.php
StatusResponse.status
public function status() { if ($this->status === null) { $stdClass = $this->decoded(); if ( ! $stdClass instanceof stdClass) return null; $this->status = $this->resolveStatusFromStdClass($stdClass); } return $this->status; }
php
public function status() { if ($this->status === null) { $stdClass = $this->decoded(); if ( ! $stdClass instanceof stdClass) return null; $this->status = $this->resolveStatusFromStdClass($stdClass); } return $this->status; }
[ "public", "function", "status", "(", ")", "{", "if", "(", "$", "this", "->", "status", "===", "null", ")", "{", "$", "stdClass", "=", "$", "this", "->", "decoded", "(", ")", ";", "if", "(", "!", "$", "stdClass", "instanceof", "stdClass", ")", "retu...
returns the status model @return Status|null
[ "returns", "the", "status", "model" ]
train
https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/Responses/StatusResponse.php#L27-L38
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/LocationManager.php
LocationManager.find
public function find(ValueObject $object) { try { if (isset($object->data['remote_id'])) { $location = $this->locationService->loadLocationByRemoteId($object->data['remote_id']); } elseif ($object->getProperty('id')) { $location = $this->locationServic...
php
public function find(ValueObject $object) { try { if (isset($object->data['remote_id'])) { $location = $this->locationService->loadLocationByRemoteId($object->data['remote_id']); } elseif ($object->getProperty('id')) { $location = $this->locationServic...
[ "public", "function", "find", "(", "ValueObject", "$", "object", ")", "{", "try", "{", "if", "(", "isset", "(", "$", "object", "->", "data", "[", "'remote_id'", "]", ")", ")", "{", "$", "location", "=", "$", "this", "->", "locationService", "->", "lo...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/LocationManager.php#L71-L90
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/LocationManager.php
LocationManager.getLocationByObject
private function getLocationByObject(ValueObject $object) { $contentInfo = $this->contentService->loadContentInfo($object->data['content_id']); $locations = $this->locationService->loadLocations($contentInfo); foreach ($locations as $loc) { if ($loc->parentLocationId === $object-...
php
private function getLocationByObject(ValueObject $object) { $contentInfo = $this->contentService->loadContentInfo($object->data['content_id']); $locations = $this->locationService->loadLocations($contentInfo); foreach ($locations as $loc) { if ($loc->parentLocationId === $object-...
[ "private", "function", "getLocationByObject", "(", "ValueObject", "$", "object", ")", "{", "$", "contentInfo", "=", "$", "this", "->", "contentService", "->", "loadContentInfo", "(", "$", "object", "->", "data", "[", "'content_id'", "]", ")", ";", "$", "loca...
Get location by content_id and parent_location_id. @param ValueObject $object @return Location|null
[ "Get", "location", "by", "content_id", "and", "parent_location_id", "." ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/LocationManager.php#L99-L110
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/LocationManager.php
LocationManager.create
public function create(ObjectInterface $object) { if (!$object instanceof LocationObject) { throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); } $contentInfo = $this->contentService->loadContentInfo($object->data['content_id']); $l...
php
public function create(ObjectInterface $object) { if (!$object instanceof LocationObject) { throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); } $contentInfo = $this->contentService->loadContentInfo($object->data['content_id']); $l...
[ "public", "function", "create", "(", "ObjectInterface", "$", "object", ")", "{", "if", "(", "!", "$", "object", "instanceof", "LocationObject", ")", "{", "throw", "new", "UnsupportedObjectOperationException", "(", "LocationObject", "::", "class", ",", "get_class",...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/LocationManager.php#L129-L150
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/LocationManager.php
LocationManager.update
public function update(ObjectInterface $object) { if (!$object instanceof LocationObject) { throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); } $location = $this->find($object); // Move if parent_location_id differs. if (i...
php
public function update(ObjectInterface $object) { if (!$object instanceof LocationObject) { throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); } $location = $this->find($object); // Move if parent_location_id differs. if (i...
[ "public", "function", "update", "(", "ObjectInterface", "$", "object", ")", "{", "if", "(", "!", "$", "object", "instanceof", "LocationObject", ")", "{", "throw", "new", "UnsupportedObjectOperationException", "(", "LocationObject", "::", "class", ",", "get_class",...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/LocationManager.php#L155-L184
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/LocationManager.php
LocationManager.syncronizeLocationsFromContentObject
public function syncronizeLocationsFromContentObject(ContentObject $object) { /** @var LocationObject[] $parentLocations */ $parentLocations = $object->getProperty('parent_locations'); if (is_array($parentLocations) && count($parentLocations) > 0) { $addOrUpdate = []; ...
php
public function syncronizeLocationsFromContentObject(ContentObject $object) { /** @var LocationObject[] $parentLocations */ $parentLocations = $object->getProperty('parent_locations'); if (is_array($parentLocations) && count($parentLocations) > 0) { $addOrUpdate = []; ...
[ "public", "function", "syncronizeLocationsFromContentObject", "(", "ContentObject", "$", "object", ")", "{", "/** @var LocationObject[] $parentLocations */", "$", "parentLocations", "=", "$", "object", "->", "getProperty", "(", "'parent_locations'", ")", ";", "if", "(", ...
Creates/updates/deletes locations in ContentObject->parent_locations. @param ContentObject $object
[ "Creates", "/", "updates", "/", "deletes", "locations", "in", "ContentObject", "-", ">", "parent_locations", "." ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/LocationManager.php#L209-L234
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/LocationManager.php
LocationManager.filterLocationsToBeDeleted
private function filterLocationsToBeDeleted(ContentObject $object, $locationsToKeep) { $toBeDeleted = []; foreach ($this->locationService->loadLocations($object->getProperty('content_info')) as $existingLocation) { if (!array_key_exists($existingLocation->parentLocationId, $locationsToK...
php
private function filterLocationsToBeDeleted(ContentObject $object, $locationsToKeep) { $toBeDeleted = []; foreach ($this->locationService->loadLocations($object->getProperty('content_info')) as $existingLocation) { if (!array_key_exists($existingLocation->parentLocationId, $locationsToK...
[ "private", "function", "filterLocationsToBeDeleted", "(", "ContentObject", "$", "object", ",", "$", "locationsToKeep", ")", "{", "$", "toBeDeleted", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "locationService", "->", "loadLocations", "(", "$", "obj...
@param ContentObject $object @param LocationObject[] $locationsToKeep @return Location[]
[ "@param", "ContentObject", "$object", "@param", "LocationObject", "[]", "$locationsToKeep" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/LocationManager.php#L242-L253
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/LocationManager.php
LocationManager.remove
public function remove(ObjectInterface $object) { if (!$object instanceof LocationObject) { throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); } if ($location = $this->find($object)) { $this->locationService->deleteLocation($loc...
php
public function remove(ObjectInterface $object) { if (!$object instanceof LocationObject) { throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); } if ($location = $this->find($object)) { $this->locationService->deleteLocation($loc...
[ "public", "function", "remove", "(", "ObjectInterface", "$", "object", ")", "{", "if", "(", "!", "$", "object", "instanceof", "LocationObject", ")", "{", "throw", "new", "UnsupportedObjectOperationException", "(", "LocationObject", "::", "class", ",", "get_class",...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/LocationManager.php#L258-L269
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/LocationManager.php
LocationManager.toggleVisibility
public function toggleVisibility(Location $location) { if ($location->hidden) { return $this->unHide($location); } return $this->hide($location); }
php
public function toggleVisibility(Location $location) { if ($location->hidden) { return $this->unHide($location); } return $this->hide($location); }
[ "public", "function", "toggleVisibility", "(", "Location", "$", "location", ")", "{", "if", "(", "$", "location", "->", "hidden", ")", "{", "return", "$", "this", "->", "unHide", "(", "$", "location", ")", ";", "}", "return", "$", "this", "->", "hide",...
Toggles location visibility. @param Location $location @return Location
[ "Toggles", "location", "visibility", "." ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/LocationManager.php#L302-L309
yuncms/framework
src/helpers/FileHelper.php
FileHelper.getTempFilePath
public static function getTempFilePath($path) { return Yii::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . uniqid(pathinfo($path, PATHINFO_FILENAME), true) . '.' . FileHelper::extension($path); }
php
public static function getTempFilePath($path) { return Yii::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . uniqid(pathinfo($path, PATHINFO_FILENAME), true) . '.' . FileHelper::extension($path); }
[ "public", "static", "function", "getTempFilePath", "(", "$", "path", ")", "{", "return", "Yii", "::", "$", "app", "->", "getPath", "(", ")", "->", "getTempPath", "(", ")", ".", "DIRECTORY_SEPARATOR", ".", "uniqid", "(", "pathinfo", "(", "$", "path", ",",...
根据文件名生成一个临时文件名 @param string $path @return string @throws Exception
[ "根据文件名生成一个临时文件名" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L34-L37
yuncms/framework
src/helpers/FileHelper.php
FileHelper.readAndDelete
public static function readAndDelete($path) { $path = self::normalizePath($path); $contents = file_get_contents($path); if ($contents === false) { return false; } self::removeFile($path); return $contents; }
php
public static function readAndDelete($path) { $path = self::normalizePath($path); $contents = file_get_contents($path); if ($contents === false) { return false; } self::removeFile($path); return $contents; }
[ "public", "static", "function", "readAndDelete", "(", "$", "path", ")", "{", "$", "path", "=", "self", "::", "normalizePath", "(", "$", "path", ")", ";", "$", "contents", "=", "file_get_contents", "(", "$", "path", ")", ";", "if", "(", "$", "contents",...
读取并删除文件 @param string $path @return bool|string @throws ErrorException
[ "读取并删除文件" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L45-L54
yuncms/framework
src/helpers/FileHelper.php
FileHelper.put
public static function put(string $path, string $contents, bool $lock = false): int { return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); }
php
public static function put(string $path, string $contents, bool $lock = false): int { return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); }
[ "public", "static", "function", "put", "(", "string", "$", "path", ",", "string", "$", "contents", ",", "bool", "$", "lock", "=", "false", ")", ":", "int", "{", "return", "file_put_contents", "(", "$", "path", ",", "$", "contents", ",", "$", "lock", ...
Write the contents of a file. @param string $path @param string $contents @param bool $lock @return int
[ "Write", "the", "contents", "of", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L75-L78
yuncms/framework
src/helpers/FileHelper.php
FileHelper.append
public function append(string $path, string $data): int { return file_put_contents($path, $data, FILE_APPEND); }
php
public function append(string $path, string $data): int { return file_put_contents($path, $data, FILE_APPEND); }
[ "public", "function", "append", "(", "string", "$", "path", ",", "string", "$", "data", ")", ":", "int", "{", "return", "file_put_contents", "(", "$", "path", ",", "$", "data", ",", "FILE_APPEND", ")", ";", "}" ]
Append to a file. @param string $path @param string $data @return int
[ "Append", "to", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L87-L90
yuncms/framework
src/helpers/FileHelper.php
FileHelper.removeFile
public static function removeFile(string $file) { // Copied from [[removeDirectory()]] try { unlink($file); } catch (ErrorException $e) { if (DIRECTORY_SEPARATOR === '\\') { // last resort measure for Windows $lines = []; ...
php
public static function removeFile(string $file) { // Copied from [[removeDirectory()]] try { unlink($file); } catch (ErrorException $e) { if (DIRECTORY_SEPARATOR === '\\') { // last resort measure for Windows $lines = []; ...
[ "public", "static", "function", "removeFile", "(", "string", "$", "file", ")", "{", "// Copied from [[removeDirectory()]]", "try", "{", "unlink", "(", "$", "file", ")", ";", "}", "catch", "(", "ErrorException", "$", "e", ")", "{", "if", "(", "DIRECTORY_SEPAR...
Delete a file. @param string $file @throws ErrorException
[ "Delete", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L98-L112
yuncms/framework
src/helpers/FileHelper.php
FileHelper.files
public static function files(\RecursiveDirectoryIterator $directory): array { if (!$directory instanceof \RecursiveDirectoryIterator) { $directory = new \RecursiveDirectoryIterator($directory); } $files = []; for (; $directory->valid(); $directory->next()) { i...
php
public static function files(\RecursiveDirectoryIterator $directory): array { if (!$directory instanceof \RecursiveDirectoryIterator) { $directory = new \RecursiveDirectoryIterator($directory); } $files = []; for (; $directory->valid(); $directory->next()) { i...
[ "public", "static", "function", "files", "(", "\\", "RecursiveDirectoryIterator", "$", "directory", ")", ":", "array", "{", "if", "(", "!", "$", "directory", "instanceof", "\\", "RecursiveDirectoryIterator", ")", "{", "$", "directory", "=", "new", "\\", "Recur...
使用RecursiveDirectoryIterator遍历文件,列出所有文件路径 @param \RecursiveDirectoryIterator|string $directory 指定了目录的RecursiveDirectoryIterator实例 @return array $files 文件列表
[ "使用RecursiveDirectoryIterator遍历文件,列出所有文件路径" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L138-L154
yuncms/framework
src/helpers/FileHelper.php
FileHelper.cleanDirectory
public static function cleanDirectory(string $directory): bool { self::removeDirectory($directory); return self::createDirectory($directory); }
php
public static function cleanDirectory(string $directory): bool { self::removeDirectory($directory); return self::createDirectory($directory); }
[ "public", "static", "function", "cleanDirectory", "(", "string", "$", "directory", ")", ":", "bool", "{", "self", "::", "removeDirectory", "(", "$", "directory", ")", ";", "return", "self", "::", "createDirectory", "(", "$", "directory", ")", ";", "}" ]
Empty the specified directory of all files and folders. @param string $directory @return bool @throws \yii\base\ErrorException @throws Exception
[ "Empty", "the", "specified", "directory", "of", "all", "files", "and", "folders", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L164-L168
yuncms/framework
src/helpers/FileHelper.php
FileHelper.sanitizeFilename
public static function sanitizeFilename(string $filename, array $options = []): string { $asciiOnly = $options['asciiOnly'] ?? false; $separator = array_key_exists('separator', $options) ? $options['separator'] : '-'; $disallowedChars = ['—', '–', '&#8216;', '&#8217;', '&#8220;', '&#8221...
php
public static function sanitizeFilename(string $filename, array $options = []): string { $asciiOnly = $options['asciiOnly'] ?? false; $separator = array_key_exists('separator', $options) ? $options['separator'] : '-'; $disallowedChars = ['—', '–', '&#8216;', '&#8217;', '&#8220;', '&#8221...
[ "public", "static", "function", "sanitizeFilename", "(", "string", "$", "filename", ",", "array", "$", "options", "=", "[", "]", ")", ":", "string", "{", "$", "asciiOnly", "=", "$", "options", "[", "'asciiOnly'", "]", "??", "false", ";", "$", "separator"...
Sanitizes a filename. @param string $filename the filename to sanitize @param array $options options for sanitization. Valid options are: - `asciiOnly`: bool, whether only ASCII characters should be allowed. Defaults to false. - `separator`: string|null, the separator character to use in place of whitespace. defaults...
[ "Sanitizes", "a", "filename", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L181-L206
yuncms/framework
src/helpers/FileHelper.php
FileHelper.isAbsolutePath
public static function isAbsolutePath($path): bool { return strspn($path, '/\\', 0, 1) || (strlen($path) > 3 && ctype_alpha($path[0]) && ':' === $path[1] && strspn($path, '/\\', 2, 1) ) || null !== parse_url($path, PHP_URL_SCHEME); }
php
public static function isAbsolutePath($path): bool { return strspn($path, '/\\', 0, 1) || (strlen($path) > 3 && ctype_alpha($path[0]) && ':' === $path[1] && strspn($path, '/\\', 2, 1) ) || null !== parse_url($path, PHP_URL_SCHEME); }
[ "public", "static", "function", "isAbsolutePath", "(", "$", "path", ")", ":", "bool", "{", "return", "strspn", "(", "$", "path", ",", "'/\\\\'", ",", "0", ",", "1", ")", "||", "(", "strlen", "(", "$", "path", ")", ">", "3", "&&", "ctype_alpha", "("...
Returns whether the file path is an absolute path. @param string $path A file path @return bool
[ "Returns", "whether", "the", "file", "path", "is", "an", "absolute", "path", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L214-L222
yuncms/framework
src/helpers/FileHelper.php
FileHelper.isDirectoryEmpty
public static function isDirectoryEmpty(string $dir): bool { if (!is_dir($dir)) { throw new InvalidArgumentException("The dir argument must be a directory: $dir"); } if (!($handle = opendir($dir))) { throw new ErrorException("Unable to open the directory: $dir"); ...
php
public static function isDirectoryEmpty(string $dir): bool { if (!is_dir($dir)) { throw new InvalidArgumentException("The dir argument must be a directory: $dir"); } if (!($handle = opendir($dir))) { throw new ErrorException("Unable to open the directory: $dir"); ...
[ "public", "static", "function", "isDirectoryEmpty", "(", "string", "$", "dir", ")", ":", "bool", "{", "if", "(", "!", "is_dir", "(", "$", "dir", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"The dir argument must be a directory: $dir\"", ")"...
Returns whether a given directory is empty (has no files) recursively. @param string $dir the directory to be checked @return bool whether the directory is empty @throws InvalidArgumentException if the dir is invalid @throws ErrorException in case of failure
[ "Returns", "whether", "a", "given", "directory", "is", "empty", "(", "has", "no", "files", ")", "recursively", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L232-L259
yuncms/framework
src/helpers/FileHelper.php
FileHelper.isWritable
public static function isWritable(string $path): bool { // If it's a directory, test on a temp sub file if (is_dir($path)) { return static::isWritable($path . DIRECTORY_SEPARATOR . uniqid('test_writable', true) . '.tmp'); } // Remember whether the file already existed ...
php
public static function isWritable(string $path): bool { // If it's a directory, test on a temp sub file if (is_dir($path)) { return static::isWritable($path . DIRECTORY_SEPARATOR . uniqid('test_writable', true) . '.tmp'); } // Remember whether the file already existed ...
[ "public", "static", "function", "isWritable", "(", "string", "$", "path", ")", ":", "bool", "{", "// If it's a directory, test on a temp sub file", "if", "(", "is_dir", "(", "$", "path", ")", ")", "{", "return", "static", "::", "isWritable", "(", "$", "path", ...
Tests whether a file/directory is writable. @param string $path the file/directory path to test @return bool whether the path is writable @throws ErrorException in case of failure
[ "Tests", "whether", "a", "file", "/", "directory", "is", "writable", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/FileHelper.php#L269-L291
shrink0r/workflux
src/Renderer/DotGraphRenderer.php
DotGraphRenderer.render
public function render(StateMachineInterface $state_machine) { $node_id = 0; $node_id_map = new Map; foreach ($state_machine->getStates() as $state) { $node_id_map->put($state->getName(), sprintf('node%d', ++$node_id)); } return sprintf( "digraph \"%s\...
php
public function render(StateMachineInterface $state_machine) { $node_id = 0; $node_id_map = new Map; foreach ($state_machine->getStates() as $state) { $node_id_map->put($state->getName(), sprintf('node%d', ++$node_id)); } return sprintf( "digraph \"%s\...
[ "public", "function", "render", "(", "StateMachineInterface", "$", "state_machine", ")", "{", "$", "node_id", "=", "0", ";", "$", "node_id_map", "=", "new", "Map", ";", "foreach", "(", "$", "state_machine", "->", "getStates", "(", ")", "as", "$", "state", ...
@param StateMachineInterface $state_machine @return mixed
[ "@param", "StateMachineInterface", "$state_machine" ]
train
https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/Renderer/DotGraphRenderer.php#L16-L29
shrink0r/workflux
src/Renderer/DotGraphRenderer.php
DotGraphRenderer.renderStateNodes
private function renderStateNodes(StateMachineInterface $state_machine, Map $node_id_map): array { $state_nodes = []; foreach ($state_machine->getStates() as $state_name => $state) { $attributes = sprintf('label="%s"', $state_name); $attributes .= ' fontname="Arial" fontsize=...
php
private function renderStateNodes(StateMachineInterface $state_machine, Map $node_id_map): array { $state_nodes = []; foreach ($state_machine->getStates() as $state_name => $state) { $attributes = sprintf('label="%s"', $state_name); $attributes .= ' fontname="Arial" fontsize=...
[ "private", "function", "renderStateNodes", "(", "StateMachineInterface", "$", "state_machine", ",", "Map", "$", "node_id_map", ")", ":", "array", "{", "$", "state_nodes", "=", "[", "]", ";", "foreach", "(", "$", "state_machine", "->", "getStates", "(", ")", ...
@param StateMachineInterface $state_machine @param Map $node_id_map @return string[]
[ "@param", "StateMachineInterface", "$state_machine", "@param", "Map", "$node_id_map" ]
train
https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/Renderer/DotGraphRenderer.php#L37-L49
shrink0r/workflux
src/Renderer/DotGraphRenderer.php
DotGraphRenderer.renderTransitionEdges
private function renderTransitionEdges(StateMachineInterface $state_machine, Map $node_id_map): array { $edges = []; foreach ($state_machine->getStateTransitions() as $state_name => $state_transitions) { foreach ($state_transitions as $transition) { $from_node = $node_id_...
php
private function renderTransitionEdges(StateMachineInterface $state_machine, Map $node_id_map): array { $edges = []; foreach ($state_machine->getStateTransitions() as $state_name => $state_transitions) { foreach ($state_transitions as $transition) { $from_node = $node_id_...
[ "private", "function", "renderTransitionEdges", "(", "StateMachineInterface", "$", "state_machine", ",", "Map", "$", "node_id_map", ")", ":", "array", "{", "$", "edges", "=", "[", "]", ";", "foreach", "(", "$", "state_machine", "->", "getStateTransitions", "(", ...
@param StateMachineInterface $state_machine @param Map $node_id_map @return string[]
[ "@param", "StateMachineInterface", "$state_machine", "@param", "Map", "$node_id_map" ]
train
https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/Renderer/DotGraphRenderer.php#L57-L71
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.path
public static function path( $name, $time = null ) { if ( is_null( $time ) ) { $time = time(); } $namespace = null; if ( strpos( $name, '::' ) !== false ) { list( $namespace, $name ) = explode( '::', $name ); } $name = explode( '/', $name ); foreach( $name as $key => $value ) { ...
php
public static function path( $name, $time = null ) { if ( is_null( $time ) ) { $time = time(); } $namespace = null; if ( strpos( $name, '::' ) !== false ) { list( $namespace, $name ) = explode( '::', $name ); } $name = explode( '/', $name ); foreach( $name as $key => $value ) { ...
[ "public", "static", "function", "path", "(", "$", "name", ",", "$", "time", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "time", ")", ")", "{", "$", "time", "=", "time", "(", ")", ";", "}", "$", "namespace", "=", "null", ";", "if", ...
Get a migration path by name @param string $name @return string
[ "Get", "a", "migration", "path", "by", "name" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L38-L62
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.migrate
public static function migrate( $silent = false ) { $migrations = $silent ? static::available() : static::unstaged(); foreach( $migrations as $key => $value ) { if ( empty( $value ) ) { continue; } if ( \ClanCats::is_cli() ) { \CCCli::info( 'found new "'.$key.'" migrations.' ); }...
php
public static function migrate( $silent = false ) { $migrations = $silent ? static::available() : static::unstaged(); foreach( $migrations as $key => $value ) { if ( empty( $value ) ) { continue; } if ( \ClanCats::is_cli() ) { \CCCli::info( 'found new "'.$key.'" migrations.' ); }...
[ "public", "static", "function", "migrate", "(", "$", "silent", "=", "false", ")", "{", "$", "migrations", "=", "$", "silent", "?", "static", "::", "available", "(", ")", ":", "static", "::", "unstaged", "(", ")", ";", "foreach", "(", "$", "migrations",...
Run all new migration @param bool $silent In the silent mode the migrator ignores the migration file @return void
[ "Run", "all", "new", "migration" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L71-L107
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.rollback
public static function rollback() { // first of all we have to filter only the already migrated versions $available = static::available(); foreach( $available as $key => $migrations ) { foreach( $migrations as $time => $migration ) { if ( $time > static::$config->get( $key.'.revision', 0 ) ) {...
php
public static function rollback() { // first of all we have to filter only the already migrated versions $available = static::available(); foreach( $available as $key => $migrations ) { foreach( $migrations as $time => $migration ) { if ( $time > static::$config->get( $key.'.revision', 0 ) ) {...
[ "public", "static", "function", "rollback", "(", ")", "{", "// first of all we have to filter only the already migrated versions", "$", "available", "=", "static", "::", "available", "(", ")", ";", "foreach", "(", "$", "available", "as", "$", "key", "=>", "$", "mi...
Revert the last migration @return void
[ "Revert", "the", "last", "migration" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L114-L178
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.hard_reset
public static function hard_reset( $database = null ) { $tables = DB::fetch( 'SHOW TABLES', array(), $database, array( 'assoc' ) ); foreach( $tables as $table ) { DB::run( 'DROP TABLE IF EXISTS '.reset( $table ), array(), $database ); } }
php
public static function hard_reset( $database = null ) { $tables = DB::fetch( 'SHOW TABLES', array(), $database, array( 'assoc' ) ); foreach( $tables as $table ) { DB::run( 'DROP TABLE IF EXISTS '.reset( $table ), array(), $database ); } }
[ "public", "static", "function", "hard_reset", "(", "$", "database", "=", "null", ")", "{", "$", "tables", "=", "DB", "::", "fetch", "(", "'SHOW TABLES'", ",", "array", "(", ")", ",", "$", "database", ",", "array", "(", "'assoc'", ")", ")", ";", "fore...
The hard reset method deletes all tables from the database @param string $databse
[ "The", "hard", "reset", "method", "deletes", "all", "tables", "from", "the", "database" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L185-L193
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.available
public static function available() { $bundles = array_merge( \CCFinder::$bundles, array( 'app' => \CCPath::get( '', null ) )); $available = array(); foreach( $bundles as $name => $path ) { $directory = $path.\ClanCats::directory( 'migration' ); if ( is_dir( $directory ) ) { $avail...
php
public static function available() { $bundles = array_merge( \CCFinder::$bundles, array( 'app' => \CCPath::get( '', null ) )); $available = array(); foreach( $bundles as $name => $path ) { $directory = $path.\ClanCats::directory( 'migration' ); if ( is_dir( $directory ) ) { $avail...
[ "public", "static", "function", "available", "(", ")", "{", "$", "bundles", "=", "array_merge", "(", "\\", "CCFinder", "::", "$", "bundles", ",", "array", "(", "'app'", "=>", "\\", "CCPath", "::", "get", "(", "''", ",", "null", ")", ")", ")", ";", ...
Returns the available migrations @return array
[ "Returns", "the", "available", "migrations" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L200-L219
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.get_migrations
public static function get_migrations( $path ) { $objects = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $path ), \RecursiveIteratorIterator::SELF_FIRST ); $files = array(); foreach( $objects as $name => $object ) { if ( \CCStr::extension( $name ) == 'sql' ) { $files[\CCStr:...
php
public static function get_migrations( $path ) { $objects = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $path ), \RecursiveIteratorIterator::SELF_FIRST ); $files = array(); foreach( $objects as $name => $object ) { if ( \CCStr::extension( $name ) == 'sql' ) { $files[\CCStr:...
[ "public", "static", "function", "get_migrations", "(", "$", "path", ")", "{", "$", "objects", "=", "new", "\\", "RecursiveIteratorIterator", "(", "new", "\\", "RecursiveDirectoryIterator", "(", "$", "path", ")", ",", "\\", "RecursiveIteratorIterator", "::", "SEL...
Returns the available migrations @param string $path @return array
[ "Returns", "the", "available", "migrations" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L227-L244
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.unstaged
public static function unstaged() { $available = static::available(); foreach( $available as $key => $migrations ) { foreach( $migrations as $time => $migration ) { if ( $time <= static::$config->get( $key.'.revision', 0 ) ) { unset( $available[$key][$time] ); } } } return $av...
php
public static function unstaged() { $available = static::available(); foreach( $available as $key => $migrations ) { foreach( $migrations as $time => $migration ) { if ( $time <= static::$config->get( $key.'.revision', 0 ) ) { unset( $available[$key][$time] ); } } } return $av...
[ "public", "static", "function", "unstaged", "(", ")", "{", "$", "available", "=", "static", "::", "available", "(", ")", ";", "foreach", "(", "$", "available", "as", "$", "key", "=>", "$", "migrations", ")", "{", "foreach", "(", "$", "migrations", "as"...
Returns the unstaged migrations based on the configuration @return array
[ "Returns", "the", "unstaged", "migrations", "based", "on", "the", "configuration" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L251-L267
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.run_queries
private function run_queries( $group ) { if ( !$handle = fopen( $this->path , "r") ) { throw new Exception( "Could not read migration: ".$this->path ); } $mode = null; $query = ''; while ( !feof( $handle ) ) { $buffer = trim( fgets( $handle, 4096 ) ); $this->parse_mode( $mode, $buffe...
php
private function run_queries( $group ) { if ( !$handle = fopen( $this->path , "r") ) { throw new Exception( "Could not read migration: ".$this->path ); } $mode = null; $query = ''; while ( !feof( $handle ) ) { $buffer = trim( fgets( $handle, 4096 ) ); $this->parse_mode( $mode, $buffe...
[ "private", "function", "run_queries", "(", "$", "group", ")", "{", "if", "(", "!", "$", "handle", "=", "fopen", "(", "$", "this", "->", "path", ",", "\"r\"", ")", ")", "{", "throw", "new", "Exception", "(", "\"Could not read migration: \"", ".", "$", "...
Run all queries of specified group @param string $group @return void
[ "Run", "all", "queries", "of", "specified", "group" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L333-L372
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.parse_mode
private function parse_mode( &$mode, $buffer ) { if ( substr( trim( $buffer ), 0, 6 ) === '# --->' ) { $mode = trim( substr( $buffer, 6 ) ); } }
php
private function parse_mode( &$mode, $buffer ) { if ( substr( trim( $buffer ), 0, 6 ) === '# --->' ) { $mode = trim( substr( $buffer, 6 ) ); } }
[ "private", "function", "parse_mode", "(", "&", "$", "mode", ",", "$", "buffer", ")", "{", "if", "(", "substr", "(", "trim", "(", "$", "buffer", ")", ",", "0", ",", "6", ")", "===", "'# --->'", ")", "{", "$", "mode", "=", "trim", "(", "substr", ...
Try to parse the current mode @param string $mode @param string $buffer @return bool
[ "Try", "to", "parse", "the", "current", "mode" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L381-L387
ClanCats/Core
src/bundles/Database/Migrator.php
Migrator.is_comment
private function is_comment( $buffer ) { if ( is_string( $buffer ) && strlen( $buffer ) >= 1 ) { if ( $buffer[0] == '#' ) { return true; } if ( substr( $buffer, 0, 2 ) == '--' ) { return true; } } else { return true; } return false; }
php
private function is_comment( $buffer ) { if ( is_string( $buffer ) && strlen( $buffer ) >= 1 ) { if ( $buffer[0] == '#' ) { return true; } if ( substr( $buffer, 0, 2 ) == '--' ) { return true; } } else { return true; } return false; }
[ "private", "function", "is_comment", "(", "$", "buffer", ")", "{", "if", "(", "is_string", "(", "$", "buffer", ")", "&&", "strlen", "(", "$", "buffer", ")", ">=", "1", ")", "{", "if", "(", "$", "buffer", "[", "0", "]", "==", "'#'", ")", "{", "r...
Is this string an sql comment? @param string $buffer @return bool
[ "Is", "this", "string", "an", "sql", "comment?" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Migrator.php#L395-L415
djgadd/themosis-illuminate
src/Config/ConfigServiceProvider.php
ConfigServiceProvider.register
public function register () { $this->app->singleton('config', function($app) { return new Repository([]); }); // Provide some compatibility with Themosis $this->app->alias('config', 'config.factory'); // If we already have a finder available replace it, this is for users who // are jus...
php
public function register () { $this->app->singleton('config', function($app) { return new Repository([]); }); // Provide some compatibility with Themosis $this->app->alias('config', 'config.factory'); // If we already have a finder available replace it, this is for users who // are jus...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "'config'", ",", "function", "(", "$", "app", ")", "{", "return", "new", "Repository", "(", "[", "]", ")", ";", "}", ")", ";", "// Provide some compatibi...
{@inheritdoc}
[ "{" ]
train
https://github.com/djgadd/themosis-illuminate/blob/13ee4c3413cddd85a2f262ac361f35c81da0c53c/src/Config/ConfigServiceProvider.php#L13-L38
webforge-labs/psc-cms
lib/Psc/HTML/JooseBase.php
JooseBase.autoLoad
protected function autoLoad() { if (!$this->disableAutoLoad) { $constructCode = $this->createConstructCode($this->jooseClass, $this->constructParams, FALSE); if (mb_strpos($this->html->getTemplate(),'%autoLoadJoose%') === FALSE) { $this->html->templateAppend( "\n".'%autoLoadJoo...
php
protected function autoLoad() { if (!$this->disableAutoLoad) { $constructCode = $this->createConstructCode($this->jooseClass, $this->constructParams, FALSE); if (mb_strpos($this->html->getTemplate(),'%autoLoadJoose%') === FALSE) { $this->html->templateAppend( "\n".'%autoLoadJoo...
[ "protected", "function", "autoLoad", "(", ")", "{", "if", "(", "!", "$", "this", "->", "disableAutoLoad", ")", "{", "$", "constructCode", "=", "$", "this", "->", "createConstructCode", "(", "$", "this", "->", "jooseClass", ",", "$", "this", "->", "constr...
Erstellt das Objekt direkt nachdem das HTML geladen wird per inline-Javascript vorher werden mögliche Dependencies geladen und es wird auf Main gewartet. in den Constructor-Parametern ist "main" definiert und zeigt auf Psc.UI.Main man muss selbst sicherstellen dass init() aufgerufen wurde (bzw this->html gesetzt ist)
[ "Erstellt", "das", "Objekt", "direkt", "nachdem", "das", "HTML", "geladen", "wird", "per", "inline", "-", "Javascript" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/HTML/JooseBase.php#L60-L83
webforge-labs/psc-cms
lib/Psc/HTML/JooseBase.php
JooseBase.createJooseSnippet
protected function createJooseSnippet($jooseClass, $constructParams = NULL, Array $dependencies = array()) { return JooseSnippet::create($jooseClass, $constructParams, $dependencies)->loadOnPscReady($this->loadSnippetOnPscReady); }
php
protected function createJooseSnippet($jooseClass, $constructParams = NULL, Array $dependencies = array()) { return JooseSnippet::create($jooseClass, $constructParams, $dependencies)->loadOnPscReady($this->loadSnippetOnPscReady); }
[ "protected", "function", "createJooseSnippet", "(", "$", "jooseClass", ",", "$", "constructParams", "=", "NULL", ",", "Array", "$", "dependencies", "=", "array", "(", ")", ")", "{", "return", "JooseSnippet", "::", "create", "(", "$", "jooseClass", ",", "$", ...
Erstellt ein Snippet welches mit %self% auf die Componente als jQuery Objekt zugreifen kann @return Psc\JS\Snippet
[ "Erstellt", "ein", "Snippet", "welches", "mit", "%self%", "auf", "die", "Componente", "als", "jQuery", "Objekt", "zugreifen", "kann" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/HTML/JooseBase.php#L133-L135
ruvents/ruwork-upload-bundle
Source/ResolvedSource.php
ResolvedSource.save
public function save(): void { if ($this->saved) { throw new \RuntimeException('Already saved.'); } if ($this->saveFromSource) { $this->handler->write($this->source, $this->absolutePath); } else { $dir = \dirname($this->absolutePath); ...
php
public function save(): void { if ($this->saved) { throw new \RuntimeException('Already saved.'); } if ($this->saveFromSource) { $this->handler->write($this->source, $this->absolutePath); } else { $dir = \dirname($this->absolutePath); ...
[ "public", "function", "save", "(", ")", ":", "void", "{", "if", "(", "$", "this", "->", "saved", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Already saved.'", ")", ";", "}", "if", "(", "$", "this", "->", "saveFromSource", ")", "{", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/ruvents/ruwork-upload-bundle/blob/8ad09cc2dce6ab389105c440d791346696da43af/Source/ResolvedSource.php#L78-L99
jfusion/org.jfusion.framework
src/Authentication/Authentication.php
Authentication.authenticate
public function authenticate(Userinfo $user, $options = array()) { // Create authentication response $response = new Response(); $debugger = new Debugger(); try { $db = Factory::getDBO(); $plugins = Factory::getPlugins(); if (!empty($plugins)) { $userinfo = User::search($user); if ($userinfo...
php
public function authenticate(Userinfo $user, $options = array()) { // Create authentication response $response = new Response(); $debugger = new Debugger(); try { $db = Factory::getDBO(); $plugins = Factory::getPlugins(); if (!empty($plugins)) { $userinfo = User::search($user); if ($userinfo...
[ "public", "function", "authenticate", "(", "Userinfo", "$", "user", ",", "$", "options", "=", "array", "(", ")", ")", "{", "// Create authentication response", "$", "response", "=", "new", "Response", "(", ")", ";", "$", "debugger", "=", "new", "Debugger", ...
Finds out if a set of login credentials are valid by asking all observing objects to run their respective authentication routines. @param Userinfo $user Array holding the user credentials. @param array $options Array holding user options. @return Response Response object with status variable filled in f...
[ "Finds", "out", "if", "a", "set", "of", "login", "credentials", "are", "valid", "by", "asking", "all", "observing", "objects", "to", "run", "their", "respective", "authentication", "routines", "." ]
train
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Authentication/Authentication.php#L137-L247
ClanCats/Core
src/classes/CCPath.php
CCPath.get
public static function get( $path, $prefix = '', $suffix = '' ) { if ( substr( $path, 0, 1 ) == '/' || substr( $path, 0, 3 ) == "::/" ) { return $path.$suffix; } if ( strpos( $path, '::' ) === false ) { return \APPPATH.$prefix.$path.$suffix; } $name = explode( '::', $path ); // do we have a ...
php
public static function get( $path, $prefix = '', $suffix = '' ) { if ( substr( $path, 0, 1 ) == '/' || substr( $path, 0, 3 ) == "::/" ) { return $path.$suffix; } if ( strpos( $path, '::' ) === false ) { return \APPPATH.$prefix.$path.$suffix; } $name = explode( '::', $path ); // do we have a ...
[ "public", "static", "function", "get", "(", "$", "path", ",", "$", "prefix", "=", "''", ",", "$", "suffix", "=", "''", ")", "{", "if", "(", "substr", "(", "$", "path", ",", "0", ",", "1", ")", "==", "'/'", "||", "substr", "(", "$", "path", ",...
generate an path an path can conatin an namespace for example "core" if an path starts with an "/" only the suffix will be added. @param string $path @param string $prefix @param string $sufix
[ "generate", "an", "path", "an", "path", "can", "conatin", "an", "namespace", "for", "example", "core" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCPath.php#L26-L45
forxer/tao
src/Tao/Messages/InstantMessages.php
InstantMessages.getInfo
public function getInfo(array $aDefault = []) { $aReturn = $aDefault; if ($this->hasInfo()) { $aReturn = $this->aMessages[self::TYPE_INFO]; } return $aReturn; }
php
public function getInfo(array $aDefault = []) { $aReturn = $aDefault; if ($this->hasInfo()) { $aReturn = $this->aMessages[self::TYPE_INFO]; } return $aReturn; }
[ "public", "function", "getInfo", "(", "array", "$", "aDefault", "=", "[", "]", ")", "{", "$", "aReturn", "=", "$", "aDefault", ";", "if", "(", "$", "this", "->", "hasInfo", "(", ")", ")", "{", "$", "aReturn", "=", "$", "this", "->", "aMessages", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Messages/InstantMessages.php#L34-L43
forxer/tao
src/Tao/Messages/InstantMessages.php
InstantMessages.getSuccess
public function getSuccess(array $aDefault = []) { $aReturn = $aDefault; if ($this->hasSuccess()) { $aReturn = $this->aMessages[self::TYPE_SUCCESS]; } return $aReturn; }
php
public function getSuccess(array $aDefault = []) { $aReturn = $aDefault; if ($this->hasSuccess()) { $aReturn = $this->aMessages[self::TYPE_SUCCESS]; } return $aReturn; }
[ "public", "function", "getSuccess", "(", "array", "$", "aDefault", "=", "[", "]", ")", "{", "$", "aReturn", "=", "$", "aDefault", ";", "if", "(", "$", "this", "->", "hasSuccess", "(", ")", ")", "{", "$", "aReturn", "=", "$", "this", "->", "aMessage...
{@inheritdoc}
[ "{" ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Messages/InstantMessages.php#L64-L73
forxer/tao
src/Tao/Messages/InstantMessages.php
InstantMessages.getWarning
public function getWarning(array $aDefault = []) { $aReturn = $aDefault; if ($this->hasWarning()) { $aReturn = $this->aMessages[self::TYPE_WARNING]; } return $aReturn; }
php
public function getWarning(array $aDefault = []) { $aReturn = $aDefault; if ($this->hasWarning()) { $aReturn = $this->aMessages[self::TYPE_WARNING]; } return $aReturn; }
[ "public", "function", "getWarning", "(", "array", "$", "aDefault", "=", "[", "]", ")", "{", "$", "aReturn", "=", "$", "aDefault", ";", "if", "(", "$", "this", "->", "hasWarning", "(", ")", ")", "{", "$", "aReturn", "=", "$", "this", "->", "aMessage...
{@inheritdoc}
[ "{" ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Messages/InstantMessages.php#L94-L103
forxer/tao
src/Tao/Messages/InstantMessages.php
InstantMessages.getError
public function getError(array $aDefault = []) { $aReturn = $aDefault; if ($this->hasError()) { $aReturn = $this->aMessages[self::TYPE_ERROR]; } return $aReturn; }
php
public function getError(array $aDefault = []) { $aReturn = $aDefault; if ($this->hasError()) { $aReturn = $this->aMessages[self::TYPE_ERROR]; } return $aReturn; }
[ "public", "function", "getError", "(", "array", "$", "aDefault", "=", "[", "]", ")", "{", "$", "aReturn", "=", "$", "aDefault", ";", "if", "(", "$", "this", "->", "hasError", "(", ")", ")", "{", "$", "aReturn", "=", "$", "this", "->", "aMessages", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Messages/InstantMessages.php#L124-L133
2amigos/yiifoundation
helpers/Progress.php
Progress.success
public static function success($percent, $htmlOptions = array()) { ArrayHelper::addValue('class', Enum::COLOR_SUCCESS, $htmlOptions); return static::bar($percent, $htmlOptions); }
php
public static function success($percent, $htmlOptions = array()) { ArrayHelper::addValue('class', Enum::COLOR_SUCCESS, $htmlOptions); return static::bar($percent, $htmlOptions); }
[ "public", "static", "function", "success", "(", "$", "percent", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "ArrayHelper", "::", "addValue", "(", "'class'", ",", "Enum", "::", "COLOR_SUCCESS", ",", "$", "htmlOptions", ")", ";", "return", "...
Generates success coloured progress bar @param $percent @param array $htmlOptions @return string
[ "Generates", "success", "coloured", "progress", "bar" ]
train
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Progress.php#L26-L30
yuncms/framework
src/models/Attachment.php
Attachment.beforeSave
public function beforeSave($insert) { $this->path = str_replace('\\', '/', $this->path); return parent::beforeSave($insert); }
php
public function beforeSave($insert) { $this->path = str_replace('\\', '/', $this->path); return parent::beforeSave($insert); }
[ "public", "function", "beforeSave", "(", "$", "insert", ")", "{", "$", "this", "->", "path", "=", "str_replace", "(", "'\\\\'", ",", "'/'", ",", "$", "this", "->", "path", ")", ";", "return", "parent", "::", "beforeSave", "(", "$", "insert", ")", ";"...
保存前修正附件路径 @param bool $insert @return bool
[ "保存前修正附件路径" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/models/Attachment.php#L134-L138
yuncms/framework
src/models/Attachment.php
Attachment.afterDelete
public function afterDelete() { Yii::$app->queue->push(new AttachmentDeleteJob([ 'path' => $this->path ])); return parent::afterDelete(); }
php
public function afterDelete() { Yii::$app->queue->push(new AttachmentDeleteJob([ 'path' => $this->path ])); return parent::afterDelete(); }
[ "public", "function", "afterDelete", "(", ")", "{", "Yii", "::", "$", "app", "->", "queue", "->", "push", "(", "new", "AttachmentDeleteJob", "(", "[", "'path'", "=>", "$", "this", "->", "path", "]", ")", ")", ";", "return", "parent", "::", "afterDelete...
附件删除 @return mixed
[ "附件删除" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/models/Attachment.php#L144-L150
phpmob/changmin
src/PhpMob/MediaBundle/Doctrine/DBAL/Type/ImageType.php
ImageType.convertToPHPValue
public function convertToPHPValue($value, AbstractPlatform $platform) { if (!$value) { return null; } $listeners = $platform->getEventManager()->getListeners('imageTypeRegistry'); $listener = array_shift($listeners); /** @var ImageTypeRegistry $registry */ ...
php
public function convertToPHPValue($value, AbstractPlatform $platform) { if (!$value) { return null; } $listeners = $platform->getEventManager()->getListeners('imageTypeRegistry'); $listener = array_shift($listeners); /** @var ImageTypeRegistry $registry */ ...
[ "public", "function", "convertToPHPValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "if", "(", "!", "$", "value", ")", "{", "return", "null", ";", "}", "$", "listeners", "=", "$", "platform", "->", "getEventManager", "(", ")...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/Doctrine/DBAL/Type/ImageType.php#L43-L57
ripaclub/zf2-sphinxsearch-tool
Module.php
Module.getConfig
public function getConfig() { $moduleConfig = include __DIR__ . '/config/module.config.php'; $moduleConfig = array_merge($moduleConfig, include __DIR__ . '/config/routes.config.php'); if (file_exists(__DIR__ . '/config/sphinx.config.php')) { $moduleConfig['sphinxsearch'] = includ...
php
public function getConfig() { $moduleConfig = include __DIR__ . '/config/module.config.php'; $moduleConfig = array_merge($moduleConfig, include __DIR__ . '/config/routes.config.php'); if (file_exists(__DIR__ . '/config/sphinx.config.php')) { $moduleConfig['sphinxsearch'] = includ...
[ "public", "function", "getConfig", "(", ")", "{", "$", "moduleConfig", "=", "include", "__DIR__", ".", "'/config/module.config.php'", ";", "$", "moduleConfig", "=", "array_merge", "(", "$", "moduleConfig", ",", "include", "__DIR__", ".", "'/config/routes.config.php'...
{@inheritdoc}
[ "{" ]
train
https://github.com/ripaclub/zf2-sphinxsearch-tool/blob/4cb51341ccf1db9942e3e578855a579afd608d69/Module.php#L59-L72
ripaclub/zf2-sphinxsearch-tool
Module.php
Module.createCharsetTableVariables
private function createCharsetTableVariables(array $config, $encoding_type = 'utf8') { if (isset($config['sphinxsearch']) && file_exists(__DIR__ . '/config/sphinx.charset.utf8.config.php')) { $charsetConfig = include __DIR__ . '/config/sphinx.charset.utf8.config.php'; $languages = $c...
php
private function createCharsetTableVariables(array $config, $encoding_type = 'utf8') { if (isset($config['sphinxsearch']) && file_exists(__DIR__ . '/config/sphinx.charset.utf8.config.php')) { $charsetConfig = include __DIR__ . '/config/sphinx.charset.utf8.config.php'; $languages = $c...
[ "private", "function", "createCharsetTableVariables", "(", "array", "$", "config", ",", "$", "encoding_type", "=", "'utf8'", ")", "{", "if", "(", "isset", "(", "$", "config", "[", "'sphinxsearch'", "]", ")", "&&", "file_exists", "(", "__DIR__", ".", "'/confi...
Read Sphinx Search charset tables and create variables to expose them @param array $config @param $encoding_type @return array
[ "Read", "Sphinx", "Search", "charset", "tables", "and", "create", "variables", "to", "expose", "them" ]
train
https://github.com/ripaclub/zf2-sphinxsearch-tool/blob/4cb51341ccf1db9942e3e578855a579afd608d69/Module.php#L81-L107
ripaclub/zf2-sphinxsearch-tool
Module.php
Module.getConsoleBanner
public function getConsoleBanner(AdapterInterface $console) { if (static::$consoleBannerEnabled) { $figlet = new Figlet(['font' => __DIR__ . '/assets/font/colossal.flf']); $figlet->setOutputWidth($console->getWidth()); $figlet->setJustification(Figlet::JUSTIFICATION_CENTE...
php
public function getConsoleBanner(AdapterInterface $console) { if (static::$consoleBannerEnabled) { $figlet = new Figlet(['font' => __DIR__ . '/assets/font/colossal.flf']); $figlet->setOutputWidth($console->getWidth()); $figlet->setJustification(Figlet::JUSTIFICATION_CENTE...
[ "public", "function", "getConsoleBanner", "(", "AdapterInterface", "$", "console", ")", "{", "if", "(", "static", "::", "$", "consoleBannerEnabled", ")", "{", "$", "figlet", "=", "new", "Figlet", "(", "[", "'font'", "=>", "__DIR__", ".", "'/assets/font/colossa...
{@inheritdoc}
[ "{" ]
train
https://github.com/ripaclub/zf2-sphinxsearch-tool/blob/4cb51341ccf1db9942e3e578855a579afd608d69/Module.php#L112-L122
uthando-cms/uthando-dompdf
src/UthandoDomPdf/Model/PdfFooterCollection.php
PdfFooterCollection.rewind
public function rewind() { if (!$this->sorted) { $this->entities = array_reverse($this->entities); $this->sorted = true; } parent::rewind(); }
php
public function rewind() { if (!$this->sorted) { $this->entities = array_reverse($this->entities); $this->sorted = true; } parent::rewind(); }
[ "public", "function", "rewind", "(", ")", "{", "if", "(", "!", "$", "this", "->", "sorted", ")", "{", "$", "this", "->", "entities", "=", "array_reverse", "(", "$", "this", "->", "entities", ")", ";", "$", "this", "->", "sorted", "=", "true", ";", ...
Make sure we have the items in the right order, reverse order
[ "Make", "sure", "we", "have", "the", "items", "in", "the", "right", "order", "reverse", "order" ]
train
https://github.com/uthando-cms/uthando-dompdf/blob/60a750058c2db9ed167476192b20c7f544c32007/src/UthandoDomPdf/Model/PdfFooterCollection.php#L71-L79
mvdbos/vdb-uri
src/VDB/Uri/Uri.php
Uri.toString
public function toString() { if (null === $this->composedURI) { $this->composedURI = ''; if (null !== $this->scheme) { $this->composedURI .= $this->scheme; $this->composedURI .= ':'; } if (null !== $this->host) { ...
php
public function toString() { if (null === $this->composedURI) { $this->composedURI = ''; if (null !== $this->scheme) { $this->composedURI .= $this->scheme; $this->composedURI .= ':'; } if (null !== $this->host) { ...
[ "public", "function", "toString", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "composedURI", ")", "{", "$", "this", "->", "composedURI", "=", "''", ";", "if", "(", "null", "!==", "$", "this", "->", "scheme", ")", "{", "$", "this", ...
Recomposes the components of this Uri as a string. A string equivalent to the original input string, or to the string computed from the original string, as appropriate, is returned. This can be influence bij normalization, reference resolution, and so a string is constructed from this Uri's components according to th...
[ "Recomposes", "the", "components", "of", "this", "Uri", "as", "a", "string", "." ]
train
https://github.com/mvdbos/vdb-uri/blob/48264d5cd3a61b5166bf62468381cd58405b63ca/src/VDB/Uri/Uri.php#L133-L169