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
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php
ezcMailComposer.addAttachment
public function addAttachment( $fileName, $content = null, $contentType = null, $mimeType = null, ezcMailContentDispositionHeader $contentDisposition = null ) { if ( is_null( $content ) ) { $this->addFileAttachment( $fileName, $contentType, $mimeType, $contentDisposition ); } ...
php
public function addAttachment( $fileName, $content = null, $contentType = null, $mimeType = null, ezcMailContentDispositionHeader $contentDisposition = null ) { if ( is_null( $content ) ) { $this->addFileAttachment( $fileName, $contentType, $mimeType, $contentDisposition ); } ...
[ "public", "function", "addAttachment", "(", "$", "fileName", ",", "$", "content", "=", "null", ",", "$", "contentType", "=", "null", ",", "$", "mimeType", "=", "null", ",", "ezcMailContentDispositionHeader", "$", "contentDisposition", "=", "null", ")", "{", ...
Adds the file $fileName to the list of attachments. If $content is specified, $fileName is not checked if it exists. $this->attachments will also contain in this case the $content, $contentType and $mimeType. The $contentType (default = application) and $mimeType (default = octet-stream) control the complete mime-typ...
[ "Adds", "the", "file", "$fileName", "to", "the", "list", "of", "attachments", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php#L285-L295
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php
ezcMailComposer.addFileAttachment
public function addFileAttachment( $fileName, $contentType = null, $mimeType = null, ezcMailContentDispositionHeader $contentDisposition = null ) { if ( is_readable( $fileName ) ) { $this->attachments[] = array( $fileName, null, $contentType, $mimeType, $contentDisposition ); } ...
php
public function addFileAttachment( $fileName, $contentType = null, $mimeType = null, ezcMailContentDispositionHeader $contentDisposition = null ) { if ( is_readable( $fileName ) ) { $this->attachments[] = array( $fileName, null, $contentType, $mimeType, $contentDisposition ); } ...
[ "public", "function", "addFileAttachment", "(", "$", "fileName", ",", "$", "contentType", "=", "null", ",", "$", "mimeType", "=", "null", ",", "ezcMailContentDispositionHeader", "$", "contentDisposition", "=", "null", ")", "{", "if", "(", "is_readable", "(", "...
Adds the file $fileName to the list of attachments. The $contentType (default = application) and $mimeType (default = octet-stream) control the complete mime-type of the attachment. If $contentDisposition is specified, the attached file will have its Content-Disposition header set according to the $contentDisposition...
[ "Adds", "the", "file", "$fileName", "to", "the", "list", "of", "attachments", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php#L317-L334
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php
ezcMailComposer.addStringAttachment
public function addStringAttachment( $fileName, $content, $contentType = null, $mimeType = null, ezcMailContentDispositionHeader $contentDisposition = null ) { $this->attachments[] = array( $fileName, $content, $contentType, $mimeType, $contentDisposition ); }
php
public function addStringAttachment( $fileName, $content, $contentType = null, $mimeType = null, ezcMailContentDispositionHeader $contentDisposition = null ) { $this->attachments[] = array( $fileName, $content, $contentType, $mimeType, $contentDisposition ); }
[ "public", "function", "addStringAttachment", "(", "$", "fileName", ",", "$", "content", ",", "$", "contentType", "=", "null", ",", "$", "mimeType", "=", "null", ",", "ezcMailContentDispositionHeader", "$", "contentDisposition", "=", "null", ")", "{", "$", "thi...
Adds the file $fileName to the list of attachments, with contents $content. The file $fileName is not checked if it exists. An attachment is added to the mail, with the name $fileName, and the contents $content. The $contentType (default = application) and $mimeType (default = octet-stream) control the complete mime-...
[ "Adds", "the", "file", "$fileName", "to", "the", "list", "of", "attachments", "with", "contents", "$content", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php#L356-L359
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php
ezcMailComposer.build
public function build() { $mainPart = false; // create the text part if there is one if ( $this->plainText != '' ) { $mainPart = new ezcMailText( $this->plainText, $this->charset ); } // create the HTML part if there is one $htmlPart = false; ...
php
public function build() { $mainPart = false; // create the text part if there is one if ( $this->plainText != '' ) { $mainPart = new ezcMailText( $this->plainText, $this->charset ); } // create the HTML part if there is one $htmlPart = false; ...
[ "public", "function", "build", "(", ")", "{", "$", "mainPart", "=", "false", ";", "// create the text part if there is one", "if", "(", "$", "this", "->", "plainText", "!=", "''", ")", "{", "$", "mainPart", "=", "new", "ezcMailText", "(", "$", "this", "->"...
Builds the complete email message in RFC822 format. This method must be called before the message is sent. @throws ezcBaseFileNotFoundException if any of the attachment files can not be found.
[ "Builds", "the", "complete", "email", "message", "in", "RFC822", "format", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php#L369-L449
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php
ezcMailComposer.generateHtmlPart
private function generateHtmlPart() { $result = false; if ( $this->htmlText != '' ) { $matches = array(); if ( $this->options->automaticImageInclude === true ) { // recognize file:// and file:///, pick out the image, add it as a part and th...
php
private function generateHtmlPart() { $result = false; if ( $this->htmlText != '' ) { $matches = array(); if ( $this->options->automaticImageInclude === true ) { // recognize file:// and file:///, pick out the image, add it as a part and th...
[ "private", "function", "generateHtmlPart", "(", ")", "{", "$", "result", "=", "false", ";", "if", "(", "$", "this", "->", "htmlText", "!=", "''", ")", "{", "$", "matches", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "options", "->", ...
Returns an ezcMailPart based on the HTML provided. This method adds local files/images to the mail itself using a {@link ezcMailMultipartRelated} object. @throws ezcBaseFileNotFoundException if $fileName does not exists. @throws ezcBaseFilePermissionProblem if $fileName could not be read. @return ezcMailPart
[ "Returns", "an", "ezcMailPart", "based", "on", "the", "HTML", "provided", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/composer.php#L463-L545
WellCommerce/AppBundle
Manager/DictionaryManager.php
DictionaryManager.syncDictionary
public function syncDictionary() { $this->kernel = $this->get('kernel'); $this->locales = $this->getLocales(); $this->propertyAccessor = PropertyAccess::createPropertyAccessor(); $this->filesystem = new Filesystem(); foreach ($this->locales a...
php
public function syncDictionary() { $this->kernel = $this->get('kernel'); $this->locales = $this->getLocales(); $this->propertyAccessor = PropertyAccess::createPropertyAccessor(); $this->filesystem = new Filesystem(); foreach ($this->locales a...
[ "public", "function", "syncDictionary", "(", ")", "{", "$", "this", "->", "kernel", "=", "$", "this", "->", "get", "(", "'kernel'", ")", ";", "$", "this", "->", "locales", "=", "$", "this", "->", "getLocales", "(", ")", ";", "$", "this", "->", "pro...
Synchronizes database and filesystem translations
[ "Synchronizes", "database", "and", "filesystem", "translations" ]
train
https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Manager/DictionaryManager.php#L58-L70
WellCommerce/AppBundle
Manager/DictionaryManager.php
DictionaryManager.getDatabaseTranslations
protected function getDatabaseTranslations(Locale $locale) { $messages = []; $collection = $this->repository->getCollection(); $collection->map(function (Dictionary $dictionary) use ($locale, &$messages) { $messages[$dictionary->getIdentifier()] = $dictionary->translat...
php
protected function getDatabaseTranslations(Locale $locale) { $messages = []; $collection = $this->repository->getCollection(); $collection->map(function (Dictionary $dictionary) use ($locale, &$messages) { $messages[$dictionary->getIdentifier()] = $dictionary->translat...
[ "protected", "function", "getDatabaseTranslations", "(", "Locale", "$", "locale", ")", "{", "$", "messages", "=", "[", "]", ";", "$", "collection", "=", "$", "this", "->", "repository", "->", "getCollection", "(", ")", ";", "$", "collection", "->", "map", ...
Returns an array containing all previously imported translations @param Locale $locale @return array
[ "Returns", "an", "array", "containing", "all", "previously", "imported", "translations" ]
train
https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Manager/DictionaryManager.php#L133-L143
WellCommerce/StandardEditionBundle
DataFixtures/ORM/LoadAvailabilityData.php
LoadAvailabilityData.load
public function load(ObjectManager $manager) { if (!$this->isEnabled()) { return; } foreach (self::$samples as $name) { $availability = new Availability(); foreach ($this->getLocales() as $locale) { $availability->translate($locale...
php
public function load(ObjectManager $manager) { if (!$this->isEnabled()) { return; } foreach (self::$samples as $name) { $availability = new Availability(); foreach ($this->getLocales() as $locale) { $availability->translate($locale...
[ "public", "function", "load", "(", "ObjectManager", "$", "manager", ")", "{", "if", "(", "!", "$", "this", "->", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "foreach", "(", "self", "::", "$", "samples", "as", "$", "name", ")", "{", "$", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/WellCommerce/StandardEditionBundle/blob/6367bd20bbb6bde37c710a6ba87ae72b5f05f61e/DataFixtures/ORM/LoadAvailabilityData.php#L31-L48
hametuha/wpametu
src/WPametu/UI/Field/GeoChecker.php
GeoChecker.get_field
protected function get_field( \WP_Post $post ){ $html = parent::get_field($post); return $html.sprintf('<p class="inline-error"><i class="dashicons dashicons-location-alt"></i> %s</p>', $this->__('Can\'t find map point. Try another string')); }
php
protected function get_field( \WP_Post $post ){ $html = parent::get_field($post); return $html.sprintf('<p class="inline-error"><i class="dashicons dashicons-location-alt"></i> %s</p>', $this->__('Can\'t find map point. Try another string')); }
[ "protected", "function", "get_field", "(", "\\", "WP_Post", "$", "post", ")", "{", "$", "html", "=", "parent", "::", "get_field", "(", "$", "post", ")", ";", "return", "$", "html", ".", "sprintf", "(", "'<p class=\"inline-error\"><i class=\"dashicons dashicons-l...
Add error message. @param \WP_Post $post @return string
[ "Add", "error", "message", "." ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Field/GeoChecker.php#L37-L40
digipolisgent/robo-digipolis-package
src/Utility/NpmFindExecutable.php
NpmFindExecutable.findExecutable
protected function findExecutable($cmd) { $pathToCmd = $this->searchForExecutable($cmd); if ($pathToCmd) { return $this->useCallOnWindows($pathToCmd); } return false; }
php
protected function findExecutable($cmd) { $pathToCmd = $this->searchForExecutable($cmd); if ($pathToCmd) { return $this->useCallOnWindows($pathToCmd); } return false; }
[ "protected", "function", "findExecutable", "(", "$", "cmd", ")", "{", "$", "pathToCmd", "=", "$", "this", "->", "searchForExecutable", "(", "$", "cmd", ")", ";", "if", "(", "$", "pathToCmd", ")", "{", "return", "$", "this", "->", "useCallOnWindows", "(",...
Return the best path to the executable program with the provided name. Favor vendor/bin in the current project. If not found there, use whatever is on the $PATH. @param string $cmd The executable to find. @return bool|string
[ "Return", "the", "best", "path", "to", "the", "executable", "program", "with", "the", "provided", "name", ".", "Favor", "vendor", "/", "bin", "in", "the", "current", "project", ".", "If", "not", "found", "there", "use", "whatever", "is", "on", "the", "$P...
train
https://github.com/digipolisgent/robo-digipolis-package/blob/6f206f32d910992d27b2a1b4dda1c5e7d8259b75/src/Utility/NpmFindExecutable.php#L21-L28
digipolisgent/robo-digipolis-package
src/Utility/NpmFindExecutable.php
NpmFindExecutable.searchForExecutable
private function searchForExecutable($cmd) { $nodeModules = $this->findNodeModules(); if ($nodeModules) { $finder = new Finder(); $finder->files()->in($nodeModules)->name($cmd); foreach ($finder as $executable) { return $executable->getRealPath(); ...
php
private function searchForExecutable($cmd) { $nodeModules = $this->findNodeModules(); if ($nodeModules) { $finder = new Finder(); $finder->files()->in($nodeModules)->name($cmd); foreach ($finder as $executable) { return $executable->getRealPath(); ...
[ "private", "function", "searchForExecutable", "(", "$", "cmd", ")", "{", "$", "nodeModules", "=", "$", "this", "->", "findNodeModules", "(", ")", ";", "if", "(", "$", "nodeModules", ")", "{", "$", "finder", "=", "new", "Finder", "(", ")", ";", "$", "...
@param string $cmd @return string
[ "@param", "string", "$cmd" ]
train
https://github.com/digipolisgent/robo-digipolis-package/blob/6f206f32d910992d27b2a1b4dda1c5e7d8259b75/src/Utility/NpmFindExecutable.php#L35-L47
surebert/surebert-framework
src/sb/JS.php
JS.setHTML
public static function setHTML($id, $html) { $js = '$("'.$id.'").html('.json_encode($html).');'; return self::execHeader($js); }
php
public static function setHTML($id, $html) { $js = '$("'.$id.'").html('.json_encode($html).');'; return self::execHeader($js); }
[ "public", "static", "function", "setHTML", "(", "$", "id", ",", "$", "html", ")", "{", "$", "js", "=", "'$(\"'", ".", "$", "id", ".", "'\").html('", ".", "json_encode", "(", "$", "html", ")", ".", "');'", ";", "return", "self", "::", "execHeader", ...
Uses jsexec_header to set the innerHTML of an element by id @param integer $id the HTML element id @param string $html The innerHTML to set @return string
[ "Uses", "jsexec_header", "to", "set", "the", "innerHTML", "of", "an", "element", "by", "id" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/JS.php#L23-L27
surebert/surebert-framework
src/sb/JS.php
JS.execScript
public static function execScript($script_path, $context=null) { header('Content-type: text/javascript'); if(!is_null($context)){ if(is_object($context)){ $context = get_object_vars($context); } if(is_array($context)){ extract($cont...
php
public static function execScript($script_path, $context=null) { header('Content-type: text/javascript'); if(!is_null($context)){ if(is_object($context)){ $context = get_object_vars($context); } if(is_array($context)){ extract($cont...
[ "public", "static", "function", "execScript", "(", "$", "script_path", ",", "$", "context", "=", "null", ")", "{", "header", "(", "'Content-type: text/javascript'", ")", ";", "if", "(", "!", "is_null", "(", "$", "context", ")", ")", "{", "if", "(", "is_o...
Executes a script at a certain path @param string $script_path full path
[ "Executes", "a", "script", "at", "a", "certain", "path" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/JS.php#L33-L46
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.processMetadataDrivers
private function processMetadataDrivers() { $builder = $this->getContainerBuilder(); // At the moment, only Docblock annotations are supported, XML and YAML are not. $annotationReader = $builder->addDefinition($this->prefix('metadata.annotationReader')) ->setClass(AnnotationReader::class); $cachedReader...
php
private function processMetadataDrivers() { $builder = $this->getContainerBuilder(); // At the moment, only Docblock annotations are supported, XML and YAML are not. $annotationReader = $builder->addDefinition($this->prefix('metadata.annotationReader')) ->setClass(AnnotationReader::class); $cachedReader...
[ "private", "function", "processMetadataDrivers", "(", ")", "{", "$", "builder", "=", "$", "this", "->", "getContainerBuilder", "(", ")", ";", "// At the moment, only Docblock annotations are supported, XML and YAML are not.\t\t", "$", "annotationReader", "=", "$", "builder"...
Registers metadata drivers.
[ "Registers", "metadata", "drivers", "." ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L106-L136
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.createServiceName
private function createServiceName(string $namespace) { $parts = explode('\\', $namespace); foreach ($parts as $k => $part) { $parts[$k] = lcfirst($part); } return trim(implode('.', $parts), '.'); }
php
private function createServiceName(string $namespace) { $parts = explode('\\', $namespace); foreach ($parts as $k => $part) { $parts[$k] = lcfirst($part); } return trim(implode('.', $parts), '.'); }
[ "private", "function", "createServiceName", "(", "string", "$", "namespace", ")", "{", "$", "parts", "=", "explode", "(", "'\\\\'", ",", "$", "namespace", ")", ";", "foreach", "(", "$", "parts", "as", "$", "k", "=>", "$", "part", ")", "{", "$", "part...
Converts PHP namespace to service name.
[ "Converts", "PHP", "namespace", "to", "service", "name", "." ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L142-L149
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.processConnection
private function processConnection() { $builder = $this->getContainerBuilder(); $connection = $builder->addDefinition($this->prefix('connection')) ->setClass(Connection::class) ->setFactory(DriverManager::class . '::getConnection', [$this->config['connection']]); }
php
private function processConnection() { $builder = $this->getContainerBuilder(); $connection = $builder->addDefinition($this->prefix('connection')) ->setClass(Connection::class) ->setFactory(DriverManager::class . '::getConnection', [$this->config['connection']]); }
[ "private", "function", "processConnection", "(", ")", "{", "$", "builder", "=", "$", "this", "->", "getContainerBuilder", "(", ")", ";", "$", "connection", "=", "$", "builder", "->", "addDefinition", "(", "$", "this", "->", "prefix", "(", "'connection'", "...
Registers DBAL connection.
[ "Registers", "DBAL", "connection", "." ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L155-L162
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.processEvents
private function processEvents() { $builder = $this->getContainerBuilder(); $eventManager = $builder->addDefinition($this->prefix('eventManager')) ->setClass(EventManager::class); $entityListenerResolver = $builder->addDefinition($this->prefix('entityListenerResolver')) ->setClass(ContainerEntityListener...
php
private function processEvents() { $builder = $this->getContainerBuilder(); $eventManager = $builder->addDefinition($this->prefix('eventManager')) ->setClass(EventManager::class); $entityListenerResolver = $builder->addDefinition($this->prefix('entityListenerResolver')) ->setClass(ContainerEntityListener...
[ "private", "function", "processEvents", "(", ")", "{", "$", "builder", "=", "$", "this", "->", "getContainerBuilder", "(", ")", ";", "$", "eventManager", "=", "$", "builder", "->", "addDefinition", "(", "$", "this", "->", "prefix", "(", "'eventManager'", "...
Registers Event Manager.
[ "Registers", "Event", "Manager", "." ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L168-L191
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.processEntityManager
private function processEntityManager() { $builder = $this->getContainerBuilder(); $configuration = $builder->addDefinition($this->prefix('configuration')) ->setClass(Configuration::class) ->addSetup('$service->setMetadataDriverImpl($this->getService(?))', [$this->prefix('metadata.driver')]) ->addSetup('...
php
private function processEntityManager() { $builder = $this->getContainerBuilder(); $configuration = $builder->addDefinition($this->prefix('configuration')) ->setClass(Configuration::class) ->addSetup('$service->setMetadataDriverImpl($this->getService(?))', [$this->prefix('metadata.driver')]) ->addSetup('...
[ "private", "function", "processEntityManager", "(", ")", "{", "$", "builder", "=", "$", "this", "->", "getContainerBuilder", "(", ")", ";", "$", "configuration", "=", "$", "builder", "->", "addDefinition", "(", "$", "this", "->", "prefix", "(", "'configurati...
Registers Entity Manager.
[ "Registers", "Entity", "Manager", "." ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L197-L222
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.processCachingServices
private function processCachingServices() { $this->createCache('annotations'); $this->createCache('metadata'); $this->createCache('query'); $this->createCache('result'); $this->createCache('hydration'); }
php
private function processCachingServices() { $this->createCache('annotations'); $this->createCache('metadata'); $this->createCache('query'); $this->createCache('result'); $this->createCache('hydration'); }
[ "private", "function", "processCachingServices", "(", ")", "{", "$", "this", "->", "createCache", "(", "'annotations'", ")", ";", "$", "this", "->", "createCache", "(", "'metadata'", ")", ";", "$", "this", "->", "createCache", "(", "'query'", ")", ";", "$"...
Registers caching services.
[ "Registers", "caching", "services", "." ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L228-L235
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.createCache
private function createCache(string $name) { $builder = $this->getContainerBuilder(); $cache = $builder->addDefinition($this->prefix('cache.' . $name)) ->setClass(Cache::class) ->setArguments(['@Nette\Caching\IStorage', $this->debugMode]) ->addSetup('$service->setNamespace(?)', [$this->prefix('cache.' . ...
php
private function createCache(string $name) { $builder = $this->getContainerBuilder(); $cache = $builder->addDefinition($this->prefix('cache.' . $name)) ->setClass(Cache::class) ->setArguments(['@Nette\Caching\IStorage', $this->debugMode]) ->addSetup('$service->setNamespace(?)', [$this->prefix('cache.' . ...
[ "private", "function", "createCache", "(", "string", "$", "name", ")", "{", "$", "builder", "=", "$", "this", "->", "getContainerBuilder", "(", ")", ";", "$", "cache", "=", "$", "builder", "->", "addDefinition", "(", "$", "this", "->", "prefix", "(", "...
Creates a caching service.
[ "Creates", "a", "caching", "service", "." ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L241-L251
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.processConsole
private function processConsole() { $builder = $this->getContainerBuilder(); $console = $builder->addDefinition($this->prefix('console')) ->setClass(Application::class) ->setArguments(['Doctrine Command Line Interface', \Doctrine\ORM\Version::VERSION]) ->addSetup('?->setCatchExceptions(TRUE)', ['@self'])...
php
private function processConsole() { $builder = $this->getContainerBuilder(); $console = $builder->addDefinition($this->prefix('console')) ->setClass(Application::class) ->setArguments(['Doctrine Command Line Interface', \Doctrine\ORM\Version::VERSION]) ->addSetup('?->setCatchExceptions(TRUE)', ['@self'])...
[ "private", "function", "processConsole", "(", ")", "{", "$", "builder", "=", "$", "this", "->", "getContainerBuilder", "(", ")", ";", "$", "console", "=", "$", "builder", "->", "addDefinition", "(", "$", "this", "->", "prefix", "(", "'console'", ")", ")"...
Registers Doctrine Console.
[ "Registers", "Doctrine", "Console", "." ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L257-L279
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.processTracy
private function processTracy() { $builder = $this->getContainerBuilder(); $tracyPanel = $builder->addDefinition($this->prefix('tracyPanel')) ->setClass(Panel::class); $builder->getDefinition($this->prefix('entityManager')) ->addSetup('?->setEntityManager(?)', ['@' . $this->prefix('tracyPanel'), '@self']...
php
private function processTracy() { $builder = $this->getContainerBuilder(); $tracyPanel = $builder->addDefinition($this->prefix('tracyPanel')) ->setClass(Panel::class); $builder->getDefinition($this->prefix('entityManager')) ->addSetup('?->setEntityManager(?)', ['@' . $this->prefix('tracyPanel'), '@self']...
[ "private", "function", "processTracy", "(", ")", "{", "$", "builder", "=", "$", "this", "->", "getContainerBuilder", "(", ")", ";", "$", "tracyPanel", "=", "$", "builder", "->", "addDefinition", "(", "$", "this", "->", "prefix", "(", "'tracyPanel'", ")", ...
Registers debug panel.
[ "Registers", "debug", "panel", "." ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L285-L294
andromeda-framework/doctrine
src/Doctrine/DI/DoctrineExtension.php
DoctrineExtension.afterCompile
public function afterCompile(ClassType $class) { $initialize = $class->getMethod('initialize'); $initialize->addBody('$proxyAutolader = (new Doctrine\Common\Proxy\Autoloader)->register(?, ?);', [ $this->config['proxyDir'], $this->config['proxyNamespace'] ]); $initialize->addBody('Doctrine\Common\Annotati...
php
public function afterCompile(ClassType $class) { $initialize = $class->getMethod('initialize'); $initialize->addBody('$proxyAutolader = (new Doctrine\Common\Proxy\Autoloader)->register(?, ?);', [ $this->config['proxyDir'], $this->config['proxyNamespace'] ]); $initialize->addBody('Doctrine\Common\Annotati...
[ "public", "function", "afterCompile", "(", "ClassType", "$", "class", ")", "{", "$", "initialize", "=", "$", "class", "->", "getMethod", "(", "'initialize'", ")", ";", "$", "initialize", "->", "addBody", "(", "'$proxyAutolader = (new Doctrine\\Common\\Proxy\\Autoloa...
@param ClassType $class @return void
[ "@param", "ClassType", "$class" ]
train
https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/DI/DoctrineExtension.php#L302-L313
antaresproject/notifications
src/Processor/LogsProcessor.php
LogsProcessor.preview
public function preview($id) { $item = app(StackRepository::class)->fetchOne((int) $id)->firstOrFail(); if (in_array($item->notification->type->name, ['email', 'sms'])) { $classname = $item->notification->type->name === 'email' ? EmailNotification::class : SmsNotification::class; ...
php
public function preview($id) { $item = app(StackRepository::class)->fetchOne((int) $id)->firstOrFail(); if (in_array($item->notification->type->name, ['email', 'sms'])) { $classname = $item->notification->type->name === 'email' ? EmailNotification::class : SmsNotification::class; ...
[ "public", "function", "preview", "(", "$", "id", ")", "{", "$", "item", "=", "app", "(", "StackRepository", "::", "class", ")", "->", "fetchOne", "(", "(", "int", ")", "$", "id", ")", "->", "firstOrFail", "(", ")", ";", "if", "(", "in_array", "(", ...
Preview notification log @param mixed $id @return View
[ "Preview", "notification", "log" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Processor/LogsProcessor.php#L92-L106
antaresproject/notifications
src/Processor/LogsProcessor.php
LogsProcessor.delete
public function delete(LogsListener $listener, $id = null): RedirectResponse { $stack = !empty($ids = input('attr')) ? $this->stack->newQuery()->whereIn('id', $ids) : $this->stack->newQuery()->findOrFail($id); if ($stack->delete()) { return $listener->deleteSuccess(); } ...
php
public function delete(LogsListener $listener, $id = null): RedirectResponse { $stack = !empty($ids = input('attr')) ? $this->stack->newQuery()->whereIn('id', $ids) : $this->stack->newQuery()->findOrFail($id); if ($stack->delete()) { return $listener->deleteSuccess(); } ...
[ "public", "function", "delete", "(", "LogsListener", "$", "listener", ",", "$", "id", "=", "null", ")", ":", "RedirectResponse", "{", "$", "stack", "=", "!", "empty", "(", "$", "ids", "=", "input", "(", "'attr'", ")", ")", "?", "$", "this", "->", "...
Deletes notification log @param LogsListener $listener @param mixed $id @return RedirectResponse
[ "Deletes", "notification", "log" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Processor/LogsProcessor.php#L115-L122
InfiniteSoftware/ISEcommpayPayum
Action/NotifyAction.php
NotifyAction.execute
public function execute($request) { RequestNotSupportedException::assertSupports($this, $request); $this->logger->info("Ecommpay order #{$request->getFirstModel()->getOrder()->getNumber()} have paid"); throw new HttpResponse('OK'); }
php
public function execute($request) { RequestNotSupportedException::assertSupports($this, $request); $this->logger->info("Ecommpay order #{$request->getFirstModel()->getOrder()->getNumber()} have paid"); throw new HttpResponse('OK'); }
[ "public", "function", "execute", "(", "$", "request", ")", "{", "RequestNotSupportedException", "::", "assertSupports", "(", "$", "this", ",", "$", "request", ")", ";", "$", "this", "->", "logger", "->", "info", "(", "\"Ecommpay order #{$request->getFirstModel()->...
{@inheritDoc} @param Notify $request
[ "{", "@inheritDoc", "}" ]
train
https://github.com/InfiniteSoftware/ISEcommpayPayum/blob/44a073e3d885d9007aa54d6ff13aea93a9e52e7c/Action/NotifyAction.php#L30-L35
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php
ExampleAssembler.create
public function create($data) { if (! $data instanceof ExampleTag) { throw new \InvalidArgumentException( 'The ExampleAssembler expected an ExampleTag object to base the descriptor on' ); } $descriptor = new ExampleDescriptor($data->getName()); ...
php
public function create($data) { if (! $data instanceof ExampleTag) { throw new \InvalidArgumentException( 'The ExampleAssembler expected an ExampleTag object to base the descriptor on' ); } $descriptor = new ExampleDescriptor($data->getName()); ...
[ "public", "function", "create", "(", "$", "data", ")", "{", "if", "(", "!", "$", "data", "instanceof", "ExampleTag", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The ExampleAssembler expected an ExampleTag object to base the descriptor on'", ")", ...
Creates a new Descriptor from the given Reflector. @param ExampleTag $data @throws \InvalidArgumentException if the provided parameter is not of type ExampleTag; the interface won't let up typehint the signature. @return ExampleDescriptor
[ "Creates", "a", "new", "Descriptor", "from", "the", "given", "Reflector", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php#L48-L64
znck/countries
src/CountriesServiceProvider.php
CountriesServiceProvider.register
public function register() { $this->mergeConfigFrom(dirname(__DIR__).'/config/countries.php', 'countries'); $this->app->singleton('command.countries.update', UpdateCountriesCommand::class); $this->app->singleton( 'translator.countries', function () { $...
php
public function register() { $this->mergeConfigFrom(dirname(__DIR__).'/config/countries.php', 'countries'); $this->app->singleton('command.countries.update', UpdateCountriesCommand::class); $this->app->singleton( 'translator.countries', function () { $...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "mergeConfigFrom", "(", "dirname", "(", "__DIR__", ")", ".", "'/config/countries.php'", ",", "'countries'", ")", ";", "$", "this", "->", "app", "->", "singleton", "(", "'command.countries.upda...
Register the application services.
[ "Register", "the", "application", "services", "." ]
train
https://github.com/znck/countries/blob/a78a2b302dfa8eacab8fe0c06127dbb37fa98fd3/src/CountriesServiceProvider.php#L22-L39
dave-redfern/somnambulist-value-objects
src/Types/Money/CurrencyCodeMappings.php
CurrencyCodeMappings.precision
public static function precision(CurrencyCode $code) { if (array_key_exists($code->value(), static::$precision)) { return static::$precision[$code->value()]; } return 2; }
php
public static function precision(CurrencyCode $code) { if (array_key_exists($code->value(), static::$precision)) { return static::$precision[$code->value()]; } return 2; }
[ "public", "static", "function", "precision", "(", "CurrencyCode", "$", "code", ")", "{", "if", "(", "array_key_exists", "(", "$", "code", "->", "value", "(", ")", ",", "static", "::", "$", "precision", ")", ")", "{", "return", "static", "::", "$", "pre...
@param CurrencyCode $code @return int
[ "@param", "CurrencyCode", "$code" ]
train
https://github.com/dave-redfern/somnambulist-value-objects/blob/dbae7fea7140b36e105ed3f5e21a42316ea3061f/src/Types/Money/CurrencyCodeMappings.php#L47-L54
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/PropertyDescriptor.php
PropertyDescriptor.getTypes
public function getTypes() { if (!$this->types) { $this->types = new Collection(); /** @var VarDescriptor $var */ $var = $this->getVar()->getIterator()->current(); if ($var) { $this->types = $var->getTypes(); } } r...
php
public function getTypes() { if (!$this->types) { $this->types = new Collection(); /** @var VarDescriptor $var */ $var = $this->getVar()->getIterator()->current(); if ($var) { $this->types = $var->getTypes(); } } r...
[ "public", "function", "getTypes", "(", ")", "{", "if", "(", "!", "$", "this", "->", "types", ")", "{", "$", "this", "->", "types", "=", "new", "Collection", "(", ")", ";", "/** @var VarDescriptor $var */", "$", "var", "=", "$", "this", "->", "getVar", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/PropertyDescriptor.php#L101-L114
surebert/surebert-framework
src/sb/PDO/Mysql/Backup.php
Backup.connectToDb
protected function connectToDb() { try { $this->db = new PDO("mysql:dbname=;" . $this->db_host, $this->db_user, $this->db_pass); $this->db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); } catch (\Exception $e) { $this->log("Cannot connect to database...
php
protected function connectToDb() { try { $this->db = new PDO("mysql:dbname=;" . $this->db_host, $this->db_user, $this->db_pass); $this->db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); } catch (\Exception $e) { $this->log("Cannot connect to database...
[ "protected", "function", "connectToDb", "(", ")", "{", "try", "{", "$", "this", "->", "db", "=", "new", "PDO", "(", "\"mysql:dbname=;\"", ".", "$", "this", "->", "db_host", ",", "$", "this", "->", "db_user", ",", "$", "this", "->", "db_pass", ")", ";...
Connects to the database
[ "Connects", "to", "the", "database" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO/Mysql/Backup.php#L114-L124
surebert/surebert-framework
src/sb/PDO/Mysql/Backup.php
Backup.checkDumpDir
protected function checkDumpDir() { if (!is_dir($this->dump_dir)) { mkdir($this->dump_dir, 0700, true); } foreach (\range($this->max_version, 1) as $version) { $dir = $this->dump_dir . $version; if (is_dir($dir)) { if ($version == $this...
php
protected function checkDumpDir() { if (!is_dir($this->dump_dir)) { mkdir($this->dump_dir, 0700, true); } foreach (\range($this->max_version, 1) as $version) { $dir = $this->dump_dir . $version; if (is_dir($dir)) { if ($version == $this...
[ "protected", "function", "checkDumpDir", "(", ")", "{", "if", "(", "!", "is_dir", "(", "$", "this", "->", "dump_dir", ")", ")", "{", "mkdir", "(", "$", "this", "->", "dump_dir", ",", "0700", ",", "true", ")", ";", "}", "foreach", "(", "\\", "range"...
check to make sure dump directory exists and if not create it
[ "check", "to", "make", "sure", "dump", "directory", "exists", "and", "if", "not", "create", "it" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO/Mysql/Backup.php#L129-L155
surebert/surebert-framework
src/sb/PDO/Mysql/Backup.php
Backup.dumpDatabases
protected function dumpDatabases() { foreach ($this->db->query("SHOW DATABASES") as $list) { $database = $list->Database; if (!in_array($database, $this->ignore) || preg_match("~_no_backup$~", $database)) { $start = microtime(true); $dir = $this->du...
php
protected function dumpDatabases() { foreach ($this->db->query("SHOW DATABASES") as $list) { $database = $list->Database; if (!in_array($database, $this->ignore) || preg_match("~_no_backup$~", $database)) { $start = microtime(true); $dir = $this->du...
[ "protected", "function", "dumpDatabases", "(", ")", "{", "foreach", "(", "$", "this", "->", "db", "->", "query", "(", "\"SHOW DATABASES\"", ")", "as", "$", "list", ")", "{", "$", "database", "=", "$", "list", "->", "Database", ";", "if", "(", "!", "i...
Dump the database files and gzip, add version number
[ "Dump", "the", "database", "files", "and", "gzip", "add", "version", "number" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO/Mysql/Backup.php#L160-L191
surebert/surebert-framework
src/sb/PDO/Mysql/Backup.php
Backup.log
protected function log($message) { if ($this->debug == true) { file_put_contents("php://stdout", $message . "\n"); } file_put_contents($this->dump_dir . 'dump.log', $message . "\n", \FILE_APPEND); }
php
protected function log($message) { if ($this->debug == true) { file_put_contents("php://stdout", $message . "\n"); } file_put_contents($this->dump_dir . 'dump.log', $message . "\n", \FILE_APPEND); }
[ "protected", "function", "log", "(", "$", "message", ")", "{", "if", "(", "$", "this", "->", "debug", "==", "true", ")", "{", "file_put_contents", "(", "\"php://stdout\"", ",", "$", "message", ".", "\"\\n\"", ")", ";", "}", "file_put_contents", "(", "$",...
Send messages to stdout @param string $message
[ "Send", "messages", "to", "stdout" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO/Mysql/Backup.php#L197-L205
surebert/surebert-framework
src/sb/PDO/Mysql/Backup.php
Backup.recursiveDelete
protected function recursiveDelete($dir, $del = 0) { if (substr($dir, 0, 1) == '/') { throw new \Exception("You cannot delete root directories"); } $iterator = new \RecursiveDirectoryIterator($dir); foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIt...
php
protected function recursiveDelete($dir, $del = 0) { if (substr($dir, 0, 1) == '/') { throw new \Exception("You cannot delete root directories"); } $iterator = new \RecursiveDirectoryIterator($dir); foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIt...
[ "protected", "function", "recursiveDelete", "(", "$", "dir", ",", "$", "del", "=", "0", ")", "{", "if", "(", "substr", "(", "$", "dir", ",", "0", ",", "1", ")", "==", "'/'", ")", "{", "throw", "new", "\\", "Exception", "(", "\"You cannot delete root ...
Recursively deletes the files in a diretory @param string $dir The directory path @param boolean $del Should directory itself be deleted upon completion @return boolean
[ "Recursively", "deletes", "the", "files", "in", "a", "diretory" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO/Mysql/Backup.php#L214-L234
Isset/pushnotification
src/PushNotification/NotificationCenter.php
NotificationCenter.send
public function send(Message $message, string $connectionName = null): MessageEnvelope { return $this->getNotifierForMessage($message)->send($message, $connectionName); }
php
public function send(Message $message, string $connectionName = null): MessageEnvelope { return $this->getNotifierForMessage($message)->send($message, $connectionName); }
[ "public", "function", "send", "(", "Message", "$", "message", ",", "string", "$", "connectionName", "=", "null", ")", ":", "MessageEnvelope", "{", "return", "$", "this", "->", "getNotifierForMessage", "(", "$", "message", ")", "->", "send", "(", "$", "mess...
@param Message $message @param string $connectionName @throws NotifierNotFoundException @throws NotifyFailedException @return MessageEnvelope
[ "@param", "Message", "$message", "@param", "string", "$connectionName" ]
train
https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/NotificationCenter.php#L35-L38
Isset/pushnotification
src/PushNotification/NotificationCenter.php
NotificationCenter.flushQueue
public function flushQueue(string $connectionName = null) { foreach ($this->notifiers as $notifier) { $notifier->flushQueue($connectionName); } }
php
public function flushQueue(string $connectionName = null) { foreach ($this->notifiers as $notifier) { $notifier->flushQueue($connectionName); } }
[ "public", "function", "flushQueue", "(", "string", "$", "connectionName", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "notifiers", "as", "$", "notifier", ")", "{", "$", "notifier", "->", "flushQueue", "(", "$", "connectionName", ")", ";", "...
Flushes the queue to the notifier queues. @param string $connectionName
[ "Flushes", "the", "queue", "to", "the", "notifier", "queues", "." ]
train
https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/NotificationCenter.php#L58-L63
Isset/pushnotification
src/PushNotification/NotificationCenter.php
NotificationCenter.handles
public function handles(Message $message): bool { try { $this->getNotifierForMessage($message); return true; } catch (NotifierNotFoundException $e) { return false; } }
php
public function handles(Message $message): bool { try { $this->getNotifierForMessage($message); return true; } catch (NotifierNotFoundException $e) { return false; } }
[ "public", "function", "handles", "(", "Message", "$", "message", ")", ":", "bool", "{", "try", "{", "$", "this", "->", "getNotifierForMessage", "(", "$", "message", ")", ";", "return", "true", ";", "}", "catch", "(", "NotifierNotFoundException", "$", "e", ...
@param Message $message @return bool
[ "@param", "Message", "$message" ]
train
https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/NotificationCenter.php#L70-L79
Isset/pushnotification
src/PushNotification/NotificationCenter.php
NotificationCenter.addNotifier
public function addNotifier(Notifier $notifier, bool $setLogger = true) { if ($notifier instanceof self) { throw new LogicException('Cannot add self'); } if ($setLogger) { $notifier->setLogger($this->getLogger()); } $this->notifiers[] = $notifier; ...
php
public function addNotifier(Notifier $notifier, bool $setLogger = true) { if ($notifier instanceof self) { throw new LogicException('Cannot add self'); } if ($setLogger) { $notifier->setLogger($this->getLogger()); } $this->notifiers[] = $notifier; ...
[ "public", "function", "addNotifier", "(", "Notifier", "$", "notifier", ",", "bool", "$", "setLogger", "=", "true", ")", "{", "if", "(", "$", "notifier", "instanceof", "self", ")", "{", "throw", "new", "LogicException", "(", "'Cannot add self'", ")", ";", "...
Add a notifier to the Notification center. @param Notifier $notifier @param bool $setLogger if false the default logger will not be set to the notifier @throws LogicException
[ "Add", "a", "notifier", "to", "the", "Notification", "center", "." ]
train
https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/NotificationCenter.php#L89-L99
Isset/pushnotification
src/PushNotification/NotificationCenter.php
NotificationCenter.getNotifierForMessage
public function getNotifierForMessage(Message $message): Notifier { foreach ($this->notifiers as $notifier) { if ($notifier->handles($message)) { return $notifier; } } throw new NotifierNotFoundException(); }
php
public function getNotifierForMessage(Message $message): Notifier { foreach ($this->notifiers as $notifier) { if ($notifier->handles($message)) { return $notifier; } } throw new NotifierNotFoundException(); }
[ "public", "function", "getNotifierForMessage", "(", "Message", "$", "message", ")", ":", "Notifier", "{", "foreach", "(", "$", "this", "->", "notifiers", "as", "$", "notifier", ")", "{", "if", "(", "$", "notifier", "->", "handles", "(", "$", "message", "...
@param Message $message @throws NotifierNotFoundException @return Notifier
[ "@param", "Message", "$message" ]
train
https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/NotificationCenter.php#L108-L116
ajant/SimpleArrayLibrary
src/Categories/Changers.php
Changers.addConfigRow
public static function addConfigRow(array $config, array $keys, $value) { // validation if (self::isAssociative($keys)) { throw new UnexpectedValueException('Array of config keys must be numeric'); } $row = $value; for ($i = count($keys) - 1; $i >= 0; $i--) { ...
php
public static function addConfigRow(array $config, array $keys, $value) { // validation if (self::isAssociative($keys)) { throw new UnexpectedValueException('Array of config keys must be numeric'); } $row = $value; for ($i = count($keys) - 1; $i >= 0; $i--) { ...
[ "public", "static", "function", "addConfigRow", "(", "array", "$", "config", ",", "array", "$", "keys", ",", "$", "value", ")", "{", "// validation", "if", "(", "self", "::", "isAssociative", "(", "$", "keys", ")", ")", "{", "throw", "new", "UnexpectedVa...
@param array $config @param array $keys @param mixed $value @return array
[ "@param", "array", "$config", "@param", "array", "$keys", "@param", "mixed", "$value" ]
train
https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Changers.php#L17-L31
ajant/SimpleArrayLibrary
src/Categories/Changers.php
Changers.castColumns
public static function castColumns(array $matrix, array $castMap, $allKeysMustBePresent = true) { if (!is_bool($allKeysMustBePresent)) { throw new InvalidArgumentException('Third parameter must be a boolean'); } if (empty($matrix)) { return $matrix; } ...
php
public static function castColumns(array $matrix, array $castMap, $allKeysMustBePresent = true) { if (!is_bool($allKeysMustBePresent)) { throw new InvalidArgumentException('Third parameter must be a boolean'); } if (empty($matrix)) { return $matrix; } ...
[ "public", "static", "function", "castColumns", "(", "array", "$", "matrix", ",", "array", "$", "castMap", ",", "$", "allKeysMustBePresent", "=", "true", ")", "{", "if", "(", "!", "is_bool", "(", "$", "allKeysMustBePresent", ")", ")", "{", "throw", "new", ...
@param array $matrix @param array $castMap @param bool $allKeysMustBePresent @return array
[ "@param", "array", "$matrix", "@param", "array", "$castMap", "@param", "bool", "$allKeysMustBePresent" ]
train
https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Changers.php#L40-L84
ajant/SimpleArrayLibrary
src/Categories/Changers.php
Changers.deleteColumns
public static function deleteColumns(array $matrix, array $columns) { // validate input if (self::countMinDepth($matrix) < 2) { throw new UnexpectedValueException('Can not delete columns on one dimensional array'); } if (self::countMinDepth($columns) != 1) { t...
php
public static function deleteColumns(array $matrix, array $columns) { // validate input if (self::countMinDepth($matrix) < 2) { throw new UnexpectedValueException('Can not delete columns on one dimensional array'); } if (self::countMinDepth($columns) != 1) { t...
[ "public", "static", "function", "deleteColumns", "(", "array", "$", "matrix", ",", "array", "$", "columns", ")", "{", "// validate input", "if", "(", "self", "::", "countMinDepth", "(", "$", "matrix", ")", "<", "2", ")", "{", "throw", "new", "UnexpectedVal...
@param array $matrix @param mixed $columns @return array
[ "@param", "array", "$matrix", "@param", "mixed", "$columns" ]
train
https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Changers.php#L92-L110
ajant/SimpleArrayLibrary
src/Categories/Changers.php
Changers.insertSubArray
public static function insertSubArray($array, $subArray, $overwrite = false, $ignoreIfExists = false) { // validate if (!is_bool($overwrite)) { throw new InvalidArgumentException('Overwrite indicator must be a boolean'); } if (!is_bool($ignoreIfExists)) { thro...
php
public static function insertSubArray($array, $subArray, $overwrite = false, $ignoreIfExists = false) { // validate if (!is_bool($overwrite)) { throw new InvalidArgumentException('Overwrite indicator must be a boolean'); } if (!is_bool($ignoreIfExists)) { thro...
[ "public", "static", "function", "insertSubArray", "(", "$", "array", ",", "$", "subArray", ",", "$", "overwrite", "=", "false", ",", "$", "ignoreIfExists", "=", "false", ")", "{", "// validate", "if", "(", "!", "is_bool", "(", "$", "overwrite", ")", ")",...
@param mixed $array @param mixed $subArray @param bool $overwrite @param bool $ignoreIfExists @return array
[ "@param", "mixed", "$array", "@param", "mixed", "$subArray", "@param", "bool", "$overwrite", "@param", "bool", "$ignoreIfExists" ]
train
https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Changers.php#L120-L147
ajant/SimpleArrayLibrary
src/Categories/Changers.php
Changers.setColumn
public static function setColumn(array $matrix, $column, $value, $insertIfMissing = true, $overwrite = true) { // validate input if (self::countMinDepth($matrix) < 2) { throw new UnexpectedValueException('Can not set columns on one dimensional array'); } if (!is_scalar($c...
php
public static function setColumn(array $matrix, $column, $value, $insertIfMissing = true, $overwrite = true) { // validate input if (self::countMinDepth($matrix) < 2) { throw new UnexpectedValueException('Can not set columns on one dimensional array'); } if (!is_scalar($c...
[ "public", "static", "function", "setColumn", "(", "array", "$", "matrix", ",", "$", "column", ",", "$", "value", ",", "$", "insertIfMissing", "=", "true", ",", "$", "overwrite", "=", "true", ")", "{", "// validate input", "if", "(", "self", "::", "countM...
@param array $matrix @param mixed $column @param mixed $value @param bool $insertIfMissing @param bool $overwrite @return array
[ "@param", "array", "$matrix", "@param", "mixed", "$column", "@param", "mixed", "$value", "@param", "bool", "$insertIfMissing", "@param", "bool", "$overwrite" ]
train
https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Changers.php#L158-L183
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.compile
public function compile() { $this->loadXML(); $this->id = $this->xml->firstChild->nextSibling->getAttribute('id'); $this->sessionRestore(); $this->detectAutoValidate(); /** @var TAdminUI $page */ $page = Eresus_Kernel::app()->getPage(); $page->linkScripts(Eresus_Kernel::app()->getLegac...
php
public function compile() { $this->loadXML(); $this->id = $this->xml->firstChild->nextSibling->getAttribute('id'); $this->sessionRestore(); $this->detectAutoValidate(); /** @var TAdminUI $page */ $page = Eresus_Kernel::app()->getPage(); $page->linkScripts(Eresus_Kernel::app()->getLegac...
[ "public", "function", "compile", "(", ")", "{", "$", "this", "->", "loadXML", "(", ")", ";", "$", "this", "->", "id", "=", "$", "this", "->", "xml", "->", "firstChild", "->", "nextSibling", "->", "getAttribute", "(", "'id'", ")", ";", "$", "this", ...
Компиляция формы @return string HTML
[ "Компиляция", "формы" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L512-L526
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.unpackData
protected function unpackData($data) { $this->values = $data['values']; $this->isInvalid = $data['isInvalid']; $this->messages = $data['messages']; }
php
protected function unpackData($data) { $this->values = $data['values']; $this->isInvalid = $data['isInvalid']; $this->messages = $data['messages']; }
[ "protected", "function", "unpackData", "(", "$", "data", ")", "{", "$", "this", "->", "values", "=", "$", "data", "[", "'values'", "]", ";", "$", "this", "->", "isInvalid", "=", "$", "data", "[", "'isInvalid'", "]", ";", "$", "this", "->", "messages"...
Распаковать данные, полученные из сессии @param array $data
[ "Распаковать", "данные", "полученные", "из", "сессии" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L548-L553
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.sessionRestore
protected function sessionRestore() { if (isset($_SESSION[get_class($this)][$this->id])) { $this->unpackData($_SESSION[get_class($this)][$this->id]); unset($_SESSION[get_class($this)][$this->id]); } }
php
protected function sessionRestore() { if (isset($_SESSION[get_class($this)][$this->id])) { $this->unpackData($_SESSION[get_class($this)][$this->id]); unset($_SESSION[get_class($this)][$this->id]); } }
[ "protected", "function", "sessionRestore", "(", ")", "{", "if", "(", "isset", "(", "$", "_SESSION", "[", "get_class", "(", "$", "this", ")", "]", "[", "$", "this", "->", "id", "]", ")", ")", "{", "$", "this", "->", "unpackData", "(", "$", "_SESSION...
Восстановление данных из сессии
[ "Восстановление", "данных", "из", "сессии" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L559-L566
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.parseExtended
protected function parseExtended() { $this->addFormMessagesNode(); $this->xml->firstChild->nextSibling->setAttribute('method', 'post'); $this->processBranch($this->xml->firstChild->nextSibling); /* * Обработка тегов: * 1. Удаление расширенных атрибутов * 2. Предотвращение схлопывания пустых тегов ...
php
protected function parseExtended() { $this->addFormMessagesNode(); $this->xml->firstChild->nextSibling->setAttribute('method', 'post'); $this->processBranch($this->xml->firstChild->nextSibling); /* * Обработка тегов: * 1. Удаление расширенных атрибутов * 2. Предотвращение схлопывания пустых тегов ...
[ "protected", "function", "parseExtended", "(", ")", "{", "$", "this", "->", "addFormMessagesNode", "(", ")", ";", "$", "this", "->", "xml", "->", "firstChild", "->", "nextSibling", "->", "setAttribute", "(", "'method'", ",", "'post'", ")", ";", "$", "this"...
Обработка расширенного синтаксиса @return string
[ "Обработка", "расширенного", "синтаксиса" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L574-L660
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.addFormMessagesNode
protected function addFormMessagesNode() { $node = $this->xml->createElement('div'); $node->setAttribute('class', 'form-messages'); $this->xml->firstChild->nextSibling-> insertBefore($node, $this->xml->firstChild->nextSibling->firstChild); }
php
protected function addFormMessagesNode() { $node = $this->xml->createElement('div'); $node->setAttribute('class', 'form-messages'); $this->xml->firstChild->nextSibling-> insertBefore($node, $this->xml->firstChild->nextSibling->firstChild); }
[ "protected", "function", "addFormMessagesNode", "(", ")", "{", "$", "node", "=", "$", "this", "->", "xml", "->", "createElement", "(", "'div'", ")", ";", "$", "node", "->", "setAttribute", "(", "'class'", ",", "'form-messages'", ")", ";", "$", "this", "-...
Добавление области сообщений формы
[ "Добавление", "области", "сообщений", "формы" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L666-L672
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.processBranch
protected function processBranch(DOMNode $branch) { $list = $this->childrenAsArray($branch->childNodes); for ($i = 0; $i < count($list); $i++) { $node = $list[$i]; if ($node->namespaceURI == self::NS) { $node = $this->processExtendedNode($node); } if ($node && in_array($node->nodeName, $this...
php
protected function processBranch(DOMNode $branch) { $list = $this->childrenAsArray($branch->childNodes); for ($i = 0; $i < count($list); $i++) { $node = $list[$i]; if ($node->namespaceURI == self::NS) { $node = $this->processExtendedNode($node); } if ($node && in_array($node->nodeName, $this...
[ "protected", "function", "processBranch", "(", "DOMNode", "$", "branch", ")", "{", "$", "list", "=", "$", "this", "->", "childrenAsArray", "(", "$", "branch", "->", "childNodes", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "count", ...
Обработка ветки документа Метод рекурсивно перебирает все дочерние узлы $branch @param DOMNode $branch Ветка документа
[ "Обработка", "ветки", "документа" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L682-L706
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.processInput
protected function processInput($node) { $name = $node->getAttribute('name'); /* * Подставляем предопределённые значения */ if ($name) { if (isset($this->values[$name])) { switch ($node->nodeName) { case 'input': switch ($node->getAttribute('type')) { case 'passwor...
php
protected function processInput($node) { $name = $node->getAttribute('name'); /* * Подставляем предопределённые значения */ if ($name) { if (isset($this->values[$name])) { switch ($node->nodeName) { case 'input': switch ($node->getAttribute('type')) { case 'passwor...
[ "protected", "function", "processInput", "(", "$", "node", ")", "{", "$", "name", "=", "$", "node", "->", "getAttribute", "(", "'name'", ")", ";", "/*\n\t\t * Подставляем предопределённые значения\n\t\t */", "if", "(", "$", "name", ")", "{", "if", "(", "isset"...
Обработка поля ввода @param DOMNode $node @return DOMNode
[ "Обработка", "поля", "ввода" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L714-L761
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.processExtendedNode
protected function processExtendedNode(DOMNode $node) { $handler = 'extendedNode' . $node->localName; if (method_exists($this, $handler)) { return $this->$handler($node); } else { Eresus_Kernel::log(__METHOD__, LOG_WARNING, 'Unsupported EresusForm tag "%s"', $node->localName); return $no...
php
protected function processExtendedNode(DOMNode $node) { $handler = 'extendedNode' . $node->localName; if (method_exists($this, $handler)) { return $this->$handler($node); } else { Eresus_Kernel::log(__METHOD__, LOG_WARNING, 'Unsupported EresusForm tag "%s"', $node->localName); return $no...
[ "protected", "function", "processExtendedNode", "(", "DOMNode", "$", "node", ")", "{", "$", "handler", "=", "'extendedNode'", ".", "$", "node", "->", "localName", ";", "if", "(", "method_exists", "(", "$", "this", ",", "$", "handler", ")", ")", "{", "ret...
Обработка расширенных тегов @param DOMNode $node Элемент @return DOMNode $node или его замена
[ "Обработка", "расширенных", "тегов" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L771-L784
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedNodeWysiwyg
protected function extendedNodeWysiwyg(DOMElement $node) { $parent = $node->parentNode; //$id = $node->getAttribute('id'); /* Создаём замену для тега wysiwyg */ $textarea = $this->xml->createElement('textarea'); $this->copyElement($node, $textarea); //$tabDiv->setAttribute('id', $id); $textarea->setAtt...
php
protected function extendedNodeWysiwyg(DOMElement $node) { $parent = $node->parentNode; //$id = $node->getAttribute('id'); /* Создаём замену для тега wysiwyg */ $textarea = $this->xml->createElement('textarea'); $this->copyElement($node, $textarea); //$tabDiv->setAttribute('id', $id); $textarea->setAtt...
[ "protected", "function", "extendedNodeWysiwyg", "(", "DOMElement", "$", "node", ")", "{", "$", "parent", "=", "$", "node", "->", "parentNode", ";", "//$id = $node->getAttribute('id');", "/* Создаём замену для тега wysiwyg */", "$", "textarea", "=", "$", "this", "->", ...
Обработка тега "wysiwyg" @param DOMElement $node Элемент @return DOMElement
[ "Обработка", "тега", "wysiwyg" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L794-L811
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedNodeTabWidget
protected function extendedNodeTabWidget(DOMNode $node) { $parent = $node->parentNode; $id = $node->getAttribute('id'); /* Создаём замену для тега tabwidget */ $tabDiv = $this->xml->createElement('div'); /* Копируем в него содержимое tabwidget */ $childNodes = $this->childrenAsArray($node->childNodes); ...
php
protected function extendedNodeTabWidget(DOMNode $node) { $parent = $node->parentNode; $id = $node->getAttribute('id'); /* Создаём замену для тега tabwidget */ $tabDiv = $this->xml->createElement('div'); /* Копируем в него содержимое tabwidget */ $childNodes = $this->childrenAsArray($node->childNodes); ...
[ "protected", "function", "extendedNodeTabWidget", "(", "DOMNode", "$", "node", ")", "{", "$", "parent", "=", "$", "node", "->", "parentNode", ";", "$", "id", "=", "$", "node", "->", "getAttribute", "(", "'id'", ")", ";", "/* Создаём замену для тега tabwidget *...
Обработка тега "tabwidget" @param DOMNode $node Элемент
[ "Обработка", "тега", "tabwidget" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L819-L853
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedNodeTabControl
protected function extendedNodeTabControl(DOMNode $node, $id) { $parent = $node->parentNode; /* Создаём замену для тега tabcontrol */ $newNode = $this->xml->createElement('ul'); /* Копируем в него содержимое tabcontrol */ $childNodes = $this->childrenAsArray($node->childNodes); for ($i = 0; $i < count($ch...
php
protected function extendedNodeTabControl(DOMNode $node, $id) { $parent = $node->parentNode; /* Создаём замену для тега tabcontrol */ $newNode = $this->xml->createElement('ul'); /* Копируем в него содержимое tabcontrol */ $childNodes = $this->childrenAsArray($node->childNodes); for ($i = 0; $i < count($ch...
[ "protected", "function", "extendedNodeTabControl", "(", "DOMNode", "$", "node", ",", "$", "id", ")", "{", "$", "parent", "=", "$", "node", "->", "parentNode", ";", "/* Создаём замену для тега tabcontrol */", "$", "newNode", "=", "$", "this", "->", "xml", "->",...
Обработка тега "tabcontrol" @param DOMNode $node Элемент @param string $id Идентификатор виджета вкладок
[ "Обработка", "тега", "tabcontrol" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L862-L884
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedNodeTab
protected function extendedNodeTab(DOMNode $node, $id) { $parent = $node->parentNode; /* Создаём замену для тега tab */ $newNode = $this->xml->createElement('li'); $newNode->setAttribute('id', $id.'-btn-'.$node->getAttribute('name')); $a = $this->xml->createElement('a', $node->textContent); $a->setAttribu...
php
protected function extendedNodeTab(DOMNode $node, $id) { $parent = $node->parentNode; /* Создаём замену для тега tab */ $newNode = $this->xml->createElement('li'); $newNode->setAttribute('id', $id.'-btn-'.$node->getAttribute('name')); $a = $this->xml->createElement('a', $node->textContent); $a->setAttribu...
[ "protected", "function", "extendedNodeTab", "(", "DOMNode", "$", "node", ",", "$", "id", ")", "{", "$", "parent", "=", "$", "node", "->", "parentNode", ";", "/* Создаём замену для тега tab */", "$", "newNode", "=", "$", "this", "->", "xml", "->", "createElem...
Обработка тега "tab" в tabcontrol @param DOMNode $node Элемент @param string $id Идентификатор виджета вкладок
[ "Обработка", "тега", "tab", "в", "tabcontrol" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L925-L938
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedNodeTabContent
protected function extendedNodeTabContent(DOMNode $node, $id) { $parent = $node->parentNode; /* Создаём замену для тега tab */ $newNode = $this->xml->createElement('div'); $msgNode = $this->xml->createElement('div'); $msgNode->setAttribute('class', 'tab-messages box error hidden'); $newNode->appendChild($...
php
protected function extendedNodeTabContent(DOMNode $node, $id) { $parent = $node->parentNode; /* Создаём замену для тега tab */ $newNode = $this->xml->createElement('div'); $msgNode = $this->xml->createElement('div'); $msgNode->setAttribute('class', 'tab-messages box error hidden'); $newNode->appendChild($...
[ "protected", "function", "extendedNodeTabContent", "(", "DOMNode", "$", "node", ",", "$", "id", ")", "{", "$", "parent", "=", "$", "node", "->", "parentNode", ";", "/* Создаём замену для тега tab */", "$", "newNode", "=", "$", "this", "->", "xml", "->", "cre...
Обработка тега "tab" в tabs @param DOMNode $node Элемент @param string $id Идентификатор виджета вкладок
[ "Обработка", "тега", "tab", "в", "tabs" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L947-L967
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedNodeAttach
protected function extendedNodeAttach(DOMNode $node) { $parent = $node->parentNode; $to = $node->getAttribute('to'); /* Атрибут required */ $required = $node->getAttribute('required'); if ($required) { $this->js []= "addValidator('required', '$to', '$required');"; } /* Удаляём тег */ $parent->re...
php
protected function extendedNodeAttach(DOMNode $node) { $parent = $node->parentNode; $to = $node->getAttribute('to'); /* Атрибут required */ $required = $node->getAttribute('required'); if ($required) { $this->js []= "addValidator('required', '$to', '$required');"; } /* Удаляём тег */ $parent->re...
[ "protected", "function", "extendedNodeAttach", "(", "DOMNode", "$", "node", ")", "{", "$", "parent", "=", "$", "node", "->", "parentNode", ";", "$", "to", "=", "$", "node", "->", "getAttribute", "(", "'to'", ")", ";", "/* Атрибут required */", "$", "requir...
Обработка тега "attach" @param DOMNode $node Элемент
[ "Обработка", "тега", "attach" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L975-L991
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedAttr
protected function extendedAttr(DOMNode $node, DOMAttr $attr) { $handler = 'extendedAttr' . $attr->name; if (method_exists($this, $handler)) { $this->$handler($node, $attr); } else { Eresus_Kernel::log(__METHOD__, LOG_WARNING, 'Unsupported EresusForm attribute "%s"', $attr->name); } $n...
php
protected function extendedAttr(DOMNode $node, DOMAttr $attr) { $handler = 'extendedAttr' . $attr->name; if (method_exists($this, $handler)) { $this->$handler($node, $attr); } else { Eresus_Kernel::log(__METHOD__, LOG_WARNING, 'Unsupported EresusForm attribute "%s"', $attr->name); } $n...
[ "protected", "function", "extendedAttr", "(", "DOMNode", "$", "node", ",", "DOMAttr", "$", "attr", ")", "{", "$", "handler", "=", "'extendedAttr'", ".", "$", "attr", "->", "name", ";", "if", "(", "method_exists", "(", "$", "this", ",", "$", "handler", ...
Обработка расширенных атрибутов @param DOMNode $node Элемент @param DOMAttr $attr Атрибут
[ "Обработка", "расширенных", "атрибутов" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1000-L1014
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedAttrRequired
protected function extendedAttrRequired(DOMNode $node, DOMAttr $attr) { $id = $node->getAttribute('id'); $message = $attr->value; $this->js []= "addValidator('required', '#$id', '$message');"; }
php
protected function extendedAttrRequired(DOMNode $node, DOMAttr $attr) { $id = $node->getAttribute('id'); $message = $attr->value; $this->js []= "addValidator('required', '#$id', '$message');"; }
[ "protected", "function", "extendedAttrRequired", "(", "DOMNode", "$", "node", ",", "DOMAttr", "$", "attr", ")", "{", "$", "id", "=", "$", "node", "->", "getAttribute", "(", "'id'", ")", ";", "$", "message", "=", "$", "attr", "->", "value", ";", "$", ...
Обработка атрибута "required" @param DOMNode $node Элемент @param DOMAttr $attr Атрибут
[ "Обработка", "атрибута", "required" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1023-L1030
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedAttrPassword
protected function extendedAttrPassword(DOMNode $node, DOMAttr $attr) { $id = $node->getAttribute('id'); $passwordId = $attr->value; $this->js []= "addValidator('password', '#$id', '$passwordId');"; }
php
protected function extendedAttrPassword(DOMNode $node, DOMAttr $attr) { $id = $node->getAttribute('id'); $passwordId = $attr->value; $this->js []= "addValidator('password', '#$id', '$passwordId');"; }
[ "protected", "function", "extendedAttrPassword", "(", "DOMNode", "$", "node", ",", "DOMAttr", "$", "attr", ")", "{", "$", "id", "=", "$", "node", "->", "getAttribute", "(", "'id'", ")", ";", "$", "passwordId", "=", "$", "attr", "->", "value", ";", "$",...
Обработка атрибута "password" @param DOMNode $node Элемент @param DOMAttr $attr Атрибут
[ "Обработка", "атрибута", "password" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1039-L1044
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.extendedAttrMatch
protected function extendedAttrMatch(DOMNode $node, DOMAttr $attr) { $id = $node->getAttribute('id'); $pattern = $attr->value; /* Для Dwoo нужно экранировать фигурные скобки. Почему-то они передаются и сюда */ $pattern = str_replace(array('\{', '\}'), array('{', '}'), $pattern); $this->js []= "addValidator('...
php
protected function extendedAttrMatch(DOMNode $node, DOMAttr $attr) { $id = $node->getAttribute('id'); $pattern = $attr->value; /* Для Dwoo нужно экранировать фигурные скобки. Почему-то они передаются и сюда */ $pattern = str_replace(array('\{', '\}'), array('{', '}'), $pattern); $this->js []= "addValidator('...
[ "protected", "function", "extendedAttrMatch", "(", "DOMNode", "$", "node", ",", "DOMAttr", "$", "attr", ")", "{", "$", "id", "=", "$", "node", "->", "getAttribute", "(", "'id'", ")", ";", "$", "pattern", "=", "$", "attr", "->", "value", ";", "/* Для Dw...
Обработка атрибута "match" @param DOMNode $node Элемент @param DOMAttr $attr Атрибут
[ "Обработка", "атрибута", "match" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1053-L1060
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.validate
protected function validate() { $this->loadXML(); $this->id = $this->xml->firstChild->nextSibling->getAttribute('id'); $this->detectAutoValidate(); $this->validateInputs($this->xml->firstChild->nextSibling); }
php
protected function validate() { $this->loadXML(); $this->id = $this->xml->firstChild->nextSibling->getAttribute('id'); $this->detectAutoValidate(); $this->validateInputs($this->xml->firstChild->nextSibling); }
[ "protected", "function", "validate", "(", ")", "{", "$", "this", "->", "loadXML", "(", ")", ";", "$", "this", "->", "id", "=", "$", "this", "->", "xml", "->", "firstChild", "->", "nextSibling", "->", "getAttribute", "(", "'id'", ")", ";", "$", "this"...
Проверить данные формы
[ "Проверить", "данные", "формы" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1088-L1095
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.validateInputs
protected function validateInputs(DOMNode $branch) { $list = $this->childrenAsArray($branch->childNodes); for ($i = 0; $i < count($list); $i++) { $node = $list[$i]; if (in_array($node->nodeName, $this->inputs)) { $this->validateInput($node); } elseif ($node->nodeName == 'fc:attach') { ...
php
protected function validateInputs(DOMNode $branch) { $list = $this->childrenAsArray($branch->childNodes); for ($i = 0; $i < count($list); $i++) { $node = $list[$i]; if (in_array($node->nodeName, $this->inputs)) { $this->validateInput($node); } elseif ($node->nodeName == 'fc:attach') { ...
[ "protected", "function", "validateInputs", "(", "DOMNode", "$", "branch", ")", "{", "$", "list", "=", "$", "this", "->", "childrenAsArray", "(", "$", "branch", "->", "childNodes", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "count",...
Проверка полей ввода в ветке документа на сервере Метод рекурсивно перебирает все дочерние узлы $branch @param DOMNode $branch Ветка документа
[ "Проверка", "полей", "ввода", "в", "ветке", "документа", "на", "сервере" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1105-L1125
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.validateInput
protected function validateInput($node) { $hasAttributes = $node->hasAttributes(); if ($hasAttributes) { $name = $node->getAttribute('name'); $attrs = $node->attributes; for ($i = 0; $i < $attrs->length; $i++) { $attr = $attrs->item($i); if ($attr->namespaceURI == self::NS) { swit...
php
protected function validateInput($node) { $hasAttributes = $node->hasAttributes(); if ($hasAttributes) { $name = $node->getAttribute('name'); $attrs = $node->attributes; for ($i = 0; $i < $attrs->length; $i++) { $attr = $attrs->item($i); if ($attr->namespaceURI == self::NS) { swit...
[ "protected", "function", "validateInput", "(", "$", "node", ")", "{", "$", "hasAttributes", "=", "$", "node", "->", "hasAttributes", "(", ")", ";", "if", "(", "$", "hasAttributes", ")", "{", "$", "name", "=", "$", "node", "->", "getAttribute", "(", "'n...
Проверка поля ввода на сервере Дает клиенту комманду проверить элементы при загрузке страницы @param DOMNode $node
[ "Проверка", "поля", "ввода", "на", "сервере", "Дает", "клиенту", "комманду", "проверить", "элементы", "при", "загрузке", "страницы" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1133-L1172
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.getValue
public function getValue($name) { if (! isset($this->values[$name])) { $this->values[$name] = arg($name); } return $this->values[$name]; }
php
public function getValue($name) { if (! isset($this->values[$name])) { $this->values[$name] = arg($name); } return $this->values[$name]; }
[ "public", "function", "getValue", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "values", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "values", "[", "$", "name", "]", "=", "arg", "(", "$", "name", "...
Получить значение поля @param string $name @return mixed
[ "Получить", "значение", "поля" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1212-L1220
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.invalidValue
public function invalidValue($name, $description) { $this->invalidData[$name] = true; $this->addMessage($name, $description); }
php
public function invalidValue($name, $description) { $this->invalidData[$name] = true; $this->addMessage($name, $description); }
[ "public", "function", "invalidValue", "(", "$", "name", ",", "$", "description", ")", "{", "$", "this", "->", "invalidData", "[", "$", "name", "]", "=", "true", ";", "$", "this", "->", "addMessage", "(", "$", "name", ",", "$", "description", ")", ";"...
Отметить неправильное значение Устанавливает флаг invalidData @param string $name Имя значения @param string $description Описание ошибки @see invalidData
[ "Отметить", "неправильное", "значение" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1233-L1237
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.loadXML
protected function loadXML() { $tmpl = new Eresus_Template($this->template); $html = $tmpl->compile($this->values); $imp = new DOMImplementation; $dtd = $imp->createDocumentType('html', '-//W3C//DTD XHTML 1.0 Strict//EN', null); $this->xml = $imp->createDocument(null, 'html', $dtd); $html = "<!DOCTYPE ro...
php
protected function loadXML() { $tmpl = new Eresus_Template($this->template); $html = $tmpl->compile($this->values); $imp = new DOMImplementation; $dtd = $imp->createDocumentType('html', '-//W3C//DTD XHTML 1.0 Strict//EN', null); $this->xml = $imp->createDocument(null, 'html', $dtd); $html = "<!DOCTYPE ro...
[ "protected", "function", "loadXML", "(", ")", "{", "$", "tmpl", "=", "new", "Eresus_Template", "(", "$", "this", "->", "template", ")", ";", "$", "html", "=", "$", "tmpl", "->", "compile", "(", "$", "this", "->", "values", ")", ";", "$", "imp", "="...
Компиляция XML
[ "Компиляция", "XML" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1299-L1316
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.childrenAsArray
protected function childrenAsArray($nodeList) { $result = array(); if (! is_object($nodeList)) { return $result; } if (! ($nodeList instanceof DOMNodeList)) { return $result; } for ($i = 0; $i < $nodeList->length; $i++) { $result []= $nodeList->item($i); } return $result; }
php
protected function childrenAsArray($nodeList) { $result = array(); if (! is_object($nodeList)) { return $result; } if (! ($nodeList instanceof DOMNodeList)) { return $result; } for ($i = 0; $i < $nodeList->length; $i++) { $result []= $nodeList->item($i); } return $result; }
[ "protected", "function", "childrenAsArray", "(", "$", "nodeList", ")", "{", "$", "result", "=", "array", "(", ")", ";", "if", "(", "!", "is_object", "(", "$", "nodeList", ")", ")", "{", "return", "$", "result", ";", "}", "if", "(", "!", "(", "$", ...
Получить дочерние узлы в виде списка @param DOMNode $node @return array
[ "Получить", "дочерние", "узлы", "в", "виде", "списка" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1323-L1342
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.copyElement
protected function copyElement(DOMElement $source, DOMElement $target) { if ($source->hasAttributes()) { $attributes = $source->attributes; if (!is_null($attributes)) { foreach ($attributes as $attr) { $target->setAttribute($attr->name, $attr->value); } } } foreach ($source->child...
php
protected function copyElement(DOMElement $source, DOMElement $target) { if ($source->hasAttributes()) { $attributes = $source->attributes; if (!is_null($attributes)) { foreach ($attributes as $attr) { $target->setAttribute($attr->name, $attr->value); } } } foreach ($source->child...
[ "protected", "function", "copyElement", "(", "DOMElement", "$", "source", ",", "DOMElement", "$", "target", ")", "{", "if", "(", "$", "source", "->", "hasAttributes", "(", ")", ")", "{", "$", "attributes", "=", "$", "source", "->", "attributes", ";", "if...
Копирует атрибуты элемента и его дочерние узлы @param DOMElement $source @param DOMElement $target @return void
[ "Копирует", "атрибуты", "элемента", "и", "его", "дочерние", "узлы" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1352-L1370
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.valueOf
protected function valueOf(DOMNode $node) { switch ($node->nodeName) { case 'input': switch ($node->getAttribute('type')) { case 'checkbox': return $node->getAttribute('checked') ? $node->getAttribute('value') : false; break; default: return $node->getAttribute('value'); ...
php
protected function valueOf(DOMNode $node) { switch ($node->nodeName) { case 'input': switch ($node->getAttribute('type')) { case 'checkbox': return $node->getAttribute('checked') ? $node->getAttribute('value') : false; break; default: return $node->getAttribute('value'); ...
[ "protected", "function", "valueOf", "(", "DOMNode", "$", "node", ")", "{", "switch", "(", "$", "node", "->", "nodeName", ")", "{", "case", "'input'", ":", "switch", "(", "$", "node", "->", "getAttribute", "(", "'type'", ")", ")", "{", "case", "'checkbo...
Получение значения поля ввода @param DOMNode $node @return mixed
[ "Получение", "значения", "поля", "ввода" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1379-L1398
Eresus/EresusCMS
src/core/EresusForm.php
EresusForm.detectAutoValidate
protected function detectAutoValidate() { $this->autoValidate = true; if ($this->xml->firstChild->nextSibling->hasAttributeNS(self::NS, 'validate')) { $value = $this->xml->firstChild->nextSibling->getAttributeNS(self::NS, 'validate'); switch ($value) { case '': case '0': case 'false': ...
php
protected function detectAutoValidate() { $this->autoValidate = true; if ($this->xml->firstChild->nextSibling->hasAttributeNS(self::NS, 'validate')) { $value = $this->xml->firstChild->nextSibling->getAttributeNS(self::NS, 'validate'); switch ($value) { case '': case '0': case 'false': ...
[ "protected", "function", "detectAutoValidate", "(", ")", "{", "$", "this", "->", "autoValidate", "=", "true", ";", "if", "(", "$", "this", "->", "xml", "->", "firstChild", "->", "nextSibling", "->", "hasAttributeNS", "(", "self", "::", "NS", ",", "'validat...
Определение режима проверки ошибок на JavaScript @return void
[ "Определение", "режима", "проверки", "ошибок", "на", "JavaScript" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/EresusForm.php#L1406-L1424
eghojansu/moe
src/Base.php
Base.build
function build($url,$params=array()) { $params+=$this->hive['PARAMS']; if (is_array($url)) foreach ($url as &$var) { $var=$this->build($var,$params); unset($var); } else { $i=0; $url=preg_replace_callback('/@(\w+)|\*/', function($match) use(&$i,$params) { $i++; if (isset($match[1...
php
function build($url,$params=array()) { $params+=$this->hive['PARAMS']; if (is_array($url)) foreach ($url as &$var) { $var=$this->build($var,$params); unset($var); } else { $i=0; $url=preg_replace_callback('/@(\w+)|\*/', function($match) use(&$i,$params) { $i++; if (isset($match[1...
[ "function", "build", "(", "$", "url", ",", "$", "params", "=", "array", "(", ")", ")", "{", "$", "params", "+=", "$", "this", "->", "hive", "[", "'PARAMS'", "]", ";", "if", "(", "is_array", "(", "$", "url", ")", ")", "foreach", "(", "$", "url",...
Replace tokenized URL with available token values @return string @param $url array|string @param $params array
[ "Replace", "tokenized", "URL", "with", "available", "token", "values" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L124-L145
eghojansu/moe
src/Base.php
Base.parse
function parse($str) { preg_match_all('/(\w+)\h*=\h*(.+?)(?=,|$)/', $str,$pairs,PREG_SET_ORDER); $out=array(); foreach ($pairs as $pair) $out[$pair[1]]=trim($pair[2]); return $out; }
php
function parse($str) { preg_match_all('/(\w+)\h*=\h*(.+?)(?=,|$)/', $str,$pairs,PREG_SET_ORDER); $out=array(); foreach ($pairs as $pair) $out[$pair[1]]=trim($pair[2]); return $out; }
[ "function", "parse", "(", "$", "str", ")", "{", "preg_match_all", "(", "'/(\\w+)\\h*=\\h*(.+?)(?=,|$)/'", ",", "$", "str", ",", "$", "pairs", ",", "PREG_SET_ORDER", ")", ";", "$", "out", "=", "array", "(", ")", ";", "foreach", "(", "$", "pairs", "as", ...
Parse string containing key-value pairs @return array @param $str string
[ "Parse", "string", "containing", "key", "-", "value", "pairs" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L167-L174
eghojansu/moe
src/Base.php
Base.siteUrl
function siteUrl($url, $params = array()) { return $this->hive['BASEURL'] . ltrim(empty($this->hive['ALIASES'][$url])?$url:$this->alias($url, $params), '/'); }
php
function siteUrl($url, $params = array()) { return $this->hive['BASEURL'] . ltrim(empty($this->hive['ALIASES'][$url])?$url:$this->alias($url, $params), '/'); }
[ "function", "siteUrl", "(", "$", "url", ",", "$", "params", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "hive", "[", "'BASEURL'", "]", ".", "ltrim", "(", "empty", "(", "$", "this", "->", "hive", "[", "'ALIASES'", "]", "[", "$",...
Site Url
[ "Site", "Url" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L179-L181
eghojansu/moe
src/Base.php
Base.compile
function compile($str) { $fw=$this; return preg_replace_callback( '/(?<!\w)@(\w(?:[\w\.\[\]\(]|\->|::)*)/', function($var) use($fw) { return '$'.preg_replace_callback( '/\.(\w+)\(|\.(\w+)|\[((?:[^\[\]]*|(?R))*)\]/', function($expr) use($fw) { return $expr[1]? ((function_exists($expr...
php
function compile($str) { $fw=$this; return preg_replace_callback( '/(?<!\w)@(\w(?:[\w\.\[\]\(]|\->|::)*)/', function($var) use($fw) { return '$'.preg_replace_callback( '/\.(\w+)\(|\.(\w+)|\[((?:[^\[\]]*|(?R))*)\]/', function($expr) use($fw) { return $expr[1]? ((function_exists($expr...
[ "function", "compile", "(", "$", "str", ")", "{", "$", "fw", "=", "$", "this", ";", "return", "preg_replace_callback", "(", "'/(?<!\\w)@(\\w(?:[\\w\\.\\[\\]\\(]|\\->|::)*)/'", ",", "function", "(", "$", "var", ")", "use", "(", "$", "fw", ")", "{", "return", ...
Convert JS-style token to PHP expression @return string @param $str string
[ "Convert", "JS", "-", "style", "token", "to", "PHP", "expression" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L188-L212
eghojansu/moe
src/Base.php
Base.&
function &ref($key,$add=TRUE) { $null=NULL; $parts=$this->cut($key); if ($parts[0]=='SESSION') { @session_start(); $this->sync('SESSION'); } elseif (!preg_match('/^\w+$/',$parts[0])) user_error(sprintf(self::E_Hive,$this->stringify($key)), E_USER_ERROR); if ($add) $var=&$this->hive; else ...
php
function &ref($key,$add=TRUE) { $null=NULL; $parts=$this->cut($key); if ($parts[0]=='SESSION') { @session_start(); $this->sync('SESSION'); } elseif (!preg_match('/^\w+$/',$parts[0])) user_error(sprintf(self::E_Hive,$this->stringify($key)), E_USER_ERROR); if ($add) $var=&$this->hive; else ...
[ "function", "&", "ref", "(", "$", "key", ",", "$", "add", "=", "TRUE", ")", "{", "$", "null", "=", "NULL", ";", "$", "parts", "=", "$", "this", "->", "cut", "(", "$", "key", ")", ";", "if", "(", "$", "parts", "[", "0", "]", "==", "'SESSION'...
Get hive key reference/contents; Add non-existent hive keys, array elements, and object properties by default @return mixed @param $key string @param $add bool
[ "Get", "hive", "key", "reference", "/", "contents", ";", "Add", "non", "-", "existent", "hive", "keys", "array", "elements", "and", "object", "properties", "by", "default" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L221-L263
eghojansu/moe
src/Base.php
Base.devoid
function devoid($key) { $val=$this->ref($key,FALSE); return empty($val) && (!Cache::instance()->exists($this->hash($key).'.var',$val) || !$val); }
php
function devoid($key) { $val=$this->ref($key,FALSE); return empty($val) && (!Cache::instance()->exists($this->hash($key).'.var',$val) || !$val); }
[ "function", "devoid", "(", "$", "key", ")", "{", "$", "val", "=", "$", "this", "->", "ref", "(", "$", "key", ",", "FALSE", ")", ";", "return", "empty", "(", "$", "val", ")", "&&", "(", "!", "Cache", "::", "instance", "(", ")", "->", "exists", ...
Return TRUE if hive key is empty and not cached @return bool @param $key string
[ "Return", "TRUE", "if", "hive", "key", "is", "empty", "and", "not", "cached" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L284-L289
eghojansu/moe
src/Base.php
Base.set
function set($key,$val,$ttl=0) { $time=time(); if (preg_match('/^(GET|POST|COOKIE)\b(.+)/',$key,$expr)) { $this->set('REQUEST'.$expr[2],$val); if ($expr[1]=='COOKIE') { $parts=$this->cut($key); $jar=$this->unserialize($this->serialize($this->hive['JAR'])); if ($ttl) $jar['expire']=$time+$ttl;...
php
function set($key,$val,$ttl=0) { $time=time(); if (preg_match('/^(GET|POST|COOKIE)\b(.+)/',$key,$expr)) { $this->set('REQUEST'.$expr[2],$val); if ($expr[1]=='COOKIE') { $parts=$this->cut($key); $jar=$this->unserialize($this->serialize($this->hive['JAR'])); if ($ttl) $jar['expire']=$time+$ttl;...
[ "function", "set", "(", "$", "key", ",", "$", "val", ",", "$", "ttl", "=", "0", ")", "{", "$", "time", "=", "time", "(", ")", ";", "if", "(", "preg_match", "(", "'/^(GET|POST|COOKIE)\\b(.+)/'", ",", "$", "key", ",", "$", "expr", ")", ")", "{", ...
Bind value to hive key @return mixed @param $key string @param $val mixed @param $ttl int
[ "Bind", "value", "to", "hive", "key" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L298-L350
eghojansu/moe
src/Base.php
Base.get
function get($key,$args=NULL) { if (is_string($val=$this->ref($key,FALSE)) && !is_null($args)) return call_user_func_array( array($this,'format'), array_merge(array($val),is_array($args)?$args:array($args)) ); if (is_null($val)) { // Attempt to retrieve from cache if (Cache::instance()->exists($...
php
function get($key,$args=NULL) { if (is_string($val=$this->ref($key,FALSE)) && !is_null($args)) return call_user_func_array( array($this,'format'), array_merge(array($val),is_array($args)?$args:array($args)) ); if (is_null($val)) { // Attempt to retrieve from cache if (Cache::instance()->exists($...
[ "function", "get", "(", "$", "key", ",", "$", "args", "=", "NULL", ")", "{", "if", "(", "is_string", "(", "$", "val", "=", "$", "this", "->", "ref", "(", "$", "key", ",", "FALSE", ")", ")", "&&", "!", "is_null", "(", "$", "args", ")", ")", ...
Retrieve contents of hive key @return mixed @param $key string @param $args string|array
[ "Retrieve", "contents", "of", "hive", "key" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L358-L370
eghojansu/moe
src/Base.php
Base.merge
function merge($key,$src) { $ref=&$this->ref($key); return ($ref = array_merge($ref,is_string($src)?$this->hive[$src]:$src)); }
php
function merge($key,$src) { $ref=&$this->ref($key); return ($ref = array_merge($ref,is_string($src)?$this->hive[$src]:$src)); }
[ "function", "merge", "(", "$", "key", ",", "$", "src", ")", "{", "$", "ref", "=", "&", "$", "this", "->", "ref", "(", "$", "key", ")", ";", "return", "(", "$", "ref", "=", "array_merge", "(", "$", "ref", ",", "is_string", "(", "$", "src", ")"...
Merge array with hive array variable @return array @param $key string @param $src string|array
[ "Merge", "array", "with", "hive", "array", "variable" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L551-L554
eghojansu/moe
src/Base.php
Base.readByte
function readByte($byte, $precision = 7) { $unit = array('Byte','KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'); if (is_numeric($byte)) { $w = floor((strlen($byte) - 1) / 3); return sprintf("%.{$precision}f %s", $byte/pow(1024, $w), $unit[$w]); } $str = a...
php
function readByte($byte, $precision = 7) { $unit = array('Byte','KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'); if (is_numeric($byte)) { $w = floor((strlen($byte) - 1) / 3); return sprintf("%.{$precision}f %s", $byte/pow(1024, $w), $unit[$w]); } $str = a...
[ "function", "readByte", "(", "$", "byte", ",", "$", "precision", "=", "7", ")", "{", "$", "unit", "=", "array", "(", "'Byte'", ",", "'KiB'", ",", "'MiB'", ",", "'GiB'", ",", "'TiB'", ",", "'PiB'", ",", "'EiB'", ",", "'ZiB'", ",", "'YiB'", ")", ";...
Convert byte @return string byte
[ "Convert", "byte" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L618-L630
eghojansu/moe
src/Base.php
Base.random
function random($len) { $len = abs($len); $pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; $poolLen = strlen($pool); $str = ''; while ($len-- > 0) $str .= substr($pool, rand(0, $poolLen), 1); return $str; }
php
function random($len) { $len = abs($len); $pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; $poolLen = strlen($pool); $str = ''; while ($len-- > 0) $str .= substr($pool, rand(0, $poolLen), 1); return $str; }
[ "function", "random", "(", "$", "len", ")", "{", "$", "len", "=", "abs", "(", "$", "len", ")", ";", "$", "pool", "=", "'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'", ";", "$", "poolLen", "=", "strlen", "(", "$", "pool", ")", ";", "$", "str", ...
Generate random string @param int $len random string length @return string random string
[ "Generate", "random", "string" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L637-L647
eghojansu/moe
src/Base.php
Base.pre
function pre($data, $exit = false) { echo '<pre>'; print_r($data); echo '</pre>'; !$exit || exit(str_repeat('<br>', 2).' '.$exit); echo '<hr>'; }
php
function pre($data, $exit = false) { echo '<pre>'; print_r($data); echo '</pre>'; !$exit || exit(str_repeat('<br>', 2).' '.$exit); echo '<hr>'; }
[ "function", "pre", "(", "$", "data", ",", "$", "exit", "=", "false", ")", "{", "echo", "'<pre>'", ";", "print_r", "(", "$", "data", ")", ";", "echo", "'</pre>'", ";", "!", "$", "exit", "||", "exit", "(", "str_repeat", "(", "'<br>'", ",", "2", ")"...
Output the data @param mixed $data @param bool $exit wether to exit after dumping or not
[ "Output", "the", "data" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L654-L661
eghojansu/moe
src/Base.php
Base.ulMenu
function ulMenu($menu, $active) { $menu || $menu = array(); $active = str_replace('@', '', $active); $opt = [ 'href'=>'', 'label'=>'', 'class'=>'', 'activeClass'=>'active', 'type'=>'ul', 'child'=>[ 'class'=>'', 'li'=>[...
php
function ulMenu($menu, $active) { $menu || $menu = array(); $active = str_replace('@', '', $active); $opt = [ 'href'=>'', 'label'=>'', 'class'=>'', 'activeClass'=>'active', 'type'=>'ul', 'child'=>[ 'class'=>'', 'li'=>[...
[ "function", "ulMenu", "(", "$", "menu", ",", "$", "active", ")", "{", "$", "menu", "||", "$", "menu", "=", "array", "(", ")", ";", "$", "active", "=", "str_replace", "(", "'@'", ",", "''", ",", "$", "active", ")", ";", "$", "opt", "=", "[", "...
Generate html list menu @param array $menu @param string $active active url (token alias) @return string ul html
[ "Generate", "html", "list", "menu" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L669-L750
eghojansu/moe
src/Base.php
Base.constants
function constants($class,$prefix='') { $ref=new ReflectionClass($class); $out=array(); foreach (preg_grep('/^'.$prefix.'/',array_keys($ref->getconstants())) as $val) { $out[$key=substr($val,strlen($prefix))]= constant((is_object($class)?get_class($class):$class).'::'.$prefix.$key); } unset($ref); ...
php
function constants($class,$prefix='') { $ref=new ReflectionClass($class); $out=array(); foreach (preg_grep('/^'.$prefix.'/',array_keys($ref->getconstants())) as $val) { $out[$key=substr($val,strlen($prefix))]= constant((is_object($class)?get_class($class):$class).'::'.$prefix.$key); } unset($ref); ...
[ "function", "constants", "(", "$", "class", ",", "$", "prefix", "=", "''", ")", "{", "$", "ref", "=", "new", "ReflectionClass", "(", "$", "class", ")", ";", "$", "out", "=", "array", "(", ")", ";", "foreach", "(", "preg_grep", "(", "'/^'", ".", "...
Convert class constants to array @return array @param $class object|string @param $prefix string
[ "Convert", "class", "constants", "to", "array" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L827-L837
eghojansu/moe
src/Base.php
Base.recursive
function recursive($arg,$func,$stack=NULL) { if ($stack) { foreach ($stack as $node) if ($arg===$node) return $arg; } else $stack=array(); switch (gettype($arg)) { case 'object': if (method_exists('ReflectionClass','iscloneable')) { $ref=new ReflectionClass($arg); if ($ref->isclo...
php
function recursive($arg,$func,$stack=NULL) { if ($stack) { foreach ($stack as $node) if ($arg===$node) return $arg; } else $stack=array(); switch (gettype($arg)) { case 'object': if (method_exists('ReflectionClass','iscloneable')) { $ref=new ReflectionClass($arg); if ($ref->isclo...
[ "function", "recursive", "(", "$", "arg", ",", "$", "func", ",", "$", "stack", "=", "NULL", ")", "{", "if", "(", "$", "stack", ")", "{", "foreach", "(", "$", "stack", "as", "$", "node", ")", "if", "(", "$", "arg", "===", "$", "node", ")", "re...
Invoke callback recursively for all data types @return mixed @param $arg mixed @param $func callback @param $stack array
[ "Invoke", "callback", "recursively", "for", "all", "data", "types" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L885-L915
eghojansu/moe
src/Base.php
Base.clean
function clean($arg,$tags=NULL) { $fw=$this; return $this->recursive($arg, function($val) use($fw,$tags) { if ($tags!='*') $val=trim(strip_tags($val, '<'.implode('><',$fw->split($tags)).'>')); return trim(preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/','',$val)); } ); }
php
function clean($arg,$tags=NULL) { $fw=$this; return $this->recursive($arg, function($val) use($fw,$tags) { if ($tags!='*') $val=trim(strip_tags($val, '<'.implode('><',$fw->split($tags)).'>')); return trim(preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/','',$val)); } ); }
[ "function", "clean", "(", "$", "arg", ",", "$", "tags", "=", "NULL", ")", "{", "$", "fw", "=", "$", "this", ";", "return", "$", "this", "->", "recursive", "(", "$", "arg", ",", "function", "(", "$", "val", ")", "use", "(", "$", "fw", ",", "$"...
Remove HTML tags (except those enumerated) and non-printable characters to mitigate XSS/code injection attacks @return mixed @param $arg mixed @param $tags string
[ "Remove", "HTML", "tags", "(", "except", "those", "enumerated", ")", "and", "non", "-", "printable", "characters", "to", "mitigate", "XSS", "/", "code", "injection", "attacks" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L924-L935
eghojansu/moe
src/Base.php
Base.format
function format() { $args=func_get_args(); $val=array_shift($args); // Get formatting rules $conv=localeconv(); return preg_replace_callback( '/\{(?P<pos>\d+)\s*(?:,\s*(?P<type>\w+)\s*'. '(?:,\s*(?P<mod>(?:\w+(?:\s*\{.+?\}\s*,?)?)*)'. '(?:,\s*(?P<prop>.+?))?)?)?\}/', function($expr) use($args,$con...
php
function format() { $args=func_get_args(); $val=array_shift($args); // Get formatting rules $conv=localeconv(); return preg_replace_callback( '/\{(?P<pos>\d+)\s*(?:,\s*(?P<type>\w+)\s*'. '(?:,\s*(?P<mod>(?:\w+(?:\s*\{.+?\}\s*,?)?)*)'. '(?:,\s*(?P<prop>.+?))?)?)?\}/', function($expr) use($args,$con...
[ "function", "format", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "val", "=", "array_shift", "(", "$", "args", ")", ";", "// Get formatting rules", "$", "conv", "=", "localeconv", "(", ")", ";", "return", "preg_replace_callback", ...
Return locale-aware formatted string @return string
[ "Return", "locale", "-", "aware", "formatted", "string" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L951-L1054
eghojansu/moe
src/Base.php
Base.lexicon
function lexicon($path) { $lex=array(); foreach ($this->languages?:explode(',',$this->fallback) as $lang) foreach ($this->split($path) as $dir) if ((is_file($file=($base=$dir.$lang).'.php') || is_file($file=$base.'.php')) && is_array($dict=require($file))) $lex+=$dict; elseif (is_file($fil...
php
function lexicon($path) { $lex=array(); foreach ($this->languages?:explode(',',$this->fallback) as $lang) foreach ($this->split($path) as $dir) if ((is_file($file=($base=$dir.$lang).'.php') || is_file($file=$base.'.php')) && is_array($dict=require($file))) $lex+=$dict; elseif (is_file($fil...
[ "function", "lexicon", "(", "$", "path", ")", "{", "$", "lex", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "languages", "?", ":", "explode", "(", "','", ",", "$", "this", "->", "fallback", ")", "as", "$", "lang", ")", "foreach...
Return lexicon entries @return array @param $path string
[ "Return", "lexicon", "entries" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1099-L1127
eghojansu/moe
src/Base.php
Base.status
function status($code) { $reason=@constant('self::HTTP_'.$code); if (PHP_SAPI!='cli') header($_SERVER['SERVER_PROTOCOL'].' '.$code.' '.$reason); return $reason; }
php
function status($code) { $reason=@constant('self::HTTP_'.$code); if (PHP_SAPI!='cli') header($_SERVER['SERVER_PROTOCOL'].' '.$code.' '.$reason); return $reason; }
[ "function", "status", "(", "$", "code", ")", "{", "$", "reason", "=", "@", "constant", "(", "'self::HTTP_'", ".", "$", "code", ")", ";", "if", "(", "PHP_SAPI", "!=", "'cli'", ")", "header", "(", "$", "_SERVER", "[", "'SERVER_PROTOCOL'", "]", ".", "' ...
Send HTTP status header; Return text equivalent of status code @return string @param $code int
[ "Send", "HTTP", "status", "header", ";", "Return", "text", "equivalent", "of", "status", "code" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1162-L1167
eghojansu/moe
src/Base.php
Base.expire
function expire($secs=0) { if (PHP_SAPI!='cli') { header('X-Content-Type-Options: nosniff'); header('X-Frame-Options: '.$this->hive['XFRAME']); header('X-Powered-By: '.$this->hive['PACKAGE']); header('X-XSS-Protection: 1; mode=block'); if ($secs) { $time=microtime(TRUE); header_remove('Pragma')...
php
function expire($secs=0) { if (PHP_SAPI!='cli') { header('X-Content-Type-Options: nosniff'); header('X-Frame-Options: '.$this->hive['XFRAME']); header('X-Powered-By: '.$this->hive['PACKAGE']); header('X-XSS-Protection: 1; mode=block'); if ($secs) { $time=microtime(TRUE); header_remove('Pragma')...
[ "function", "expire", "(", "$", "secs", "=", "0", ")", "{", "if", "(", "PHP_SAPI", "!=", "'cli'", ")", "{", "header", "(", "'X-Content-Type-Options: nosniff'", ")", ";", "header", "(", "'X-Frame-Options: '", ".", "$", "this", "->", "hive", "[", "'XFRAME'",...
Send cache metadata to HTTP client @return NULL @param $secs int
[ "Send", "cache", "metadata", "to", "HTTP", "client" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1174-L1190
eghojansu/moe
src/Base.php
Base.error
function error($code,$text='',array $trace=NULL) { $prior=$this->hive['ERROR']; $header=$this->status($code); $req=$this->hive['VERB'].' '.$this->hive['PATH']; if (!$text) $text='HTTP '.$code.' ('.$req.')'; $logger = new Log($this->hive['ERROR_LOG']); $logger->write($text); $trace=$this->trace($trace);...
php
function error($code,$text='',array $trace=NULL) { $prior=$this->hive['ERROR']; $header=$this->status($code); $req=$this->hive['VERB'].' '.$this->hive['PATH']; if (!$text) $text='HTTP '.$code.' ('.$req.')'; $logger = new Log($this->hive['ERROR_LOG']); $logger->write($text); $trace=$this->trace($trace);...
[ "function", "error", "(", "$", "code", ",", "$", "text", "=", "''", ",", "array", "$", "trace", "=", "NULL", ")", "{", "$", "prior", "=", "$", "this", "->", "hive", "[", "'ERROR'", "]", ";", "$", "header", "=", "$", "this", "->", "status", "(",...
Log error; Execute ONERROR handler if defined, else display default error page (HTML for synchronous requests, JSON string for AJAX requests) @return NULL @param $code int @param $text string @param $trace array
[ "Log", "error", ";", "Execute", "ONERROR", "handler", "if", "defined", "else", "display", "default", "error", "page", "(", "HTML", "for", "synchronous", "requests", "JSON", "string", "for", "AJAX", "requests", ")" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1288-L1330
eghojansu/moe
src/Base.php
Base.reroute
function reroute($url=NULL,$permanent=FALSE) { if (!$url) $url=$this->hive['REALM']; if (preg_match('/^(?:@(\w+)(?:(\(.+?)\))*)/',$url,$parts)) { if (empty($this->hive['ALIASES'][$parts[1]])) user_error(sprintf(self::E_Named,$parts[1]),E_USER_ERROR); $url=$this->hive['ALIASES'][$parts[1]]; } $url=$...
php
function reroute($url=NULL,$permanent=FALSE) { if (!$url) $url=$this->hive['REALM']; if (preg_match('/^(?:@(\w+)(?:(\(.+?)\))*)/',$url,$parts)) { if (empty($this->hive['ALIASES'][$parts[1]])) user_error(sprintf(self::E_Named,$parts[1]),E_USER_ERROR); $url=$this->hive['ALIASES'][$parts[1]]; } $url=$...
[ "function", "reroute", "(", "$", "url", "=", "NULL", ",", "$", "permanent", "=", "FALSE", ")", "{", "if", "(", "!", "$", "url", ")", "$", "url", "=", "$", "this", "->", "hive", "[", "'REALM'", "]", ";", "if", "(", "preg_match", "(", "'/^(?:@(\\w+...
Reroute to specified URI @return NULL @param $url string @param $permanent bool
[ "Reroute", "to", "specified", "URI" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1421-L1442
eghojansu/moe
src/Base.php
Base.map
function map($url,$class,$ttl=0,$kbps=0) { if (is_array($url)) { foreach ($url as $item) $this->map($item,$class,$ttl,$kbps); return; } foreach (explode('|',self::VERBS) as $method) $this->route($method.' '.$url,is_string($class)? $class.'->'.$this->hive['PREMAP'].strtolower($method): array($...
php
function map($url,$class,$ttl=0,$kbps=0) { if (is_array($url)) { foreach ($url as $item) $this->map($item,$class,$ttl,$kbps); return; } foreach (explode('|',self::VERBS) as $method) $this->route($method.' '.$url,is_string($class)? $class.'->'.$this->hive['PREMAP'].strtolower($method): array($...
[ "function", "map", "(", "$", "url", ",", "$", "class", ",", "$", "ttl", "=", "0", ",", "$", "kbps", "=", "0", ")", "{", "if", "(", "is_array", "(", "$", "url", ")", ")", "{", "foreach", "(", "$", "url", "as", "$", "item", ")", "$", "this", ...
Provide ReST interface by mapping HTTP verb to class method @return NULL @param $url string @param $class string|object @param $ttl int @param $kbps int
[ "Provide", "ReST", "interface", "by", "mapping", "HTTP", "verb", "to", "class", "method" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1452-L1463
eghojansu/moe
src/Base.php
Base.mask
function mask($pattern,$url=NULL) { if (!$url) $url=$this->rel($this->hive['URI']); $case=$this->hive['CASELESS']?'i':''; preg_match('/^'. preg_replace('/@(\w+\b)/','(?P<\1>[^\/\?]+)', str_replace('\*','([^\?]+)',preg_quote($pattern,'/'))). '\/?(?:\?.*)?$/'.$case.'um',$url,$args); return $args; }
php
function mask($pattern,$url=NULL) { if (!$url) $url=$this->rel($this->hive['URI']); $case=$this->hive['CASELESS']?'i':''; preg_match('/^'. preg_replace('/@(\w+\b)/','(?P<\1>[^\/\?]+)', str_replace('\*','([^\?]+)',preg_quote($pattern,'/'))). '\/?(?:\?.*)?$/'.$case.'um',$url,$args); return $args; }
[ "function", "mask", "(", "$", "pattern", ",", "$", "url", "=", "NULL", ")", "{", "if", "(", "!", "$", "url", ")", "$", "url", "=", "$", "this", "->", "rel", "(", "$", "this", "->", "hive", "[", "'URI'", "]", ")", ";", "$", "case", "=", "$",...
Applies the specified URL mask and returns parameterized matches @return $args array @param $pattern string @param $url string|NULL
[ "Applies", "the", "specified", "URL", "mask", "and", "returns", "parameterized", "matches" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1512-L1521
eghojansu/moe
src/Base.php
Base.run
function run() { if ($this->blacklisted($this->hive['IP'])) // Spammer detected $this->error(403); if (!$this->hive['ROUTES']) // No routes defined user_error(self::E_Routes,E_USER_ERROR); // Match specific routes first $paths=array(); foreach ($keys=array_keys($this->hive['ROUTES']) as $key) $...
php
function run() { if ($this->blacklisted($this->hive['IP'])) // Spammer detected $this->error(403); if (!$this->hive['ROUTES']) // No routes defined user_error(self::E_Routes,E_USER_ERROR); // Match specific routes first $paths=array(); foreach ($keys=array_keys($this->hive['ROUTES']) as $key) $...
[ "function", "run", "(", ")", "{", "if", "(", "$", "this", "->", "blacklisted", "(", "$", "this", "->", "hive", "[", "'IP'", "]", ")", ")", "// Spammer detected", "$", "this", "->", "error", "(", "403", ")", ";", "if", "(", "!", "$", "this", "->",...
Match routes against incoming URI @return mixed
[ "Match", "routes", "against", "incoming", "URI" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1527-L1684
eghojansu/moe
src/Base.php
Base.send
function send($object, $return = false) { if (is_array($object)) $this->sendJson($object); $content = Silet::instance()->render($object.( (strpos($object, '.')===false?'.silet':''))); if ($return) return $content; echo $content; }
php
function send($object, $return = false) { if (is_array($object)) $this->sendJson($object); $content = Silet::instance()->render($object.( (strpos($object, '.')===false?'.silet':''))); if ($return) return $content; echo $content; }
[ "function", "send", "(", "$", "object", ",", "$", "return", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "object", ")", ")", "$", "this", "->", "sendJson", "(", "$", "object", ")", ";", "$", "content", "=", "Silet", "::", "instance", ...
Send object view or array (as json) @param mixed $object String view or array @param boolean $return wether to return content or not @return string or nothing
[ "Send", "object", "view", "or", "array", "(", "as", "json", ")" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1692-L1703
eghojansu/moe
src/Base.php
Base.parseBody
function parseBody() { $result = array( 'data'=>array(), 'files'=>array(), ); // read incoming data $input = Instance::get('BODY'); // grab multipart boundary from content type header preg_match('/boundary=(.*)$/', $_SERVER['CONTENT_TYPE...
php
function parseBody() { $result = array( 'data'=>array(), 'files'=>array(), ); // read incoming data $input = Instance::get('BODY'); // grab multipart boundary from content type header preg_match('/boundary=(.*)$/', $_SERVER['CONTENT_TYPE...
[ "function", "parseBody", "(", ")", "{", "$", "result", "=", "array", "(", "'data'", "=>", "array", "(", ")", ",", "'files'", "=>", "array", "(", ")", ",", ")", ";", "// read incoming data", "$", "input", "=", "Instance", "::", "get", "(", "'BODY'", "...
Parse body from PUT method @source https://gist.github.com/chlab/4283560 @return array data and files
[ "Parse", "body", "from", "PUT", "method", "@source", "https", ":", "//", "gist", ".", "github", ".", "com", "/", "chlab", "/", "4283560" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1722-L1778