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 |
|---|---|---|---|---|---|---|---|---|---|---|
j-d/draggy | src/Draggy/Autocode/Base/AttributeBase.php | AttributeBase.setOwnerSide | public function setOwnerSide($ownerSide)
{
if (!is_bool($ownerSide)) {
throw new \InvalidArgumentException('The attribute ownerSide on the class Attribute has to be boolean (' . gettype($ownerSide) . ('object' === gettype($ownerSide) ? ' ' . get_class($ownerSide) : '') . ' given).');
}
... | php | public function setOwnerSide($ownerSide)
{
if (!is_bool($ownerSide)) {
throw new \InvalidArgumentException('The attribute ownerSide on the class Attribute has to be boolean (' . gettype($ownerSide) . ('object' === gettype($ownerSide) ? ' ' . get_class($ownerSide) : '') . ' given).');
}
... | [
"public",
"function",
"setOwnerSide",
"(",
"$",
"ownerSide",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"ownerSide",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The attribute ownerSide on the class Attribute has to be boolean ('",
".",
... | Set ownerSide
@param boolean $ownerSide
@return Attribute
@throws \InvalidArgumentException | [
"Set",
"ownerSide"
] | train | https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L995-L1004 |
j-d/draggy | src/Draggy/Autocode/Base/AttributeBase.php | AttributeBase.setInverse | public function setInverse($inverse)
{
if (!is_bool($inverse)) {
throw new \InvalidArgumentException('The attribute inverse on the class Attribute has to be boolean (' . gettype($inverse) . ('object' === gettype($inverse) ? ' ' . get_class($inverse) : '') . ' given).');
}
$this-... | php | public function setInverse($inverse)
{
if (!is_bool($inverse)) {
throw new \InvalidArgumentException('The attribute inverse on the class Attribute has to be boolean (' . gettype($inverse) . ('object' === gettype($inverse) ? ' ' . get_class($inverse) : '') . ' given).');
}
$this-... | [
"public",
"function",
"setInverse",
"(",
"$",
"inverse",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"inverse",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The attribute inverse on the class Attribute has to be boolean ('",
".",
"getty... | Set inverse
@param boolean $inverse
@return Attribute
@throws \InvalidArgumentException | [
"Set",
"inverse"
] | train | https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L1065-L1074 |
arndtteunissen/column-layout | Classes/Utility/EmConfigurationUtility.php | EmConfigurationUtility.getSettings | public static function getSettings()
{
if (self::$settings === null) {
$configuration = self::parseSettings();
self::$settings = new EmConfiguration($configuration);
}
return self::$settings;
} | php | public static function getSettings()
{
if (self::$settings === null) {
$configuration = self::parseSettings();
self::$settings = new EmConfiguration($configuration);
}
return self::$settings;
} | [
"public",
"static",
"function",
"getSettings",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"settings",
"===",
"null",
")",
"{",
"$",
"configuration",
"=",
"self",
"::",
"parseSettings",
"(",
")",
";",
"self",
"::",
"$",
"settings",
"=",
"new",
"EmConf... | Parses the extension settings.
@return EmConfiguration | [
"Parses",
"the",
"extension",
"settings",
"."
] | train | https://github.com/arndtteunissen/column-layout/blob/ad737068eef3b084d4d0e3a48e6a3d8277af9560/Classes/Utility/EmConfigurationUtility.php#L28-L36 |
xiewulong/yii2-fileupload | oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php | ClassMapGenerator.createMap | public static function createMap($dir)
{
if (is_string($dir)) {
$dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
}
$map = array();
foreach ($dir as $file) {
if (!$file->isFile()) {
continue;
}
... | php | public static function createMap($dir)
{
if (is_string($dir)) {
$dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
}
$map = array();
foreach ($dir as $file) {
if (!$file->isFile()) {
continue;
}
... | [
"public",
"static",
"function",
"createMap",
"(",
"$",
"dir",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"dir",
")",
")",
"{",
"$",
"dir",
"=",
"new",
"\\",
"RecursiveIteratorIterator",
"(",
"new",
"\\",
"RecursiveDirectoryIterator",
"(",
"$",
"dir",
")... | Iterate over all files in the given directory searching for classes
@param Iterator|string $dir The directory to search in or an iterator
@return array A class map array | [
"Iterate",
"over",
"all",
"files",
"in",
"the",
"given",
"directory",
"searching",
"for",
"classes"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php#L46-L74 |
xiewulong/yii2-fileupload | oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php | ClassMapGenerator.findClasses | private static function findClasses($path)
{
$contents = file_get_contents($path);
$tokens = token_get_all($contents);
$T_TRAIT = version_compare(PHP_VERSION, '5.4', '<') ? -1 : T_TRAIT;
$classes = array();
$namespace = '';
for ($i = 0, $max = count($tokens); $i ... | php | private static function findClasses($path)
{
$contents = file_get_contents($path);
$tokens = token_get_all($contents);
$T_TRAIT = version_compare(PHP_VERSION, '5.4', '<') ? -1 : T_TRAIT;
$classes = array();
$namespace = '';
for ($i = 0, $max = count($tokens); $i ... | [
"private",
"static",
"function",
"findClasses",
"(",
"$",
"path",
")",
"{",
"$",
"contents",
"=",
"file_get_contents",
"(",
"$",
"path",
")",
";",
"$",
"tokens",
"=",
"token_get_all",
"(",
"$",
"contents",
")",
";",
"$",
"T_TRAIT",
"=",
"version_compare",
... | Extract the classes in the given file
@param string $path The file to check
@return array The found classes | [
"Extract",
"the",
"classes",
"in",
"the",
"given",
"file"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php#L83-L132 |
php-lug/lug | src/Bundle/GridBundle/Context/LocaleContext.php | LocaleContext.getLocale | public function getLocale()
{
$locales = $this->localeContext->getLocales();
if (($locale = reset($locales)) === false) {
throw new LocaleNotFoundException();
}
return $locale;
} | php | public function getLocale()
{
$locales = $this->localeContext->getLocales();
if (($locale = reset($locales)) === false) {
throw new LocaleNotFoundException();
}
return $locale;
} | [
"public",
"function",
"getLocale",
"(",
")",
"{",
"$",
"locales",
"=",
"$",
"this",
"->",
"localeContext",
"->",
"getLocales",
"(",
")",
";",
"if",
"(",
"(",
"$",
"locale",
"=",
"reset",
"(",
"$",
"locales",
")",
")",
"===",
"false",
")",
"{",
"thr... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Context/LocaleContext.php#L39-L48 |
hametuha/wpametu | src/WPametu/UI/Field/Taxonomy.php | Taxonomy.get_options | protected function get_options(){
$terms = get_terms($this->name);
if( !$terms || is_wp_error($terms) ){
return [];
}else{
$result = [];
foreach( $terms as $term ){
$result[$term->term_id] = $term->name;
}
return $result... | php | protected function get_options(){
$terms = get_terms($this->name);
if( !$terms || is_wp_error($terms) ){
return [];
}else{
$result = [];
foreach( $terms as $term ){
$result[$term->term_id] = $term->name;
}
return $result... | [
"protected",
"function",
"get_options",
"(",
")",
"{",
"$",
"terms",
"=",
"get_terms",
"(",
"$",
"this",
"->",
"name",
")",
";",
"if",
"(",
"!",
"$",
"terms",
"||",
"is_wp_error",
"(",
"$",
"terms",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"e... | Get terms as option
@return array | [
"Get",
"terms",
"as",
"option"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Field/Taxonomy.php#L53-L64 |
antaresproject/notifications | src/Http/Form/Form.php | Form.buttons | protected function buttons($fluent, Fieldset $fieldset)
{
$fieldset->control('button', 'cancel')
->field(function() {
return app('html')->link(handles("antares::notifications/"), trans('Cancel'), ['class' => 'btn btn--md btn--default mdl-button mdl-js-button']);
... | php | protected function buttons($fluent, Fieldset $fieldset)
{
$fieldset->control('button', 'cancel')
->field(function() {
return app('html')->link(handles("antares::notifications/"), trans('Cancel'), ['class' => 'btn btn--md btn--default mdl-button mdl-js-button']);
... | [
"protected",
"function",
"buttons",
"(",
"$",
"fluent",
",",
"Fieldset",
"$",
"fieldset",
")",
"{",
"$",
"fieldset",
"->",
"control",
"(",
"'button'",
",",
"'cancel'",
")",
"->",
"field",
"(",
"function",
"(",
")",
"{",
"return",
"app",
"(",
"'html'",
... | buttons in form
@param Fluent $fluent
@param Fieldset $fieldset | [
"buttons",
"in",
"form"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Form/Form.php#L160-L193 |
antaresproject/notifications | src/Http/Form/Form.php | Form.onCreate | public function onCreate()
{
$this->grid->attributes([
'url' => handles('antares::notifications/store'),
'method' => 'POST',
]);
$layout = ($this->fluent->type == 'sms') ? 'antares/notifications::admin.index.form_sms' : 'antares/notifications::admin.index.form';
... | php | public function onCreate()
{
$this->grid->attributes([
'url' => handles('antares::notifications/store'),
'method' => 'POST',
]);
$layout = ($this->fluent->type == 'sms') ? 'antares/notifications::admin.index.form_sms' : 'antares/notifications::admin.index.form';
... | [
"public",
"function",
"onCreate",
"(",
")",
"{",
"$",
"this",
"->",
"grid",
"->",
"attributes",
"(",
"[",
"'url'",
"=>",
"handles",
"(",
"'antares::notifications/store'",
")",
",",
"'method'",
"=>",
"'POST'",
",",
"]",
")",
";",
"$",
"layout",
"=",
"(",
... | on create scenario
@param String $type
@return \Antares\Notifications\Http\Form\Form | [
"on",
"create",
"scenario"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Form/Form.php#L213-L222 |
antaresproject/notifications | src/Http/Form/Form.php | Form.getNotificationContentData | protected function getNotificationContentData($fluent, $langId, $key = 'title')
{
foreach ($fluent->contents as $content) {
if ($langId !== $content['lang_id']) {
continue;
}
return array_get($content, $key);
}
return '';
} | php | protected function getNotificationContentData($fluent, $langId, $key = 'title')
{
foreach ($fluent->contents as $content) {
if ($langId !== $content['lang_id']) {
continue;
}
return array_get($content, $key);
}
return '';
} | [
"protected",
"function",
"getNotificationContentData",
"(",
"$",
"fluent",
",",
"$",
"langId",
",",
"$",
"key",
"=",
"'title'",
")",
"{",
"foreach",
"(",
"$",
"fluent",
"->",
"contents",
"as",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"langId",
"!==",
... | Gets notification data
@param Fluent $fluent
@param mixed $langId
@param String $key
@return String | [
"Gets",
"notification",
"data"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Form/Form.php#L232-L241 |
ajgarlag/AjglCsv | src/Writer/WriterAbstract.php | WriterAbstract.writeRow | public function writeRow(array $row, $inputCharset = IoInterface::CHARSET_DEFAULT)
{
if ($inputCharset !== $this->getFileCharset()) {
$row = $this->convertRowCharset($row, $inputCharset, $this->getFileCharset());
}
$this->doWrite($this->getHandler(), $row, $this->getDelimiter());... | php | public function writeRow(array $row, $inputCharset = IoInterface::CHARSET_DEFAULT)
{
if ($inputCharset !== $this->getFileCharset()) {
$row = $this->convertRowCharset($row, $inputCharset, $this->getFileCharset());
}
$this->doWrite($this->getHandler(), $row, $this->getDelimiter());... | [
"public",
"function",
"writeRow",
"(",
"array",
"$",
"row",
",",
"$",
"inputCharset",
"=",
"IoInterface",
"::",
"CHARSET_DEFAULT",
")",
"{",
"if",
"(",
"$",
"inputCharset",
"!==",
"$",
"this",
"->",
"getFileCharset",
"(",
")",
")",
"{",
"$",
"row",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/ajgarlag/AjglCsv/blob/28872f58b9ef864893cac6faddfcb1229c2c2047/src/Writer/WriterAbstract.php#L43-L51 |
ajgarlag/AjglCsv | src/Writer/WriterAbstract.php | WriterAbstract.writeRows | public function writeRows(array $rows, $inputCharset = IoInterface::CHARSET_DEFAULT)
{
foreach ($rows as $row) {
$this->writeRow($row, $inputCharset);
}
return $this;
} | php | public function writeRows(array $rows, $inputCharset = IoInterface::CHARSET_DEFAULT)
{
foreach ($rows as $row) {
$this->writeRow($row, $inputCharset);
}
return $this;
} | [
"public",
"function",
"writeRows",
"(",
"array",
"$",
"rows",
",",
"$",
"inputCharset",
"=",
"IoInterface",
"::",
"CHARSET_DEFAULT",
")",
"{",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"$",
"this",
"->",
"writeRow",
"(",
"$",
"row",
",",... | {@inheritdoc} | [
"{"
] | train | https://github.com/ajgarlag/AjglCsv/blob/28872f58b9ef864893cac6faddfcb1229c2c2047/src/Writer/WriterAbstract.php#L56-L63 |
RhubarbPHP/Module.RestApi | src/Modelling/ApiModel.php | ApiModel.delete | public function delete()
{
if ($this->isNewRecord()) {
throw new DeleteModelException("New models can't be deleted.");
}
$this->beforeDelete();
$this->raiseEvent("BeforeDelete");
$this->Deleted = true;
$this->save();
$this->afterDelete();
... | php | public function delete()
{
if ($this->isNewRecord()) {
throw new DeleteModelException("New models can't be deleted.");
}
$this->beforeDelete();
$this->raiseEvent("BeforeDelete");
$this->Deleted = true;
$this->save();
$this->afterDelete();
... | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNewRecord",
"(",
")",
")",
"{",
"throw",
"new",
"DeleteModelException",
"(",
"\"New models can't be deleted.\"",
")",
";",
"}",
"$",
"this",
"->",
"beforeDelete",
"(",
")",
";"... | Replaces the standard delete by flagging the entry deleted instead. | [
"Replaces",
"the",
"standard",
"delete",
"by",
"flagging",
"the",
"entry",
"deleted",
"instead",
"."
] | train | https://github.com/RhubarbPHP/Module.RestApi/blob/825d2b920caed13811971c5eb2784a94417787bd/src/Modelling/ApiModel.php#L55-L69 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package._init | protected function _init($definition=null)
{
if (!is_null($definition)) {
$this->_packageXml = simplexml_load_string($definition);
} else {
$packageXmlStub = <<<END
<?xml version="1.0"?>
<package>
<name />
<version />
<stability />
<license />
<channel />... | php | protected function _init($definition=null)
{
if (!is_null($definition)) {
$this->_packageXml = simplexml_load_string($definition);
} else {
$packageXmlStub = <<<END
<?xml version="1.0"?>
<package>
<name />
<version />
<stability />
<license />
<channel />... | [
"protected",
"function",
"_init",
"(",
"$",
"definition",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"definition",
")",
")",
"{",
"$",
"this",
"->",
"_packageXml",
"=",
"simplexml_load_string",
"(",
"$",
"definition",
")",
";",
"}",
"e... | Initializes an empty package object
@param null|string $definition optional package definition xml
@return Mage_Connect_Package | [
"Initializes",
"an",
"empty",
"package",
"object"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L165-L194 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package._loadFile | protected function _loadFile($filename='')
{
if (is_null($this->_reader)) {
$this->_reader = new Mage_Connect_Package_Reader($filename);
}
$content = $this->_reader->load();
$this->_packageXml = simplexml_load_string($content);
return $this;
} | php | protected function _loadFile($filename='')
{
if (is_null($this->_reader)) {
$this->_reader = new Mage_Connect_Package_Reader($filename);
}
$content = $this->_reader->load();
$this->_packageXml = simplexml_load_string($content);
return $this;
} | [
"protected",
"function",
"_loadFile",
"(",
"$",
"filename",
"=",
"''",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_reader",
")",
")",
"{",
"$",
"this",
"->",
"_reader",
"=",
"new",
"Mage_Connect_Package_Reader",
"(",
"$",
"filename",
")",
... | Loads a package from specified file
@param string $filename
@return Mage_Connect_Package | [
"Loads",
"a",
"package",
"from",
"specified",
"file"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L202-L210 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.save | public function save($path)
{
$this->validate();
$path = rtrim($path, "\\/") . DS;
$this->_savePackage($path);
return $this;
} | php | public function save($path)
{
$this->validate();
$path = rtrim($path, "\\/") . DS;
$this->_savePackage($path);
return $this;
} | [
"public",
"function",
"save",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"validate",
"(",
")",
";",
"$",
"path",
"=",
"rtrim",
"(",
"$",
"path",
",",
"\"\\\\/\"",
")",
".",
"DS",
";",
"$",
"this",
"->",
"_savePackage",
"(",
"$",
"path",
")",
... | Creates a package and saves it
@param string $path
@return Mage_Connect_Package | [
"Creates",
"a",
"package",
"and",
"saves",
"it"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L218-L224 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package._savePackage | protected function _savePackage($path)
{
$fileName = $this->getReleaseFilename();
if (is_null($this->_writer)) {
$this->_writer = new Mage_Connect_Package_Writer($this->getContents(), $path.$fileName);
}
$this->_writer
->composePackage()
->addPacka... | php | protected function _savePackage($path)
{
$fileName = $this->getReleaseFilename();
if (is_null($this->_writer)) {
$this->_writer = new Mage_Connect_Package_Writer($this->getContents(), $path.$fileName);
}
$this->_writer
->composePackage()
->addPacka... | [
"protected",
"function",
"_savePackage",
"(",
"$",
"path",
")",
"{",
"$",
"fileName",
"=",
"$",
"this",
"->",
"getReleaseFilename",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_writer",
")",
")",
"{",
"$",
"this",
"->",
"_writer",
"... | Creates a package archive and saves it to specified path
@param string $path
@return Mage_Connect_Package | [
"Creates",
"a",
"package",
"archive",
"and",
"saves",
"it",
"to",
"specified",
"path"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L232-L243 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.setAuthors | public function setAuthors($authors)
{
$this->_authors = $authors;
foreach ($authors as $_author) {
$this->addAuthor($_author['name'], $_author['user'], $_author['email']);
}
return $this;
} | php | public function setAuthors($authors)
{
$this->_authors = $authors;
foreach ($authors as $_author) {
$this->addAuthor($_author['name'], $_author['user'], $_author['email']);
}
return $this;
} | [
"public",
"function",
"setAuthors",
"(",
"$",
"authors",
")",
"{",
"$",
"this",
"->",
"_authors",
"=",
"$",
"authors",
";",
"foreach",
"(",
"$",
"authors",
"as",
"$",
"_author",
")",
"{",
"$",
"this",
"->",
"addAuthor",
"(",
"$",
"_author",
"[",
"'na... | Puts value to <authors />
array(
array('name'=>'Name1', 'user'=>'User1', 'email'=>'email1@email.com'),
array('name'=>'Name2', 'user'=>'User2', 'email'=>'email2@email.com'),
);
@param array $authors
@return Mage_Connect_Package | [
"Puts",
"value",
"to",
"<authors",
"/",
">"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L326-L333 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.addAuthor | public function addAuthor($name=null, $user=null, $email=null)
{
$this->_authors[] = array(
'name' =>$name,
'user' =>$user,
'email'=>$email
);
$author = $this->_packageXml->authors->addChild('author');
$author->addChild('name', $name);
$aut... | php | public function addAuthor($name=null, $user=null, $email=null)
{
$this->_authors[] = array(
'name' =>$name,
'user' =>$user,
'email'=>$email
);
$author = $this->_packageXml->authors->addChild('author');
$author->addChild('name', $name);
$aut... | [
"public",
"function",
"addAuthor",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"user",
"=",
"null",
",",
"$",
"email",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_authors",
"[",
"]",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"name",
",",
"'user'",
"=>... | Add author to <authors/>
@param string $name
@param string $user
@param string $email
@return Mage_Connect_Package | [
"Add",
"author",
"to",
"<authors",
"/",
">"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L343-L355 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.setLicense | public function setLicense($license, $uri=null)
{
$this->_packageXml->license = $license;
if ($uri) {
$this->_packageXml->license['uri'] = $uri;
}
return $this;
} | php | public function setLicense($license, $uri=null)
{
$this->_packageXml->license = $license;
if ($uri) {
$this->_packageXml->license['uri'] = $uri;
}
return $this;
} | [
"public",
"function",
"setLicense",
"(",
"$",
"license",
",",
"$",
"uri",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_packageXml",
"->",
"license",
"=",
"$",
"license",
";",
"if",
"(",
"$",
"uri",
")",
"{",
"$",
"this",
"->",
"_packageXml",
"->",
"... | Puts value to <license/>, also method can used for set attribute URI.
@param string $license
@param string $uri
@return Mage_Connect_Package | [
"Puts",
"value",
"to",
"<license",
"/",
">",
"also",
"method",
"can",
"used",
"for",
"set",
"attribute",
"URI",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L412-L419 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package._getNode | protected function _getNode($tag, $parent, $name='')
{
$found = false;
foreach ($parent->xpath($tag) as $_node) {
if ($_node['name'] == $name) {
$node = $_node;
$found = true;
break;
}
}
if (!$found) {
... | php | protected function _getNode($tag, $parent, $name='')
{
$found = false;
foreach ($parent->xpath($tag) as $_node) {
if ($_node['name'] == $name) {
$node = $_node;
$found = true;
break;
}
}
if (!$found) {
... | [
"protected",
"function",
"_getNode",
"(",
"$",
"tag",
",",
"$",
"parent",
",",
"$",
"name",
"=",
"''",
")",
"{",
"$",
"found",
"=",
"false",
";",
"foreach",
"(",
"$",
"parent",
"->",
"xpath",
"(",
"$",
"tag",
")",
"as",
"$",
"_node",
")",
"{",
... | Retrieve SimpleXMLElement node by xpath. If it absent, create new.
For comparing nodes method uses attribute "name" in each nodes.
If attribute "name" is same for both nodes, nodes are same.
@param string $tag
@param SimpleXMLElement $parent
@param string $name
@return SimpleXMLElement | [
"Retrieve",
"SimpleXMLElement",
"node",
"by",
"xpath",
".",
"If",
"it",
"absent",
"create",
"new",
".",
"For",
"comparing",
"nodes",
"method",
"uses",
"attribute",
"name",
"in",
"each",
"nodes",
".",
"If",
"attribute",
"name",
"is",
"same",
"for",
"both",
... | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L443-L460 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.addContent | public function addContent($path, $targetName)
{
$found = false;
$parent = $this->_getNode('target', $this->_packageXml->contents, $targetName);
$source = str_replace('\\', '/', $path);
$directories = explode('/', dirname($source));
foreach ($directories as $directory) {
... | php | public function addContent($path, $targetName)
{
$found = false;
$parent = $this->_getNode('target', $this->_packageXml->contents, $targetName);
$source = str_replace('\\', '/', $path);
$directories = explode('/', dirname($source));
foreach ($directories as $directory) {
... | [
"public",
"function",
"addContent",
"(",
"$",
"path",
",",
"$",
"targetName",
")",
"{",
"$",
"found",
"=",
"false",
";",
"$",
"parent",
"=",
"$",
"this",
"->",
"_getNode",
"(",
"'target'",
",",
"$",
"this",
"->",
"_packageXml",
"->",
"contents",
",",
... | Add directory or file to <contents />.
@param string $path Path to directory or file
@param string $targetName Target name.
@param string $hash MD5 hash of the file
@return Mage_Connect_Package | [
"Add",
"directory",
"or",
"file",
"to",
"<contents",
"/",
">",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L470-L488 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.addContentDir | public function addContentDir($targetName, $path, $exclude=null, $include=null)
{
$targetDir = $this->getTarget()->getTargetUri($targetName);
$targetDirLen = strlen($targetDir . DS);
//get all subdirectories and files.
$entries = @glob($targetDir. DS . $path . DS . "{,.}*", GLOB_BRAC... | php | public function addContentDir($targetName, $path, $exclude=null, $include=null)
{
$targetDir = $this->getTarget()->getTargetUri($targetName);
$targetDirLen = strlen($targetDir . DS);
//get all subdirectories and files.
$entries = @glob($targetDir. DS . $path . DS . "{,.}*", GLOB_BRAC... | [
"public",
"function",
"addContentDir",
"(",
"$",
"targetName",
",",
"$",
"path",
",",
"$",
"exclude",
"=",
"null",
",",
"$",
"include",
"=",
"null",
")",
"{",
"$",
"targetDir",
"=",
"$",
"this",
"->",
"getTarget",
"(",
")",
"->",
"getTargetUri",
"(",
... | Add directory recursively (with subdirectory and file).
Exclude and Include can be add using Regular Expression.
@param string $targetName Target name
@param string $targetDir Path for target name
@param string $path Path to directory
@param string $exclude Exclude
@param string $include Include
@return Mage_Connect_P... | [
"Add",
"directory",
"recursively",
"(",
"with",
"subdirectory",
"and",
"file",
")",
".",
"Exclude",
"and",
"Include",
"can",
"be",
"add",
"using",
"Regular",
"Expression",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L501-L529 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.addCompatible | public function addCompatible($packageName, $channel, $minVersion, $maxVersion)
{
$package = $this->_packageXml->compatible->addChild('package');
$package->addChild('name', $packageName);
$package->addChild('channel', $channel);
$package->addChild('min', $minVersion);
$packag... | php | public function addCompatible($packageName, $channel, $minVersion, $maxVersion)
{
$package = $this->_packageXml->compatible->addChild('package');
$package->addChild('name', $packageName);
$package->addChild('channel', $channel);
$package->addChild('min', $minVersion);
$packag... | [
"public",
"function",
"addCompatible",
"(",
"$",
"packageName",
",",
"$",
"channel",
",",
"$",
"minVersion",
",",
"$",
"maxVersion",
")",
"{",
"$",
"package",
"=",
"$",
"this",
"->",
"_packageXml",
"->",
"compatible",
"->",
"addChild",
"(",
"'package'",
")... | Add value to <compatible />.
@param string $packageName
@param string $channel
@param string $minVersion
@param string $maxVersion
@return Mage_Connect_Package | [
"Add",
"value",
"to",
"<compatible",
"/",
">",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L540-L548 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.setDependencyPhpVersion | public function setDependencyPhpVersion($minVersion, $maxVersion)
{
$parent = $this->_packageXml->dependencies;
$parent = $this->_getNode('required', $parent);
$parent = $this->_getNode('php', $parent);
$parent->addChild('min', $minVersion);
$parent->addChild('max', $maxVersi... | php | public function setDependencyPhpVersion($minVersion, $maxVersion)
{
$parent = $this->_packageXml->dependencies;
$parent = $this->_getNode('required', $parent);
$parent = $this->_getNode('php', $parent);
$parent->addChild('min', $minVersion);
$parent->addChild('max', $maxVersi... | [
"public",
"function",
"setDependencyPhpVersion",
"(",
"$",
"minVersion",
",",
"$",
"maxVersion",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"_packageXml",
"->",
"dependencies",
";",
"$",
"parent",
"=",
"$",
"this",
"->",
"_getNode",
"(",
"'required'",
... | Set dependency from php version.
@param string $minVersion
@param string $maxVersion
@return Mage_Connect_Package | [
"Set",
"dependency",
"from",
"php",
"version",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L557-L565 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.checkPhpVersion | public function checkPhpVersion()
{
$min = $this->getDependencyPhpVersionMin();
$max = $this->getDependencyPhpVersionMax();
$minOk = $min? version_compare(PHP_VERSION, $min, ">=") : true;
$maxOk = $max? version_compare(PHP_VERSION, $max, "<=") : true;
if(!$minOk || !$maxOk)... | php | public function checkPhpVersion()
{
$min = $this->getDependencyPhpVersionMin();
$max = $this->getDependencyPhpVersionMax();
$minOk = $min? version_compare(PHP_VERSION, $min, ">=") : true;
$maxOk = $max? version_compare(PHP_VERSION, $max, "<=") : true;
if(!$minOk || !$maxOk)... | [
"public",
"function",
"checkPhpVersion",
"(",
")",
"{",
"$",
"min",
"=",
"$",
"this",
"->",
"getDependencyPhpVersionMin",
"(",
")",
";",
"$",
"max",
"=",
"$",
"this",
"->",
"getDependencyPhpVersionMax",
"(",
")",
";",
"$",
"minOk",
"=",
"$",
"min",
"?",
... | Check PHP version restriction
@param $phpVersion PHP_VERSION by default
@return true | string | [
"Check",
"PHP",
"version",
"restriction"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L573-L594 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.checkPhpDependencies | public function checkPhpDependencies()
{
$errors = array();
foreach($this->getDependencyPhpExtensions() as $dep)
{
if(!extension_loaded($dep['name'])) {
$errors[] = $dep;
}
}
if(count($errors)) {
return $errors;
}
... | php | public function checkPhpDependencies()
{
$errors = array();
foreach($this->getDependencyPhpExtensions() as $dep)
{
if(!extension_loaded($dep['name'])) {
$errors[] = $dep;
}
}
if(count($errors)) {
return $errors;
}
... | [
"public",
"function",
"checkPhpDependencies",
"(",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getDependencyPhpExtensions",
"(",
")",
"as",
"$",
"dep",
")",
"{",
"if",
"(",
"!",
"extension_loaded",
"(",
"$",
... | Check PHP extensions availability
@throws Exceptiom on failure
@return true | array | [
"Check",
"PHP",
"extensions",
"availability"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L602-L615 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.setDependencyPhpExtensions | public function setDependencyPhpExtensions($extensions)
{
foreach($extensions as $_extension) {
$this->addDependencyExtension(
$_extension['name'],
$_extension['min_version'],
$_extension['max_version']
);
}
return $this... | php | public function setDependencyPhpExtensions($extensions)
{
foreach($extensions as $_extension) {
$this->addDependencyExtension(
$_extension['name'],
$_extension['min_version'],
$_extension['max_version']
);
}
return $this... | [
"public",
"function",
"setDependencyPhpExtensions",
"(",
"$",
"extensions",
")",
"{",
"foreach",
"(",
"$",
"extensions",
"as",
"$",
"_extension",
")",
"{",
"$",
"this",
"->",
"addDependencyExtension",
"(",
"$",
"_extension",
"[",
"'name'",
"]",
",",
"$",
"_e... | Set dependency from php extensions.
$extension has next view:
array('curl', 'mysql')
@param array|string $extensions
@return Mage_Connect_Package | [
"Set",
"dependency",
"from",
"php",
"extensions",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L627-L637 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.setDependencyPackages | public function setDependencyPackages($packages, $clear = false)
{
if($clear) {
unset($this->_packageXml->dependencies->required->package);
}
foreach($packages as $_package) {
$filesArrayCondition = isset($_package['files']) && is_array($_package['files']);
... | php | public function setDependencyPackages($packages, $clear = false)
{
if($clear) {
unset($this->_packageXml->dependencies->required->package);
}
foreach($packages as $_package) {
$filesArrayCondition = isset($_package['files']) && is_array($_package['files']);
... | [
"public",
"function",
"setDependencyPackages",
"(",
"$",
"packages",
",",
"$",
"clear",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"clear",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_packageXml",
"->",
"dependencies",
"->",
"required",
"->",
"package",
")... | Set dependency from another packages.
$packages should contain:
array(
array('name'=>'test1', 'channel'=>'test1', 'min_version'=>'0.0.1', 'max_version'=>'0.1.0'),
array('name'=>'test2', 'channel'=>'test2', 'min_version'=>'0.0.1', 'max_version'=>'0.1.0'),
)
@param array $packages
@param bool $clear
@return Mage_Connec... | [
"Set",
"dependency",
"from",
"another",
"packages",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L652-L672 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.addDependencyPackage | public function addDependencyPackage($name, $channel, $minVersion, $maxVersion, $files = array())
{
$parent = $this->_packageXml->dependencies;
$parent = $this->_getNode('required', $parent);
$parent = $parent->addChild('package');
$parent->addChild('name', $name);
$parent->a... | php | public function addDependencyPackage($name, $channel, $minVersion, $maxVersion, $files = array())
{
$parent = $this->_packageXml->dependencies;
$parent = $this->_getNode('required', $parent);
$parent = $parent->addChild('package');
$parent->addChild('name', $name);
$parent->a... | [
"public",
"function",
"addDependencyPackage",
"(",
"$",
"name",
",",
"$",
"channel",
",",
"$",
"minVersion",
",",
"$",
"maxVersion",
",",
"$",
"files",
"=",
"array",
"(",
")",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"_packageXml",
"->",
"depen... | Add package to dependency packages.
@param string $package
@param string $channel
@param string $minVersion
@param string $maxVersion
@return Mage_Connect_Package | [
"Add",
"package",
"to",
"dependency",
"packages",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L685-L706 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.addDependencyExtension | public function addDependencyExtension($name, $minVersion, $maxVersion)
{
$parent = $this->_packageXml->dependencies;
$parent = $this->_getNode('required', $parent);
$parent = $parent->addChild('extension');
$parent->addChild('name', $name);
$parent->addChild('min', $minVersi... | php | public function addDependencyExtension($name, $minVersion, $maxVersion)
{
$parent = $this->_packageXml->dependencies;
$parent = $this->_getNode('required', $parent);
$parent = $parent->addChild('extension');
$parent->addChild('name', $name);
$parent->addChild('min', $minVersi... | [
"public",
"function",
"addDependencyExtension",
"(",
"$",
"name",
",",
"$",
"minVersion",
",",
"$",
"maxVersion",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"_packageXml",
"->",
"dependencies",
";",
"$",
"parent",
"=",
"$",
"this",
"->",
"_getNode",
... | Add package to dependency extension.
@param string $package
@param string $minVersion
@param string $maxVersion
@return Mage_Connect_Package | [
"Add",
"package",
"to",
"dependency",
"extension",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L718-L727 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.getAuthors | public function getAuthors()
{
if (is_array($this->_authors)) return $this->_authors;
$this->_authors = array();
if(!isset($this->_packageXml->authors->author)) {
return array();
}
foreach ($this->_packageXml->authors->author as $_author) {
$this->_aut... | php | public function getAuthors()
{
if (is_array($this->_authors)) return $this->_authors;
$this->_authors = array();
if(!isset($this->_packageXml->authors->author)) {
return array();
}
foreach ($this->_packageXml->authors->author as $_author) {
$this->_aut... | [
"public",
"function",
"getAuthors",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"_authors",
")",
")",
"return",
"$",
"this",
"->",
"_authors",
";",
"$",
"this",
"->",
"_authors",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"isset... | Get list of authors in associative array.
@return array | [
"Get",
"list",
"of",
"authors",
"in",
"associative",
"array",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L776-L791 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.getContents | public function getContents()
{
if (is_array($this->_contents)) return $this->_contents;
$this->_contents = array();
if(!isset($this->_packageXml->contents->target)) {
return $this->_contents;
}
foreach($this->_packageXml->contents->target as $target) {
... | php | public function getContents()
{
if (is_array($this->_contents)) return $this->_contents;
$this->_contents = array();
if(!isset($this->_packageXml->contents->target)) {
return $this->_contents;
}
foreach($this->_packageXml->contents->target as $target) {
... | [
"public",
"function",
"getContents",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"_contents",
")",
")",
"return",
"$",
"this",
"->",
"_contents",
";",
"$",
"this",
"->",
"_contents",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"i... | Create list of all files from package.xml
@return array | [
"Create",
"list",
"of",
"all",
"files",
"from",
"package",
".",
"xml"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L868-L880 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package._getList | protected function _getList($parent, $path)
{
if (count($parent) == 0) {
$this->_contents[] = $path;
} else {
foreach($parent as $_content) {
$this->_getList($_content, ($path ? $path . DS : '') . $_content['name']);
}
}
} | php | protected function _getList($parent, $path)
{
if (count($parent) == 0) {
$this->_contents[] = $path;
} else {
foreach($parent as $_content) {
$this->_getList($_content, ($path ? $path . DS : '') . $_content['name']);
}
}
} | [
"protected",
"function",
"_getList",
"(",
"$",
"parent",
",",
"$",
"path",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"parent",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"_contents",
"[",
"]",
"=",
"$",
"path",
";",
"}",
"else",
"{",
"foreach",
... | Helper for getContents(). Create recursively list.
@param SimpleXMLElement $parent
@param string $path | [
"Helper",
"for",
"getContents",
"()",
".",
"Create",
"recursively",
"list",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L888-L897 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.getHashContents | public function getHashContents()
{
if (is_array($this->_hashContents)) return $this->_hashContents;
$this->_hashContents = array();
if(!isset($this->_packageXml->contents->target)) {
return $this->_hashContents;
}
foreach($this->_packageXml->contents->target as $... | php | public function getHashContents()
{
if (is_array($this->_hashContents)) return $this->_hashContents;
$this->_hashContents = array();
if(!isset($this->_packageXml->contents->target)) {
return $this->_hashContents;
}
foreach($this->_packageXml->contents->target as $... | [
"public",
"function",
"getHashContents",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"_hashContents",
")",
")",
"return",
"$",
"this",
"->",
"_hashContents",
";",
"$",
"this",
"->",
"_hashContents",
"=",
"array",
"(",
")",
";",
"if",
... | Create list of all files from package.xml with hash
@return array | [
"Create",
"list",
"of",
"all",
"files",
"from",
"package",
".",
"xml",
"with",
"hash"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L904-L916 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package._getHashList | protected function _getHashList($parent, $path, $hash='')
{
if (count($parent) == 0) {
$this->_hashContents[$path] = $hash;
} else {
foreach($parent as $_content) {
$contentHash = '';
if (isset($_content['hash'])) {
$content... | php | protected function _getHashList($parent, $path, $hash='')
{
if (count($parent) == 0) {
$this->_hashContents[$path] = $hash;
} else {
foreach($parent as $_content) {
$contentHash = '';
if (isset($_content['hash'])) {
$content... | [
"protected",
"function",
"_getHashList",
"(",
"$",
"parent",
",",
"$",
"path",
",",
"$",
"hash",
"=",
"''",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"parent",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"_hashContents",
"[",
"$",
"path",
"]",
"="... | Helper for getHashContents(). Create recursively list.
@param SimpleXMLElement $parent
@param string $path | [
"Helper",
"for",
"getHashContents",
"()",
".",
"Create",
"recursively",
"list",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L924-L937 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.getCompatible | public function getCompatible()
{
if (is_array($this->_compatible)) return $this->_compatible;
$this->_compatible = array();
if(!isset($this->_packageXml->compatible->package)) {
return array();
}
foreach ($this->_packageXml->compatible->package as $_package) {
... | php | public function getCompatible()
{
if (is_array($this->_compatible)) return $this->_compatible;
$this->_compatible = array();
if(!isset($this->_packageXml->compatible->package)) {
return array();
}
foreach ($this->_packageXml->compatible->package as $_package) {
... | [
"public",
"function",
"getCompatible",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"_compatible",
")",
")",
"return",
"$",
"this",
"->",
"_compatible",
";",
"$",
"this",
"->",
"_compatible",
"=",
"array",
"(",
")",
";",
"if",
"(",
"... | Get compatible packages.
@return array | [
"Get",
"compatible",
"packages",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L944-L960 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.getDependencyPhpVersionMin | public function getDependencyPhpVersionMin()
{
if(!isset($this->_packageXml->dependencies->required->php->min)) {
return false;
}
return (string)$this->_packageXml->dependencies->required->php->min;
} | php | public function getDependencyPhpVersionMin()
{
if(!isset($this->_packageXml->dependencies->required->php->min)) {
return false;
}
return (string)$this->_packageXml->dependencies->required->php->min;
} | [
"public",
"function",
"getDependencyPhpVersionMin",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_packageXml",
"->",
"dependencies",
"->",
"required",
"->",
"php",
"->",
"min",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"("... | Getter
@return string | [
"Getter"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L967-L973 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.getDependencyPhpVersionMax | public function getDependencyPhpVersionMax()
{
if(!isset($this->_packageXml->dependencies->required->php->max)) {
return false;
}
return (string)$this->_packageXml->dependencies->required->php->max;
} | php | public function getDependencyPhpVersionMax()
{
if(!isset($this->_packageXml->dependencies->required->php->max)) {
return false;
}
return (string)$this->_packageXml->dependencies->required->php->max;
} | [
"public",
"function",
"getDependencyPhpVersionMax",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_packageXml",
"->",
"dependencies",
"->",
"required",
"->",
"php",
"->",
"max",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"("... | Getter
@return string | [
"Getter"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L980-L986 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.getDependencyPhpExtensions | public function getDependencyPhpExtensions()
{
if (is_array($this->_dependencyPhpExtensions)) return $this->_dependencyPhpExtensions;
$this->_dependencyPhpExtensions = array();
if (!isset($this->_packageXml->dependencies->required->extension)) {
return $this->_dependencyPhpExtens... | php | public function getDependencyPhpExtensions()
{
if (is_array($this->_dependencyPhpExtensions)) return $this->_dependencyPhpExtensions;
$this->_dependencyPhpExtensions = array();
if (!isset($this->_packageXml->dependencies->required->extension)) {
return $this->_dependencyPhpExtens... | [
"public",
"function",
"getDependencyPhpExtensions",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"_dependencyPhpExtensions",
")",
")",
"return",
"$",
"this",
"->",
"_dependencyPhpExtensions",
";",
"$",
"this",
"->",
"_dependencyPhpExtensions",
"="... | Get list of php extensions.
@return array | [
"Get",
"list",
"of",
"php",
"extensions",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L993-L1008 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.getDependencyPackages | public function getDependencyPackages()
{
$this->_dependencyPackages = array();
if (!isset($this->_packageXml->dependencies->required->package)) {
return $this->_dependencyPackages;
}
foreach($this->_packageXml->dependencies->required->package as $_package) {
... | php | public function getDependencyPackages()
{
$this->_dependencyPackages = array();
if (!isset($this->_packageXml->dependencies->required->package)) {
return $this->_dependencyPackages;
}
foreach($this->_packageXml->dependencies->required->package as $_package) {
... | [
"public",
"function",
"getDependencyPackages",
"(",
")",
"{",
"$",
"this",
"->",
"_dependencyPackages",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_packageXml",
"->",
"dependencies",
"->",
"required",
"->",
"package",
")... | Get list of dependency packages.
@return array | [
"Get",
"list",
"of",
"dependency",
"packages",
"."
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L1015-L1040 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.validate | public function validate()
{
$v = $this->validator();
/**
* Validation map
*
* Format:
*
* 'key' => array(
* 'method' => this class method name to call, string, required
* 'method_args' => optional args for 'method' call, array, ... | php | public function validate()
{
$v = $this->validator();
/**
* Validation map
*
* Format:
*
* 'key' => array(
* 'method' => this class method name to call, string, required
* 'method_args' => optional args for 'method' call, array, ... | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"v",
"=",
"$",
"this",
"->",
"validator",
"(",
")",
";",
"/**\n * Validation map\n *\n * Format:\n *\n * 'key' => array(\n * 'method' => this class method name to call, string, r... | Validate package. Errors can be
retreived by calling getErrors();
@return bool | [
"Validate",
"package",
".",
"Errors",
"can",
"be",
"retreived",
"by",
"calling",
"getErrors",
"()",
";"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L1107-L1271 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.importDataV1x | public function importDataV1x(array $data)
{
$this->_packageXml = null;
$this->_init();
// Import simple data
if (isset($data['name'])) {
$this->setName($data['name']);
}
if (isset($data['summary'])) {
$this->setSummary($data['summary']);
... | php | public function importDataV1x(array $data)
{
$this->_packageXml = null;
$this->_init();
// Import simple data
if (isset($data['name'])) {
$this->setName($data['name']);
}
if (isset($data['summary'])) {
$this->setSummary($data['summary']);
... | [
"public",
"function",
"importDataV1x",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"_packageXml",
"=",
"null",
";",
"$",
"this",
"->",
"_init",
"(",
")",
";",
"// Import simple data",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'name'",
"]"... | Import package information from previous version of Magento Connect Manager
@param array $data
@return Mage_Connect_Package | [
"Import",
"package",
"information",
"from",
"previous",
"version",
"of",
"Magento",
"Connect",
"Manager"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L1340-L1479 |
mridang/magazine | lib/magento/Package.php | Mage_Connect_Package.convertChannelFromV1x | public function convertChannelFromV1x($channel)
{
$channelMap = array(
'connect.magentocommerce.com/community' => 'community',
'connect.magentocommerce.com/core' => 'community'
);
if (!empty($channel) && isset($channelMap[$channel])) {
$channel = $channelM... | php | public function convertChannelFromV1x($channel)
{
$channelMap = array(
'connect.magentocommerce.com/community' => 'community',
'connect.magentocommerce.com/core' => 'community'
);
if (!empty($channel) && isset($channelMap[$channel])) {
$channel = $channelM... | [
"public",
"function",
"convertChannelFromV1x",
"(",
"$",
"channel",
")",
"{",
"$",
"channelMap",
"=",
"array",
"(",
"'connect.magentocommerce.com/community'",
"=>",
"'community'",
",",
"'connect.magentocommerce.com/core'",
"=>",
"'community'",
")",
";",
"if",
"(",
"!"... | Convert package channel in order for it to be compatible with current version of Magento Connect Manager
@param string $channel
@return string | [
"Convert",
"package",
"channel",
"in",
"order",
"for",
"it",
"to",
"be",
"compatible",
"with",
"current",
"version",
"of",
"Magento",
"Connect",
"Manager"
] | train | https://github.com/mridang/magazine/blob/5b3cfecc472c61fde6af63efe62690a30a267a04/lib/magento/Package.php#L1488-L1498 |
timiTao/behat-symfony-container | src/Factory/ContainerFactory.php | ContainerFactory.createContainer | private function createContainer(array $files)
{
$containerBuilder = new Container();
$loader = $this->createLoader($containerBuilder);
foreach ($files as $file) {
$loader->load($file);
}
return $containerBuilder;
} | php | private function createContainer(array $files)
{
$containerBuilder = new Container();
$loader = $this->createLoader($containerBuilder);
foreach ($files as $file) {
$loader->load($file);
}
return $containerBuilder;
} | [
"private",
"function",
"createContainer",
"(",
"array",
"$",
"files",
")",
"{",
"$",
"containerBuilder",
"=",
"new",
"Container",
"(",
")",
";",
"$",
"loader",
"=",
"$",
"this",
"->",
"createLoader",
"(",
"$",
"containerBuilder",
")",
";",
"foreach",
"(",
... | @param array $files
@return Container | [
"@param",
"array",
"$files"
] | train | https://github.com/timiTao/behat-symfony-container/blob/f6b87583300d2e2a19b35bc66fb741a133684f7e/src/Factory/ContainerFactory.php#L52-L61 |
php-lug/lug | src/Bundle/GridBundle/Handler/GridHandler.php | GridHandler.handle | public function handle(GridInterface $grid, FormInterface $form = null, FormInterface $batchForm = null)
{
$valid = $form !== null && $form->isValid();
$view = $this->handler->handle(
$grid,
$valid ? $form->get('filters')->getData() : [],
$valid ? $form->get('sor... | php | public function handle(GridInterface $grid, FormInterface $form = null, FormInterface $batchForm = null)
{
$valid = $form !== null && $form->isValid();
$view = $this->handler->handle(
$grid,
$valid ? $form->get('filters')->getData() : [],
$valid ? $form->get('sor... | [
"public",
"function",
"handle",
"(",
"GridInterface",
"$",
"grid",
",",
"FormInterface",
"$",
"form",
"=",
"null",
",",
"FormInterface",
"$",
"batchForm",
"=",
"null",
")",
"{",
"$",
"valid",
"=",
"$",
"form",
"!==",
"null",
"&&",
"$",
"form",
"->",
"i... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Handler/GridHandler.php#L39-L59 |
expectation-php/expect | src/config/ConfigurableConfiguration.php | ConfigurableConfiguration.merge | public function merge(Configuration $config)
{
$matcherRegistrars = array_merge(
$this->matcherRegistrars,
$config->getMatcherRegistrars()
);
$reporter = $config->getResultReporter();
if ($reporter === null) {
$reporter = $this->resultReporter;
... | php | public function merge(Configuration $config)
{
$matcherRegistrars = array_merge(
$this->matcherRegistrars,
$config->getMatcherRegistrars()
);
$reporter = $config->getResultReporter();
if ($reporter === null) {
$reporter = $this->resultReporter;
... | [
"public",
"function",
"merge",
"(",
"Configuration",
"$",
"config",
")",
"{",
"$",
"matcherRegistrars",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"matcherRegistrars",
",",
"$",
"config",
"->",
"getMatcherRegistrars",
"(",
")",
")",
";",
"$",
"reporter",
"=... | {@inheritdoc} | [
"{"
] | train | https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/config/ConfigurableConfiguration.php#L52-L66 |
protophp/session | src/SessionManager.php | SessionManager.getUniqueKey | private function getUniqueKey(): string
{
do {
try {
$isDuplicate = null;
$key = random_bytes($this->getOpt(self::OPT_SESSION_KEY_LENGTH));
// Ask for duplicate key from storage
$this->emit('duplicate-check', [$key, &$isDuplicate])... | php | private function getUniqueKey(): string
{
do {
try {
$isDuplicate = null;
$key = random_bytes($this->getOpt(self::OPT_SESSION_KEY_LENGTH));
// Ask for duplicate key from storage
$this->emit('duplicate-check', [$key, &$isDuplicate])... | [
"private",
"function",
"getUniqueKey",
"(",
")",
":",
"string",
"{",
"do",
"{",
"try",
"{",
"$",
"isDuplicate",
"=",
"null",
";",
"$",
"key",
"=",
"random_bytes",
"(",
"$",
"this",
"->",
"getOpt",
"(",
"self",
"::",
"OPT_SESSION_KEY_LENGTH",
")",
")",
... | Generate unique key
@return string
@throws SessionException | [
"Generate",
"unique",
"key"
] | train | https://github.com/protophp/session/blob/bd90c882628a556727b5bc02d63005a59afa4c3a/src/SessionManager.php#L68-L84 |
php-lug/lug | src/Component/Grid/DataSource/Doctrine/ORM/ExpressionBuilder.php | ExpressionBuilder.between | public function between($value, $x, $y)
{
return $this->expr->between($value, $x, $y);
} | php | public function between($value, $x, $y)
{
return $this->expr->between($value, $x, $y);
} | [
"public",
"function",
"between",
"(",
"$",
"value",
",",
"$",
"x",
",",
"$",
"y",
")",
"{",
"return",
"$",
"this",
"->",
"expr",
"->",
"between",
"(",
"$",
"value",
",",
"$",
"x",
",",
"$",
"y",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/DataSource/Doctrine/ORM/ExpressionBuilder.php#L174-L177 |
php-lug/lug | src/Component/Grid/DataSource/Doctrine/ORM/ExpressionBuilder.php | ExpressionBuilder.notBetween | public function notBetween($value, $x, $y)
{
return $this->expr->not($this->between($value, $x, $y));
} | php | public function notBetween($value, $x, $y)
{
return $this->expr->not($this->between($value, $x, $y));
} | [
"public",
"function",
"notBetween",
"(",
"$",
"value",
",",
"$",
"x",
",",
"$",
"y",
")",
"{",
"return",
"$",
"this",
"->",
"expr",
"->",
"not",
"(",
"$",
"this",
"->",
"between",
"(",
"$",
"value",
",",
"$",
"x",
",",
"$",
"y",
")",
")",
";"... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/DataSource/Doctrine/ORM/ExpressionBuilder.php#L182-L185 |
php-lug/lug | src/Component/Grid/Column/Type/TwigType.php | TwigType.render | public function render($data, array $options)
{
return $this->renderTemplate($this->getValue($data, $options), $options);
} | php | public function render($data, array $options)
{
return $this->renderTemplate($this->getValue($data, $options), $options);
} | [
"public",
"function",
"render",
"(",
"$",
"data",
",",
"array",
"$",
"options",
")",
"{",
"return",
"$",
"this",
"->",
"renderTemplate",
"(",
"$",
"this",
"->",
"getValue",
"(",
"$",
"data",
",",
"$",
"options",
")",
",",
"$",
"options",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Column/Type/TwigType.php#L41-L44 |
php-lug/lug | src/Component/Grid/Column/Type/TwigType.php | TwigType.renderTemplate | protected function renderTemplate($data, array $options)
{
return $this->twig->render(
$options['template'],
array_merge($options['context'], ['column' => $options['column'], 'data' => $data])
);
} | php | protected function renderTemplate($data, array $options)
{
return $this->twig->render(
$options['template'],
array_merge($options['context'], ['column' => $options['column'], 'data' => $data])
);
} | [
"protected",
"function",
"renderTemplate",
"(",
"$",
"data",
",",
"array",
"$",
"options",
")",
"{",
"return",
"$",
"this",
"->",
"twig",
"->",
"render",
"(",
"$",
"options",
"[",
"'template'",
"]",
",",
"array_merge",
"(",
"$",
"options",
"[",
"'context... | @param mixed $data
@param mixed[] $options
@return string | [
"@param",
"mixed",
"$data",
"@param",
"mixed",
"[]",
"$options"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Column/Type/TwigType.php#L74-L80 |
traderinteractive/util-http-php | src/Util/Http.php | Http.parseHeaders | public static function parseHeaders(string $rawHeaders) : array
{
if (empty(trim($rawHeaders))) {
throw new InvalidArgumentException('$rawHeaders cannot be whitespace');
}
$headers = [];
$rawHeaders = preg_replace("/\r\n[\t ]+/", ' ', trim($rawHeaders));
$fields ... | php | public static function parseHeaders(string $rawHeaders) : array
{
if (empty(trim($rawHeaders))) {
throw new InvalidArgumentException('$rawHeaders cannot be whitespace');
}
$headers = [];
$rawHeaders = preg_replace("/\r\n[\t ]+/", ' ', trim($rawHeaders));
$fields ... | [
"public",
"static",
"function",
"parseHeaders",
"(",
"string",
"$",
"rawHeaders",
")",
":",
"array",
"{",
"if",
"(",
"empty",
"(",
"trim",
"(",
"$",
"rawHeaders",
")",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$rawHeaders cannot be whit... | Parses HTTP headers into an associative array.
Example:
<code>
$headers = "HTTP/1.1 200 OK\r\n".
"content-type: text/html; charset=UTF-8\r\n".
"Server: Funky/1.0\r\n".
"Set-Cookie: foo=bar\r\n".
"Set-Cookie: baz=quux\r\n".
"Folds: are\r\n\treformatted\r\n";
print_r(\TraderInteractive\HttpUtil::parseHeaders($headers));... | [
"Parses",
"HTTP",
"headers",
"into",
"an",
"associative",
"array",
"."
] | train | https://github.com/traderinteractive/util-http-php/blob/d3bba26fbd9ec5a3227c4580717019bf16a58c67/src/Util/Http.php#L49-L96 |
traderinteractive/util-http-php | src/Util/Http.php | Http.buildQueryString | public static function buildQueryString(array $parameters) : string
{
$queryStrings = [];
foreach ($parameters as $parameterName => $parameterValue) {
$parameterName = rawurlencode($parameterName);
if (is_array($parameterValue)) {
foreach ($parameterValue as ... | php | public static function buildQueryString(array $parameters) : string
{
$queryStrings = [];
foreach ($parameters as $parameterName => $parameterValue) {
$parameterName = rawurlencode($parameterName);
if (is_array($parameterValue)) {
foreach ($parameterValue as ... | [
"public",
"static",
"function",
"buildQueryString",
"(",
"array",
"$",
"parameters",
")",
":",
"string",
"{",
"$",
"queryStrings",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"parameterName",
"=>",
"$",
"parameterValue",
")",
"{",
"$"... | Generate URL-encoded query string
Example:
<code>
$parameters = [
'param1' => ['value', 'another value'],
'param2' => 'a value',
'param3' => false,
];
$queryString = \TraderInteractive\HttpUtil::buildQueryString($parameters);
echo $queryString
</code>
Output:
<pre>
param1=value¶m1=another+value¶m2=a+value&p... | [
"Generate",
"URL",
"-",
"encoded",
"query",
"string"
] | train | https://github.com/traderinteractive/util-http-php/blob/d3bba26fbd9ec5a3227c4580717019bf16a58c67/src/Util/Http.php#L137-L159 |
traderinteractive/util-http-php | src/Util/Http.php | Http.getQueryParams | public static function getQueryParams(string $url, array $collapsedParams = []) : array
{
$queryString = parse_url($url, PHP_URL_QUERY);
if (!is_string($queryString)) {
return [];
}
$collapsedParams = array_flip($collapsedParams);
$result = [];
foreach (... | php | public static function getQueryParams(string $url, array $collapsedParams = []) : array
{
$queryString = parse_url($url, PHP_URL_QUERY);
if (!is_string($queryString)) {
return [];
}
$collapsedParams = array_flip($collapsedParams);
$result = [];
foreach (... | [
"public",
"static",
"function",
"getQueryParams",
"(",
"string",
"$",
"url",
",",
"array",
"$",
"collapsedParams",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"queryString",
"=",
"parse_url",
"(",
"$",
"url",
",",
"PHP_URL_QUERY",
")",
";",
"if",
"(",
... | Get an array of all url parameters.
@param string $url The url to parse such as http://foo.com/bar/?id=boo&another=wee&another=boo
@param array $collapsedParams Parameters to collapse. ex. 'id' => ['boo'] to just 'id' => 'boo'. Exception thrown
if more than 1 value
@return array such as ['id' => ['boo'], 'another' =>... | [
"Get",
"an",
"array",
"of",
"all",
"url",
"parameters",
"."
] | train | https://github.com/traderinteractive/util-http-php/blob/d3bba26fbd9ec5a3227c4580717019bf16a58c67/src/Util/Http.php#L172-L211 |
traderinteractive/util-http-php | src/Util/Http.php | Http.getQueryParamsCollapsed | public static function getQueryParamsCollapsed(string $url, array $expectedArrayParams = []) : array
{
$queryString = parse_url($url, PHP_URL_QUERY);
if (!is_string($queryString)) {
return [];
}
$result = [];
foreach (explode('&', $queryString) as $arg) {
... | php | public static function getQueryParamsCollapsed(string $url, array $expectedArrayParams = []) : array
{
$queryString = parse_url($url, PHP_URL_QUERY);
if (!is_string($queryString)) {
return [];
}
$result = [];
foreach (explode('&', $queryString) as $arg) {
... | [
"public",
"static",
"function",
"getQueryParamsCollapsed",
"(",
"string",
"$",
"url",
",",
"array",
"$",
"expectedArrayParams",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"queryString",
"=",
"parse_url",
"(",
"$",
"url",
",",
"PHP_URL_QUERY",
")",
";",
"i... | Get an array of all url parameters.
@param string $url The url to parse such as http://foo.com/bar/?single=boo&multi=wee&multi=boo
@param array $expectedArrayParams List of parameter names which are not collapsed.
@return array such as ['single' => 'boo', 'multi' => ['wee', 'boo']] if 'multi' is given in $expectedArr... | [
"Get",
"an",
"array",
"of",
"all",
"url",
"parameters",
"."
] | train | https://github.com/traderinteractive/util-http-php/blob/d3bba26fbd9ec5a3227c4580717019bf16a58c67/src/Util/Http.php#L223-L259 |
siad007/versioncontrol_hg | src/Factory.php | Factory.getInstance | public static function getInstance($command, $options = [])
{
$commandClassName = sprintf(
'\\Siad007\\VersionControl\\HG\\Command\\%sCommand',
ucfirst($command)
);
if (!class_exists($commandClassName)) {
throw new \InvalidArgumentException(
... | php | public static function getInstance($command, $options = [])
{
$commandClassName = sprintf(
'\\Siad007\\VersionControl\\HG\\Command\\%sCommand',
ucfirst($command)
);
if (!class_exists($commandClassName)) {
throw new \InvalidArgumentException(
... | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"command",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"commandClassName",
"=",
"sprintf",
"(",
"'\\\\Siad007\\\\VersionControl\\\\HG\\\\Command\\\\%sCommand'",
",",
"ucfirst",
"(",
"$",
"command",
")... | Factory method.
@param string $command
@param array $options
@return Command\AbstractCommand
@throws \InvalidArgumentException | [
"Factory",
"method",
"."
] | train | https://github.com/siad007/versioncontrol_hg/blob/e02ec9f1e88efae48f0e3296f65b1d99718b27cd/src/Factory.php#L84-L98 |
mikelgoig/nova-spotify-auth-tool | src/SpotifyAuthToolServiceProvider.php | SpotifyAuthToolServiceProvider.boot | public function boot()
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../database/migrations/2018_11_15_000000_create_spotify_table.php' => database_path('migrations/2018_11_15_000000_create_spotify_table.php'),
], 'migrations');
}
... | php | public function boot()
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../database/migrations/2018_11_15_000000_create_spotify_table.php' => database_path('migrations/2018_11_15_000000_create_spotify_table.php'),
], 'migrations');
}
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"runningInConsole",
"(",
")",
")",
"{",
"$",
"this",
"->",
"publishes",
"(",
"[",
"__DIR__",
".",
"'/../database/migrations/2018_11_15_000000_create_spotify_table.php'",
"=>"... | Bootstrap any application services.
@return void | [
"Bootstrap",
"any",
"application",
"services",
"."
] | train | https://github.com/mikelgoig/nova-spotify-auth-tool/blob/a5351c386206c45f77fe6ae833cdac51f2a030f4/src/SpotifyAuthToolServiceProvider.php#L18-L35 |
mikelgoig/nova-spotify-auth-tool | src/SpotifyAuthToolServiceProvider.php | SpotifyAuthToolServiceProvider.routes | protected function routes()
{
if ($this->app->routesAreCached()) {
return;
}
Route::middleware(['nova', Authorize::class])
->prefix('nova-vendor/nova-spotify-auth-tool')
->group(__DIR__.'/../routes/web.php');
Route::middleware(['nova', Authorize:... | php | protected function routes()
{
if ($this->app->routesAreCached()) {
return;
}
Route::middleware(['nova', Authorize::class])
->prefix('nova-vendor/nova-spotify-auth-tool')
->group(__DIR__.'/../routes/web.php');
Route::middleware(['nova', Authorize:... | [
"protected",
"function",
"routes",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"routesAreCached",
"(",
")",
")",
"{",
"return",
";",
"}",
"Route",
"::",
"middleware",
"(",
"[",
"'nova'",
",",
"Authorize",
"::",
"class",
"]",
")",
"->",
... | Register the tool's routes.
@return void | [
"Register",
"the",
"tool",
"s",
"routes",
"."
] | train | https://github.com/mikelgoig/nova-spotify-auth-tool/blob/a5351c386206c45f77fe6ae833cdac51f2a030f4/src/SpotifyAuthToolServiceProvider.php#L42-L55 |
hametuha/wpametu | src/WPametu/UI/Admin/EditMetaBox.php | EditMetaBox.add_meta_boxes | public function add_meta_boxes($post_type, $post){
if( $this->is_valid_post_type($post_type) && $this->has_cap() ){
if( empty($this->name) || empty($this->label) ){
$message = sprintf($this->__('<code>%s</code> has invalid name or label.'), get_called_class());
add_ac... | php | public function add_meta_boxes($post_type, $post){
if( $this->is_valid_post_type($post_type) && $this->has_cap() ){
if( empty($this->name) || empty($this->label) ){
$message = sprintf($this->__('<code>%s</code> has invalid name or label.'), get_called_class());
add_ac... | [
"public",
"function",
"add_meta_boxes",
"(",
"$",
"post_type",
",",
"$",
"post",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_valid_post_type",
"(",
"$",
"post_type",
")",
"&&",
"$",
"this",
"->",
"has_cap",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"("... | Register meta box
@param string $post_type
@param \WP_Post $post | [
"Register",
"meta",
"box"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Admin/EditMetaBox.php#L38-L49 |
FriendsOfApi/phraseapp | src/Model/Key/KeyCreated.php | KeyCreated.createFromArray | public static function createFromArray(array $data)
{
$self = new self();
if (isset($data['id'])) {
$self->setId($data['id']);
}
if (isset($data['name'])) {
$self->setName($data['name']);
}
if (isset($data['description'])) {
$self-... | php | public static function createFromArray(array $data)
{
$self = new self();
if (isset($data['id'])) {
$self->setId($data['id']);
}
if (isset($data['name'])) {
$self->setName($data['name']);
}
if (isset($data['description'])) {
$self-... | [
"public",
"static",
"function",
"createFromArray",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"self",
"=",
"new",
"self",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"self",
"->",
"setId",
"(",
"$",
... | @param array $data
@return KeyCreated | [
"@param",
"array",
"$data"
] | train | https://github.com/FriendsOfApi/phraseapp/blob/1553bf857eb0858f9a7eb905b085864d24f80886/src/Model/Key/KeyCreated.php#L74-L110 |
old-town/workflow-designer-server | src/Factory/WorkflowDescriptorApiRendererFactory.php | WorkflowDescriptorApiRendererFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
/** @var ApiProblemRenderer $apiProblemRenderer */
$apiProblemRenderer = $serviceLocator->get(ApiProblemRenderer::class);
$renderer = new WorkflowDescriptorApiRenderer($apiProblemRenderer);
return $renderer;
... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
/** @var ApiProblemRenderer $apiProblemRenderer */
$apiProblemRenderer = $serviceLocator->get(ApiProblemRenderer::class);
$renderer = new WorkflowDescriptorApiRenderer($apiProblemRenderer);
return $renderer;
... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"/** @var ApiProblemRenderer $apiProblemRenderer */",
"$",
"apiProblemRenderer",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"ApiProblemRenderer",
"::",
"class",
")",
... | {@inheritDoc}
@return WorkflowDescriptorApiRenderer
@throws \Zend\ServiceManager\Exception\ServiceNotFoundException | [
"{",
"@inheritDoc",
"}",
"@return",
"WorkflowDescriptorApiRenderer"
] | train | https://github.com/old-town/workflow-designer-server/blob/6389c5a515861cc8e0b769f1ca7be12c6b78c611/src/Factory/WorkflowDescriptorApiRendererFactory.php#L26-L34 |
php-lug/lug | src/Bundle/GridBundle/Action/Type/LinkSecureType.php | LinkSecureType.render | public function render($data, array $options)
{
$action = $options['action'];
return $this->formFactory->create(CsrfProtectionType::class, null, [
'method' => strtoupper($options['method']),
'action' => parent::render($data, $options),
'la... | php | public function render($data, array $options)
{
$action = $options['action'];
return $this->formFactory->create(CsrfProtectionType::class, null, [
'method' => strtoupper($options['method']),
'action' => parent::render($data, $options),
'la... | [
"public",
"function",
"render",
"(",
"$",
"data",
",",
"array",
"$",
"options",
")",
"{",
"$",
"action",
"=",
"$",
"options",
"[",
"'action'",
"]",
";",
"return",
"$",
"this",
"->",
"formFactory",
"->",
"create",
"(",
"CsrfProtectionType",
"::",
"class",... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Action/Type/LinkSecureType.php#L49-L59 |
php-lug/lug | src/Bundle/GridBundle/Action/Type/LinkSecureType.php | LinkSecureType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver
->setDefault('method', Request::METHOD_GET)
->setAllowedTypes('method', 'string');
} | php | public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver
->setDefault('method', Request::METHOD_GET)
->setAllowedTypes('method', 'string');
} | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"parent",
"::",
"configureOptions",
"(",
"$",
"resolver",
")",
";",
"$",
"resolver",
"->",
"setDefault",
"(",
"'method'",
",",
"Request",
"::",
"METHOD_GET",
")",
"->"... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Action/Type/LinkSecureType.php#L64-L71 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php | ezcBase.autoload | public static function autoload( $className )
{
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '(%s)', $className);
ezcBase::setPackageDir();
// Check whether the classname is already in the cached autoloadArray.
if ( array_key_exists( $className, ezcBase::$autoloadArray ) )
{
... | php | public static function autoload( $className )
{
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '(%s)', $className);
ezcBase::setPackageDir();
// Check whether the classname is already in the cached autoloadArray.
if ( array_key_exists( $className, ezcBase::$autoloadArray ) )
{
... | [
"public",
"static",
"function",
"autoload",
"(",
"$",
"className",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_DEBUG",
",",
"'(%s)'",
",",
"$",
"className",
")",
";",
"ezcBase",
"::",
"setPackageDir",
"(",
")",
";",
"// Check whether... | Tries to autoload the given className. If the className could be found
this method returns true, otherwise false.
This class caches the requested class names (including the ones who
failed to load).
@param string $className The name of the class that should be loaded.
@return bool | [
"Tries",
"to",
"autoload",
"the",
"given",
"className",
".",
"If",
"the",
"className",
"could",
"be",
"found",
"this",
"method",
"returns",
"true",
"otherwise",
"false",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php#L123-L217 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php | ezcBase.setPackageDir | protected static function setPackageDir()
{
if ( ezcBase::$packageDir !== null )
{
return;
}
// Get the path to the components.
$baseDir = dirname( __FILE__ );
switch ( ezcBase::$libraryMode )
{
case "custom":
ezcBase:... | php | protected static function setPackageDir()
{
if ( ezcBase::$packageDir !== null )
{
return;
}
// Get the path to the components.
$baseDir = dirname( __FILE__ );
switch ( ezcBase::$libraryMode )
{
case "custom":
ezcBase:... | [
"protected",
"static",
"function",
"setPackageDir",
"(",
")",
"{",
"if",
"(",
"ezcBase",
"::",
"$",
"packageDir",
"!==",
"null",
")",
"{",
"return",
";",
"}",
"// Get the path to the components.",
"$",
"baseDir",
"=",
"dirname",
"(",
"__FILE__",
")",
";",
"s... | Figures out the base path of the eZ Components installation.
It stores the path that it finds in a static member variable. The path
depends on the installation method of the eZ Components. The SVN version
has a different path than the PEAR installed version. | [
"Figures",
"out",
"the",
"base",
"path",
"of",
"the",
"eZ",
"Components",
"installation",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php#L237-L260 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php | ezcBase.requireFile | protected static function requireFile( $fileName, $className, $prefix )
{
$autoloadDir = ezcBase::$packageDir . "autoload/";
// We need the full path to the fileName. The method file_exists() doesn't
// automatically check the (php.ini) library paths. Therefore:
// file_exists( "ezc... | php | protected static function requireFile( $fileName, $className, $prefix )
{
$autoloadDir = ezcBase::$packageDir . "autoload/";
// We need the full path to the fileName. The method file_exists() doesn't
// automatically check the (php.ini) library paths. Therefore:
// file_exists( "ezc... | [
"protected",
"static",
"function",
"requireFile",
"(",
"$",
"fileName",
",",
"$",
"className",
",",
"$",
"prefix",
")",
"{",
"$",
"autoloadDir",
"=",
"ezcBase",
"::",
"$",
"packageDir",
".",
"\"autoload/\"",
";",
"// We need the full path to the fileName. The method... | Tries to load the autoload array and, if loaded correctly, includes the class.
@param string $fileName Name of the autoload file.
@param string $className Name of the class that should be autoloaded.
@param string $prefix The prefix of the class repository.
@return bool True is returned when the file is co... | [
"Tries",
"to",
"load",
"the",
"autoload",
"array",
"and",
"if",
"loaded",
"correctly",
"includes",
"the",
"class",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php#L272-L341 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php | ezcBase.loadFile | protected static function loadFile( $file )
{
switch ( ezcBase::$libraryMode )
{
case "devel":
case "tarball":
list( $first, $second ) = explode( '/', $file, 2 );
$file = $first . "/src/" . $second;
break;
case "cus... | php | protected static function loadFile( $file )
{
switch ( ezcBase::$libraryMode )
{
case "devel":
case "tarball":
list( $first, $second ) = explode( '/', $file, 2 );
$file = $first . "/src/" . $second;
break;
case "cus... | [
"protected",
"static",
"function",
"loadFile",
"(",
"$",
"file",
")",
"{",
"switch",
"(",
"ezcBase",
"::",
"$",
"libraryMode",
")",
"{",
"case",
"\"devel\"",
":",
"case",
"\"tarball\"",
":",
"list",
"(",
"$",
"first",
",",
"$",
"second",
")",
"=",
"exp... | Loads, require(), the given file name. If we are in development mode,
"/src/" is inserted into the path.
@param string $file The name of the file that should be loaded. | [
"Loads",
"require",
"()",
"the",
"given",
"file",
"name",
".",
"If",
"we",
"are",
"in",
"development",
"mode",
"/",
"src",
"/",
"is",
"inserted",
"into",
"the",
"path",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php#L349-L389 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php | ezcBase.checkDependency | public static function checkDependency( $component, $type, $value )
{
switch ( $type )
{
case self::DEP_PHP_EXTENSION:
if ( extension_loaded( $value ) )
{
return;
}
else
{
... | php | public static function checkDependency( $component, $type, $value )
{
switch ( $type )
{
case self::DEP_PHP_EXTENSION:
if ( extension_loaded( $value ) )
{
return;
}
else
{
... | [
"public",
"static",
"function",
"checkDependency",
"(",
"$",
"component",
",",
"$",
"type",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"self",
"::",
"DEP_PHP_EXTENSION",
":",
"if",
"(",
"extension_loaded",
"(",
"$",
"value... | Checks for dependencies on PHP versions or extensions
The function as called by the $component component checks for the $type
dependency. The dependency $type is compared against the $value. The
function aborts the script if the dependency is not matched.
@param string $component
@param int $type
@param mixed $value | [
"Checks",
"for",
"dependencies",
"on",
"PHP",
"versions",
"or",
"extensions"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php#L419-L448 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php | ezcBase.getRepositoryDirectories | public static function getRepositoryDirectories()
{
$autoloadDirs = array();
ezcBase::setPackageDir();
$repositoryDir = self::$currentWorkingDirectory ? self::$currentWorkingDirectory : ( realpath( dirname( __FILE__ ) . '/../../' ) );
$autoloadDirs['ezc'] = new ezcBaseRepositoryDirec... | php | public static function getRepositoryDirectories()
{
$autoloadDirs = array();
ezcBase::setPackageDir();
$repositoryDir = self::$currentWorkingDirectory ? self::$currentWorkingDirectory : ( realpath( dirname( __FILE__ ) . '/../../' ) );
$autoloadDirs['ezc'] = new ezcBaseRepositoryDirec... | [
"public",
"static",
"function",
"getRepositoryDirectories",
"(",
")",
"{",
"$",
"autoloadDirs",
"=",
"array",
"(",
")",
";",
"ezcBase",
"::",
"setPackageDir",
"(",
")",
";",
"$",
"repositoryDir",
"=",
"self",
"::",
"$",
"currentWorkingDirectory",
"?",
"self",
... | Return the list of directories that contain class repositories.
The path to the eZ components directory is always included in the result
array. Each element in the returned array has the format of:
packageDirectory => ezcBaseRepositoryDirectory
@return array(string=>ezcBaseRepositoryDirectory) | [
"Return",
"the",
"list",
"of",
"directories",
"that",
"contain",
"class",
"repositories",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php#L459-L473 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php | ezcBase.addClassRepository | public static function addClassRepository( $basePath, $autoloadDirPath = null, $prefix = null )
{
// check if base path exists
if ( !is_dir( $basePath ) )
{
throw new ezcBaseFileNotFoundException( $basePath, 'base directory' );
}
// calculate autoload path if it ... | php | public static function addClassRepository( $basePath, $autoloadDirPath = null, $prefix = null )
{
// check if base path exists
if ( !is_dir( $basePath ) )
{
throw new ezcBaseFileNotFoundException( $basePath, 'base directory' );
}
// calculate autoload path if it ... | [
"public",
"static",
"function",
"addClassRepository",
"(",
"$",
"basePath",
",",
"$",
"autoloadDirPath",
"=",
"null",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"// check if base path exists",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"basePath",
")",
")",
"{",
... | Adds an additional class repository.
Used for adding class repositoryies outside the eZ components to be
loaded by the autoload system.
This function takes two arguments: $basePath is the base path for the
whole class repository and $autoloadDirPath the path where autoload
files for this repository are found. The pat... | [
"Adds",
"an",
"additional",
"class",
"repository",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php#L551-L589 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php | ezcBase.getInstallationPath | public static function getInstallationPath()
{
self::setPackageDir();
$path = realpath( self::$packageDir );
if ( substr( $path, -1 ) !== DIRECTORY_SEPARATOR )
{
$path .= DIRECTORY_SEPARATOR;
}
return $path;
} | php | public static function getInstallationPath()
{
self::setPackageDir();
$path = realpath( self::$packageDir );
if ( substr( $path, -1 ) !== DIRECTORY_SEPARATOR )
{
$path .= DIRECTORY_SEPARATOR;
}
return $path;
} | [
"public",
"static",
"function",
"getInstallationPath",
"(",
")",
"{",
"self",
"::",
"setPackageDir",
"(",
")",
";",
"$",
"path",
"=",
"realpath",
"(",
"self",
"::",
"$",
"packageDir",
")",
";",
"if",
"(",
"substr",
"(",
"$",
"path",
",",
"-",
"1",
")... | Returns the base path of the eZ Components installation
This method returns the base path, including a trailing directory
separator.
@return string | [
"Returns",
"the",
"base",
"path",
"of",
"the",
"eZ",
"Components",
"installation"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php#L599-L609 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php | ezcBase.setRunMode | public static function setRunMode( $runMode )
{
if ( !in_array( $runMode, array( ezcBase::MODE_PRODUCTION, ezcBase::MODE_DEVELOPMENT ) ) )
{
throw new ezcBaseValueException( 'runMode', $runMode, 'ezcBase::MODE_PRODUCTION or ezcBase::MODE_DEVELOPMENT' );
}
self::$runMode ... | php | public static function setRunMode( $runMode )
{
if ( !in_array( $runMode, array( ezcBase::MODE_PRODUCTION, ezcBase::MODE_DEVELOPMENT ) ) )
{
throw new ezcBaseValueException( 'runMode', $runMode, 'ezcBase::MODE_PRODUCTION or ezcBase::MODE_DEVELOPMENT' );
}
self::$runMode ... | [
"public",
"static",
"function",
"setRunMode",
"(",
"$",
"runMode",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"runMode",
",",
"array",
"(",
"ezcBase",
"::",
"MODE_PRODUCTION",
",",
"ezcBase",
"::",
"MODE_DEVELOPMENT",
")",
")",
")",
"{",
"throw",
"n... | Sets the development mode to the one specified.
@param int $runMode | [
"Sets",
"the",
"development",
"mode",
"to",
"the",
"one",
"specified",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php#L616-L624 |
xiewulong/yii2-fileupload | oss/libs/symfony/yaml/Symfony/Component/Yaml/Inline.php | Inline.parse | public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false)
{
self::$exceptionOnInvalidType = $exceptionOnInvalidType;
self::$objectSupport = $objectSupport;
$value = trim($value);
if (0 == strlen($value)) {
return '';
}
... | php | public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false)
{
self::$exceptionOnInvalidType = $exceptionOnInvalidType;
self::$objectSupport = $objectSupport;
$value = trim($value);
if (0 == strlen($value)) {
return '';
}
... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"value",
",",
"$",
"exceptionOnInvalidType",
"=",
"false",
",",
"$",
"objectSupport",
"=",
"false",
")",
"{",
"self",
"::",
"$",
"exceptionOnInvalidType",
"=",
"$",
"exceptionOnInvalidType",
";",
"self",
"::",... | Converts a YAML string to a PHP array.
@param string $value A YAML string
@param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
@param Boolean $objectSupport true if object support is enabled, false otherwise
... | [
"Converts",
"a",
"YAML",
"string",
"to",
"a",
"PHP",
"array",
"."
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/yaml/Symfony/Component/Yaml/Inline.php#L39-L79 |
xiewulong/yii2-fileupload | oss/libs/symfony/yaml/Symfony/Component/Yaml/Inline.php | Inline.dump | public static function dump($value, $exceptionOnInvalidType = false, $objectSupport = false)
{
switch (true) {
case is_resource($value):
if ($exceptionOnInvalidType) {
throw new DumpException(sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_r... | php | public static function dump($value, $exceptionOnInvalidType = false, $objectSupport = false)
{
switch (true) {
case is_resource($value):
if ($exceptionOnInvalidType) {
throw new DumpException(sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_r... | [
"public",
"static",
"function",
"dump",
"(",
"$",
"value",
",",
"$",
"exceptionOnInvalidType",
"=",
"false",
",",
"$",
"objectSupport",
"=",
"false",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"is_resource",
"(",
"$",
"value",
")",
":",
"if",
"... | Dumps a given PHP variable to a YAML string.
@param mixed $value The PHP variable to convert
@param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
@param Boolean $objectSupport true if object support is enable... | [
"Dumps",
"a",
"given",
"PHP",
"variable",
"to",
"a",
"YAML",
"string",
"."
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/yaml/Symfony/Component/Yaml/Inline.php#L92-L145 |
xiewulong/yii2-fileupload | oss/libs/symfony/yaml/Symfony/Component/Yaml/Inline.php | Inline.dumpArray | private static function dumpArray($value, $exceptionOnInvalidType, $objectSupport)
{
// array
$keys = array_keys($value);
if ((1 == count($keys) && '0' == $keys[0])
|| (count($keys) > 1 && array_reduce($keys, function ($v, $w) { return (integer) $v + $w; }, 0) == count($keys) * (... | php | private static function dumpArray($value, $exceptionOnInvalidType, $objectSupport)
{
// array
$keys = array_keys($value);
if ((1 == count($keys) && '0' == $keys[0])
|| (count($keys) > 1 && array_reduce($keys, function ($v, $w) { return (integer) $v + $w; }, 0) == count($keys) * (... | [
"private",
"static",
"function",
"dumpArray",
"(",
"$",
"value",
",",
"$",
"exceptionOnInvalidType",
",",
"$",
"objectSupport",
")",
"{",
"// array",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"value",
")",
";",
"if",
"(",
"(",
"1",
"==",
"count",
"(",
... | Dumps a PHP array to a YAML string.
@param array $value The PHP array to dump
@param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
@param Boolean $objectSupport true if object support is enabled, false otherw... | [
"Dumps",
"a",
"PHP",
"array",
"to",
"a",
"YAML",
"string",
"."
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/yaml/Symfony/Component/Yaml/Inline.php#L156-L178 |
xiewulong/yii2-fileupload | oss/libs/symfony/yaml/Symfony/Component/Yaml/Inline.php | Inline.parseScalar | public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true)
{
if (in_array($scalar[$i], $stringDelimiters)) {
// quoted scalar
$output = self::parseQuotedScalar($scalar, $i);
if (null !== $delimiters) {
... | php | public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true)
{
if (in_array($scalar[$i], $stringDelimiters)) {
// quoted scalar
$output = self::parseQuotedScalar($scalar, $i);
if (null !== $delimiters) {
... | [
"public",
"static",
"function",
"parseScalar",
"(",
"$",
"scalar",
",",
"$",
"delimiters",
"=",
"null",
",",
"$",
"stringDelimiters",
"=",
"array",
"(",
"'\"'",
",",
"\"'\"",
")",
",",
"&",
"$",
"i",
"=",
"0",
",",
"$",
"evaluate",
"=",
"true",
")",
... | Parses a scalar to a YAML string.
@param scalar $scalar
@param string $delimiters
@param array $stringDelimiters
@param integer &$i
@param Boolean $evaluate
@return string A YAML string
@throws ParseException When malformed inline YAML string is parsed | [
"Parses",
"a",
"scalar",
"to",
"a",
"YAML",
"string",
"."
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/yaml/Symfony/Component/Yaml/Inline.php#L193-L226 |
getuisdk/getui-php-sdk | src/IGeTui.php | IGeTui.pushMessageToSingle | public function pushMessageToSingle($message, $target, $requestId = null)
{
if ($requestId === null || trim($requestId) === '') {
$requestId = uniqid('', true);
}
$params = $this->getSingleMessagePostData($message, $target, $requestId);
return $this->httpPostJSON($t... | php | public function pushMessageToSingle($message, $target, $requestId = null)
{
if ($requestId === null || trim($requestId) === '') {
$requestId = uniqid('', true);
}
$params = $this->getSingleMessagePostData($message, $target, $requestId);
return $this->httpPostJSON($t... | [
"public",
"function",
"pushMessageToSingle",
"(",
"$",
"message",
",",
"$",
"target",
",",
"$",
"requestId",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"requestId",
"===",
"null",
"||",
"trim",
"(",
"$",
"requestId",
")",
"===",
"''",
")",
"{",
"$",
"req... | 指定用户推送消息
@param IGtMessage $message
@param IGtTarget $target
@param string $requestId
@return Array {result:successed_offline,taskId:xxx} || {result:successed_online,taskId:xxx} || {result:error}
@throws RequestException
@throws \InvalidArgumentException
@throws \UnexpectedValueException
* | [
"指定用户推送消息"
] | train | https://github.com/getuisdk/getui-php-sdk/blob/e91773b099bcbfd7492a44086b373d1c9fee37e2/src/IGeTui.php#L182-L189 |
getuisdk/getui-php-sdk | src/IGeTui.php | IGeTui.cancelContentId | public function cancelContentId($contentId)
{
$params = array();
$params['action'] = 'cancleContentIdAction';
$params['appkey'] = $this->appkey;
$params['contentId'] = $contentId;
$rep = $this->httpPostJSON($this->host, $params);
return (string)$rep['result'] =... | php | public function cancelContentId($contentId)
{
$params = array();
$params['action'] = 'cancleContentIdAction';
$params['appkey'] = $this->appkey;
$params['contentId'] = $contentId;
$rep = $this->httpPostJSON($this->host, $params);
return (string)$rep['result'] =... | [
"public",
"function",
"cancelContentId",
"(",
"$",
"contentId",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'action'",
"]",
"=",
"'cancleContentIdAction'",
";",
"$",
"params",
"[",
"'appkey'",
"]",
"=",
"$",
"this",
"->",
... | 取消消息
@param String $contentId contentId
@return boolean
@throws RequestException
@throws \UnexpectedValueException
@throws \InvalidArgumentException
* | [
"取消消息"
] | train | https://github.com/getuisdk/getui-php-sdk/blob/e91773b099bcbfd7492a44086b373d1c9fee37e2/src/IGeTui.php#L244-L252 |
getuisdk/getui-php-sdk | src/IGeTui.php | IGeTui.pushMessageToList | public function pushMessageToList($contentId, $targetList)
{
$params = array();
$params['action'] = 'pushMessageToListAction';
$params['appkey'] = $this->appkey;
$params['contentId'] = $contentId;
$needDetails = GTConfig::isPushListNeedDetails();
$params['needD... | php | public function pushMessageToList($contentId, $targetList)
{
$params = array();
$params['action'] = 'pushMessageToListAction';
$params['appkey'] = $this->appkey;
$params['contentId'] = $contentId;
$needDetails = GTConfig::isPushListNeedDetails();
$params['needD... | [
"public",
"function",
"pushMessageToList",
"(",
"$",
"contentId",
",",
"$",
"targetList",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'action'",
"]",
"=",
"'pushMessageToListAction'",
";",
"$",
"params",
"[",
"'appkey'",
"]",... | 批量推送信息
@param String $contentId
@param Array <IGtTarget> targetList
@return Array {result:successed_offline,taskId:xxx} || {result:successed_online,taskId:xxx} || {result:error}
@throws \Exception
* | [
"批量推送信息"
] | train | https://github.com/getuisdk/getui-php-sdk/blob/e91773b099bcbfd7492a44086b373d1c9fee37e2/src/IGeTui.php#L261-L300 |
getuisdk/getui-php-sdk | src/IGeTui.php | IGeTui.pushAPNMessageToList | public function pushAPNMessageToList($appId, $contentId, $deviceTokenList)
{
$params = array();
$params['action'] = 'apnPushToListAction';
$params['appkey'] = $this->appkey;
$params['appId'] = $appId;
$params['contentId'] = $contentId;
$params['DTL'] = $deviceT... | php | public function pushAPNMessageToList($appId, $contentId, $deviceTokenList)
{
$params = array();
$params['action'] = 'apnPushToListAction';
$params['appkey'] = $this->appkey;
$params['appId'] = $appId;
$params['contentId'] = $contentId;
$params['DTL'] = $deviceT... | [
"public",
"function",
"pushAPNMessageToList",
"(",
"$",
"appId",
",",
"$",
"contentId",
",",
"$",
"deviceTokenList",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'action'",
"]",
"=",
"'apnPushToListAction'",
";",
"$",
"params"... | 根据deviceTokenList群推
@param $appId
@param $contentId
@param $deviceTokenList
@return mixed
@throws RequestException
@throws \UnexpectedValueException
@throws \InvalidArgumentException | [
"根据deviceTokenList群推"
] | train | https://github.com/getuisdk/getui-php-sdk/blob/e91773b099bcbfd7492a44086b373d1c9fee37e2/src/IGeTui.php#L465-L476 |
getuisdk/getui-php-sdk | src/IGeTui.php | IGeTui.getAPNContentId | public function getAPNContentId($appId, $message)
{
$params = array();
$params['action'] = 'apnGetContentIdAction';
$params['appkey'] = $this->appkey;
$params['appId'] = $appId;
$params['PI'] = base64_encode($message->getData()->getPushInfo()->serializeToString());
... | php | public function getAPNContentId($appId, $message)
{
$params = array();
$params['action'] = 'apnGetContentIdAction';
$params['appkey'] = $this->appkey;
$params['appId'] = $appId;
$params['PI'] = base64_encode($message->getData()->getPushInfo()->serializeToString());
... | [
"public",
"function",
"getAPNContentId",
"(",
"$",
"appId",
",",
"$",
"message",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'action'",
"]",
"=",
"'apnGetContentIdAction'",
";",
"$",
"params",
"[",
"'appkey'",
"]",
"=",
"... | 获取apn contentId
@param $appId
@param $message
@return string
@throws \Exception | [
"获取apn",
"contentId"
] | train | https://github.com/getuisdk/getui-php-sdk/blob/e91773b099bcbfd7492a44086b373d1c9fee37e2/src/IGeTui.php#L485-L498 |
flowcode/AmulenUserBundle | src/Flowcode/UserBundle/Controller/SecurityController.php | SecurityController.forgotCheckAction | public function forgotCheckAction(Request $request)
{
$error = null;
$last_email = null;
$userService = $this->get("flowcode.user");
$user = $userService->loadUserByUsername($request->get("_username"));
if ($user) {
$userService->resetPasssword($user);
}... | php | public function forgotCheckAction(Request $request)
{
$error = null;
$last_email = null;
$userService = $this->get("flowcode.user");
$user = $userService->loadUserByUsername($request->get("_username"));
if ($user) {
$userService->resetPasssword($user);
}... | [
"public",
"function",
"forgotCheckAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"error",
"=",
"null",
";",
"$",
"last_email",
"=",
"null",
";",
"$",
"userService",
"=",
"$",
"this",
"->",
"get",
"(",
"\"flowcode.user\"",
")",
";",
"$",
"user",
... | Forget check.
@Route("/forgot_check", name="amulen_forgot_check")
@Method("POST")
@Template("FlowcodeUserBundle:Security:forgot.html.twig") | [
"Forget",
"check",
"."
] | train | https://github.com/flowcode/AmulenUserBundle/blob/00055834d9f094e63dcd8d66e2fedb822fcddee0/src/Flowcode/UserBundle/Controller/SecurityController.php#L90-L112 |
flowcode/AmulenUserBundle | src/Flowcode/UserBundle/Controller/SecurityController.php | SecurityController.registerAction | public function registerAction(Request $request)
{
$user = new User();
$form = $this->createRegisterForm($user);
return array(
'form' => $form->createView(),
);
} | php | public function registerAction(Request $request)
{
$user = new User();
$form = $this->createRegisterForm($user);
return array(
'form' => $form->createView(),
);
} | [
"public",
"function",
"registerAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"new",
"User",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createRegisterForm",
"(",
"$",
"user",
")",
";",
"return",
"array",
"(",
"'form'",
... | Register new user.
@Route("/register", name="amulen_user_register")
@Method("GET")
@Template() | [
"Register",
"new",
"user",
"."
] | train | https://github.com/flowcode/AmulenUserBundle/blob/00055834d9f094e63dcd8d66e2fedb822fcddee0/src/Flowcode/UserBundle/Controller/SecurityController.php#L121-L129 |
flowcode/AmulenUserBundle | src/Flowcode/UserBundle/Controller/SecurityController.php | SecurityController.createRegisterForm | private function createRegisterForm(User $user)
{
$form = $this->createForm(new UserRegisterType(), $user, array(
'action' => $this->generateUrl('amulen_user_register_do'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Register'));
... | php | private function createRegisterForm(User $user)
{
$form = $this->createForm(new UserRegisterType(), $user, array(
'action' => $this->generateUrl('amulen_user_register_do'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Register'));
... | [
"private",
"function",
"createRegisterForm",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"UserRegisterType",
"(",
")",
",",
"$",
"user",
",",
"array",
"(",
"'action'",
"=>",
"$",
"this",
"->",
"gen... | Creates a form to edit a User entity.
@param User $entity The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"edit",
"a",
"User",
"entity",
"."
] | train | https://github.com/flowcode/AmulenUserBundle/blob/00055834d9f094e63dcd8d66e2fedb822fcddee0/src/Flowcode/UserBundle/Controller/SecurityController.php#L138-L148 |
flowcode/AmulenUserBundle | src/Flowcode/UserBundle/Controller/SecurityController.php | SecurityController.doRegisterAction | public function doRegisterAction(Request $request)
{
$user = new User();
$form = $this->createRegisterForm($user);
$form->handleRequest($request);
if ($form->isValid()) {
// FIXME: This have to be in the service.
$user->setStatus(User::STATUS_ACTIVE);
... | php | public function doRegisterAction(Request $request)
{
$user = new User();
$form = $this->createRegisterForm($user);
$form->handleRequest($request);
if ($form->isValid()) {
// FIXME: This have to be in the service.
$user->setStatus(User::STATUS_ACTIVE);
... | [
"public",
"function",
"doRegisterAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"new",
"User",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createRegisterForm",
"(",
"$",
"user",
")",
";",
"$",
"form",
"->",
"handleRequest... | Edits an existing User entity.
@Route("/register", name="amulen_user_register_do")
@Method("POST")
@Template("FlowcodeUserBundle:Security:register.html.twig") | [
"Edits",
"an",
"existing",
"User",
"entity",
"."
] | train | https://github.com/flowcode/AmulenUserBundle/blob/00055834d9f094e63dcd8d66e2fedb822fcddee0/src/Flowcode/UserBundle/Controller/SecurityController.php#L157-L186 |
Laralum/Events | src/Policies/EventPolicy.php | EventPolicy.view | public function view($user, Event $event)
{
if ($event->creator->id == $user->id) {
return true;
}
return User::findOrFail($user->id)->hasPermission('laralum::events.view');
} | php | public function view($user, Event $event)
{
if ($event->creator->id == $user->id) {
return true;
}
return User::findOrFail($user->id)->hasPermission('laralum::events.view');
} | [
"public",
"function",
"view",
"(",
"$",
"user",
",",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"creator",
"->",
"id",
"==",
"$",
"user",
"->",
"id",
")",
"{",
"return",
"true",
";",
"}",
"return",
"User",
"::",
"findOrFail",
... | Determine if the current user can view events.
@param mixed $user
@return bool | [
"Determine",
"if",
"the",
"current",
"user",
"can",
"view",
"events",
"."
] | train | https://github.com/Laralum/Events/blob/9dc36468f4253e7d040863a115ea94cded0e6aa5/src/Policies/EventPolicy.php#L57-L64 |
Laralum/Events | src/Policies/EventPolicy.php | EventPolicy.publicDelete | public function publicDelete($user, Event $event)
{
if ($event->creator->id == $user->id) {
return User::findOrFail($user->id)->hasPermission('laralum::events.delete-public');
}
return false;
} | php | public function publicDelete($user, Event $event)
{
if ($event->creator->id == $user->id) {
return User::findOrFail($user->id)->hasPermission('laralum::events.delete-public');
}
return false;
} | [
"public",
"function",
"publicDelete",
"(",
"$",
"user",
",",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"creator",
"->",
"id",
"==",
"$",
"user",
"->",
"id",
")",
"{",
"return",
"User",
"::",
"findOrFail",
"(",
"$",
"user",
"->... | Determine if the current user can delete events on public views.
@param mixed $user
@return bool | [
"Determine",
"if",
"the",
"current",
"user",
"can",
"delete",
"events",
"on",
"public",
"views",
"."
] | train | https://github.com/Laralum/Events/blob/9dc36468f4253e7d040863a115ea94cded0e6aa5/src/Policies/EventPolicy.php#L185-L192 |
42mate/towel | src/Towel/Controller/BaseController.php | BaseController.routeError | public function routeError(\Exception $e)
{
if ($e instanceof NotFoundHttpException) {
$responseContent = $this->twig()->render('Default\404.twig');
$response = new Response($responseContent, 404);
} else {
$responseContent = $this->twig()->render('Default\500.twi... | php | public function routeError(\Exception $e)
{
if ($e instanceof NotFoundHttpException) {
$responseContent = $this->twig()->render('Default\404.twig');
$response = new Response($responseContent, 404);
} else {
$responseContent = $this->twig()->render('Default\500.twi... | [
"public",
"function",
"routeError",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"e",
"instanceof",
"NotFoundHttpException",
")",
"{",
"$",
"responseContent",
"=",
"$",
"this",
"->",
"twig",
"(",
")",
"->",
"render",
"(",
"'Default\\404.twig... | 404 and 500 error page for non debug mode
@param \Exception $e
@return Response | [
"404",
"and",
"500",
"error",
"page",
"for",
"non",
"debug",
"mode"
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/BaseController.php#L34-L45 |
42mate/towel | src/Towel/Controller/BaseController.php | BaseController.setMessage | public function setMessage($type, $content)
{
$message = new \stdClass;
$message->mt = $type;
$message->content = $content;
$messages = $this->session()->get('messages', array());
$messages[] = $message;
$this->session()->set('messages', $messages);
} | php | public function setMessage($type, $content)
{
$message = new \stdClass;
$message->mt = $type;
$message->content = $content;
$messages = $this->session()->get('messages', array());
$messages[] = $message;
$this->session()->set('messages', $messages);
} | [
"public",
"function",
"setMessage",
"(",
"$",
"type",
",",
"$",
"content",
")",
"{",
"$",
"message",
"=",
"new",
"\\",
"stdClass",
";",
"$",
"message",
"->",
"mt",
"=",
"$",
"type",
";",
"$",
"message",
"->",
"content",
"=",
"$",
"content",
";",
"$... | Sets a user message to present after reload or redirect.
@param $type
@param $content | [
"Sets",
"a",
"user",
"message",
"to",
"present",
"after",
"reload",
"or",
"redirect",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/BaseController.php#L83-L91 |
42mate/towel | src/Towel/Controller/BaseController.php | BaseController.hasErrorMessages | public function hasErrorMessages() {
$messages = $this->getMessages();
foreach ($messages as $message) {
if ($message->mt == 'error') {
return true;
}
}
return false;
} | php | public function hasErrorMessages() {
$messages = $this->getMessages();
foreach ($messages as $message) {
if ($message->mt == 'error') {
return true;
}
}
return false;
} | [
"public",
"function",
"hasErrorMessages",
"(",
")",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"getMessages",
"(",
")",
";",
"foreach",
"(",
"$",
"messages",
"as",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"message",
"->",
"mt",
"==",
"'error'",
"... | Checks into the message bag if there is some error message.
Type == error | [
"Checks",
"into",
"the",
"message",
"bag",
"if",
"there",
"is",
"some",
"error",
"message",
".",
"Type",
"==",
"error"
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/BaseController.php#L97-L105 |
42mate/towel | src/Towel/Controller/BaseController.php | BaseController.attachFiles | public function attachFiles($id, $table, $files)
{
foreach ($files as $file) {
if (!empty($file)) {
$this->attachFile($id, $table, $file);
}
}
} | php | public function attachFiles($id, $table, $files)
{
foreach ($files as $file) {
if (!empty($file)) {
$this->attachFile($id, $table, $file);
}
}
} | [
"public",
"function",
"attachFiles",
"(",
"$",
"id",
",",
"$",
"table",
",",
"$",
"files",
")",
"{",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"file",
")",
")",
"{",
"$",
"this",
"->",
"attach... | It will attach the array of files to the entity.
@param $id
@param $table
@param $files | [
"It",
"will",
"attach",
"the",
"array",
"of",
"files",
"to",
"the",
"entity",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/BaseController.php#L124-L131 |
42mate/towel | src/Towel/Controller/BaseController.php | BaseController.attachFile | public function attachFile($id, $table, \Symfony\Component\HttpFoundation\File\UploadedFile $file)
{
$newFileName = md5(microtime() . '.' . strtolower($file->getClientOriginalExtension()));
$relativePath = $table . '/' . date('Y/m/d');
$relativeFilePath = $relativePath . '/' . $newFileName;
... | php | public function attachFile($id, $table, \Symfony\Component\HttpFoundation\File\UploadedFile $file)
{
$newFileName = md5(microtime() . '.' . strtolower($file->getClientOriginalExtension()));
$relativePath = $table . '/' . date('Y/m/d');
$relativeFilePath = $relativePath . '/' . $newFileName;
... | [
"public",
"function",
"attachFile",
"(",
"$",
"id",
",",
"$",
"table",
",",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"HttpFoundation",
"\\",
"File",
"\\",
"UploadedFile",
"$",
"file",
")",
"{",
"$",
"newFileName",
"=",
"md5",
"(",
"microtime",
"(",
")",... | It will attach the file.
@param $id
@param $table
@param \Symfony\Component\HttpFoundation\File\UploadedFile $file | [
"It",
"will",
"attach",
"the",
"file",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/BaseController.php#L140-L154 |
nullcall/geo-api | src/MapAPI.php | GoogleAPI.setDirectionCo | public function setDirectionCo($gpsArray){
$this->directionLat1 = $gpsArray[0]['lat'];
$this->directionLat2 = $gpsArray[1]['lat'];
$this->directionLong1 = $gpsArray[0]['long'];
$this->directionLong2 = $gpsArray[1]['long'];
} | php | public function setDirectionCo($gpsArray){
$this->directionLat1 = $gpsArray[0]['lat'];
$this->directionLat2 = $gpsArray[1]['lat'];
$this->directionLong1 = $gpsArray[0]['long'];
$this->directionLong2 = $gpsArray[1]['long'];
} | [
"public",
"function",
"setDirectionCo",
"(",
"$",
"gpsArray",
")",
"{",
"$",
"this",
"->",
"directionLat1",
"=",
"$",
"gpsArray",
"[",
"0",
"]",
"[",
"'lat'",
"]",
";",
"$",
"this",
"->",
"directionLat2",
"=",
"$",
"gpsArray",
"[",
"1",
"]",
"[",
"'l... | / Set the coordinates from direction /// | [
"/",
"Set",
"the",
"coordinates",
"from",
"direction",
"///"
] | train | https://github.com/nullcall/geo-api/blob/c8b5c12f2aa32d6965d941509f9572c95995f45c/src/MapAPI.php#L33-L38 |
nullcall/geo-api | src/MapAPI.php | GoogleAPI.getDirection | public function getDirection() {
//difference in longitudinal coordinates
$dLon = deg2rad($this->directionLong2) - deg2rad($this->directionLong1);
//difference in the phi of latitudinal coordinates
$dPhi = log(tan(deg2rad($this->directionLat2) / 2 + pi() / 4) / tan(deg2rad($this->directionLat1) / 2 + pi() / 4))... | php | public function getDirection() {
//difference in longitudinal coordinates
$dLon = deg2rad($this->directionLong2) - deg2rad($this->directionLong1);
//difference in the phi of latitudinal coordinates
$dPhi = log(tan(deg2rad($this->directionLat2) / 2 + pi() / 4) / tan(deg2rad($this->directionLat1) / 2 + pi() / 4))... | [
"public",
"function",
"getDirection",
"(",
")",
"{",
"//difference in longitudinal coordinates",
"$",
"dLon",
"=",
"deg2rad",
"(",
"$",
"this",
"->",
"directionLong2",
")",
"-",
"deg2rad",
"(",
"$",
"this",
"->",
"directionLong1",
")",
";",
"//difference in the ph... | // Fetch Direction from given lat long /////////// | [
"//",
"Fetch",
"Direction",
"from",
"given",
"lat",
"long",
"///////////"
] | train | https://github.com/nullcall/geo-api/blob/c8b5c12f2aa32d6965d941509f9572c95995f45c/src/MapAPI.php#L41-L58 |
nullcall/geo-api | src/MapAPI.php | GoogleAPI.calDistance | public function calDistance(){
$num = 0;
foreach ($this->coordinatesArray as $key => $row) {
$this->distLat[] = $row['lat'];
$this->distLong[] =$row['long'];
}
//// Get the Leangth of passed array //////
$num = sizeof($this->coordinatesArray) - 1; // Fixed the Undefined offset error... | php | public function calDistance(){
$num = 0;
foreach ($this->coordinatesArray as $key => $row) {
$this->distLat[] = $row['lat'];
$this->distLong[] =$row['long'];
}
//// Get the Leangth of passed array //////
$num = sizeof($this->coordinatesArray) - 1; // Fixed the Undefined offset error... | [
"public",
"function",
"calDistance",
"(",
")",
"{",
"$",
"num",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"coordinatesArray",
"as",
"$",
"key",
"=>",
"$",
"row",
")",
"{",
"$",
"this",
"->",
"distLat",
"[",
"]",
"=",
"$",
"row",
"[",
"'la... | return the (int) distance | [
"return",
"the",
"(",
"int",
")",
"distance"
] | train | https://github.com/nullcall/geo-api/blob/c8b5c12f2aa32d6965d941509f9572c95995f45c/src/MapAPI.php#L114-L128 |
nullcall/geo-api | src/MapAPI.php | GoogleAPI.addFetch | public function addFetch(){
$url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=$this->latitude,$this->longitude&sensor=false";
$curlData=file_get_contents($url);
$address = json_decode($curlData);
$a=$address->results[0];
return explode(",",$a->formatted_address);
} | php | public function addFetch(){
$url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=$this->latitude,$this->longitude&sensor=false";
$curlData=file_get_contents($url);
$address = json_decode($curlData);
$a=$address->results[0];
return explode(",",$a->formatted_address);
} | [
"public",
"function",
"addFetch",
"(",
")",
"{",
"$",
"url",
"=",
"\"http://maps.googleapis.com/maps/api/geocode/json?latlng=$this->latitude,$this->longitude&sensor=false\"",
";",
"$",
"curlData",
"=",
"file_get_contents",
"(",
"$",
"url",
")",
";",
"$",
"address",
"=",
... | // Fetch Address from given coordinates ////////// | [
"//",
"Fetch",
"Address",
"from",
"given",
"coordinates",
"//////////"
] | train | https://github.com/nullcall/geo-api/blob/c8b5c12f2aa32d6965d941509f9572c95995f45c/src/MapAPI.php#L146-L152 |
dappur/dappurware | app/src/Dappurware/Cookies.php | Cookies.setResponseCookie | public function setResponseCookie($response, $name, $value = null, $expiration = 0)
{
$expiration = 1;
if ($expiration == 0) {
$expiration = 30;
}
if (is_numeric($expiration)) {
$expiration = $expiration;
}
$response = FigResponseCookies::set(... | php | public function setResponseCookie($response, $name, $value = null, $expiration = 0)
{
$expiration = 1;
if ($expiration == 0) {
$expiration = 30;
}
if (is_numeric($expiration)) {
$expiration = $expiration;
}
$response = FigResponseCookies::set(... | [
"public",
"function",
"setResponseCookie",
"(",
"$",
"response",
",",
"$",
"name",
",",
"$",
"value",
"=",
"null",
",",
"$",
"expiration",
"=",
"0",
")",
"{",
"$",
"expiration",
"=",
"1",
";",
"if",
"(",
"$",
"expiration",
"==",
"0",
")",
"{",
"$",... | Set New Response Cookie | [
"Set",
"New",
"Response",
"Cookie"
] | train | https://github.com/dappur/dappurware/blob/453ca999047693a1f009618820f8497a287f6a05/app/src/Dappurware/Cookies.php#L22-L40 |
dappur/dappurware | app/src/Dappurware/Cookies.php | Cookies.modifyResponseCookie | public function modifyResponseCookie($response, $name, $value = null, $expiration = 0)
{
$expiration = 1;
if ($expiration == 0) {
$expiration = 30; //Expire After 30 Days
}
if (is_numeric($expiration)) {
$expiration = $expiration;
}
$modify = ... | php | public function modifyResponseCookie($response, $name, $value = null, $expiration = 0)
{
$expiration = 1;
if ($expiration == 0) {
$expiration = 30; //Expire After 30 Days
}
if (is_numeric($expiration)) {
$expiration = $expiration;
}
$modify = ... | [
"public",
"function",
"modifyResponseCookie",
"(",
"$",
"response",
",",
"$",
"name",
",",
"$",
"value",
"=",
"null",
",",
"$",
"expiration",
"=",
"0",
")",
"{",
"$",
"expiration",
"=",
"1",
";",
"if",
"(",
"$",
"expiration",
"==",
"0",
")",
"{",
"... | Modify Response Cookie | [
"Modify",
"Response",
"Cookie"
] | train | https://github.com/dappur/dappurware/blob/453ca999047693a1f009618820f8497a287f6a05/app/src/Dappurware/Cookies.php#L43-L69 |
dappur/dappurware | app/src/Dappurware/Cookies.php | Cookies.setRequestCookie | public function setRequestCookie($request, $name, $value = null)
{
if (empty($name)) {
return false;
}
$request = FigRequestCookies::set($request, Cookie::create($name, $value));
return $request;
} | php | public function setRequestCookie($request, $name, $value = null)
{
if (empty($name)) {
return false;
}
$request = FigRequestCookies::set($request, Cookie::create($name, $value));
return $request;
} | [
"public",
"function",
"setRequestCookie",
"(",
"$",
"request",
",",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"request",
"=",
"FigRequestCookies",
"::... | Set New Request Cookie | [
"Set",
"New",
"Request",
"Cookie"
] | train | https://github.com/dappur/dappurware/blob/453ca999047693a1f009618820f8497a287f6a05/app/src/Dappurware/Cookies.php#L86-L95 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.