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
inhere/php-librarys
src/DI/ContainerManager.php
ContainerManager.setDefaultGroup
public static function setDefaultGroup($group = 'di') { $group = strtolower(trim($group)); if (!isset(static::$containers[$group])) { static::$containers[$group] = [ 'root' => null, 'children' => [] ]; } static::$defaultGroup ...
php
public static function setDefaultGroup($group = 'di') { $group = strtolower(trim($group)); if (!isset(static::$containers[$group])) { static::$containers[$group] = [ 'root' => null, 'children' => [] ]; } static::$defaultGroup ...
[ "public", "static", "function", "setDefaultGroup", "(", "$", "group", "=", "'di'", ")", "{", "$", "group", "=", "strtolower", "(", "trim", "(", "$", "group", ")", ")", ";", "if", "(", "!", "isset", "(", "static", "::", "$", "containers", "[", "$", ...
setProfile @param string $group @return void
[ "setProfile" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/ContainerManager.php#L78-L90
inhere/php-librarys
src/DI/ContainerManager.php
ContainerManager.get
public static function get($id, $name = '') { $container = self::getContainer($name); return $container->get($id); }
php
public static function get($id, $name = '') { $container = self::getContainer($name); return $container->get($id); }
[ "public", "static", "function", "get", "(", "$", "id", ",", "$", "name", "=", "''", ")", "{", "$", "container", "=", "self", "::", "getContainer", "(", "$", "name", ")", ";", "return", "$", "container", "->", "get", "(", "$", "id", ")", ";", "}" ...
more @see Container::get() @param $id @param string $name 容器名称 @return mixed
[ "more" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/ContainerManager.php#L134-L139
inhere/php-librarys
src/DI/ContainerManager.php
ContainerManager.getNew
public static function getNew($id, $name = '') { $container = self::getContainer($name); return $container->getNew($id); }
php
public static function getNew($id, $name = '') { $container = self::getContainer($name); return $container->getNew($id); }
[ "public", "static", "function", "getNew", "(", "$", "id", ",", "$", "name", "=", "''", ")", "{", "$", "container", "=", "self", "::", "getContainer", "(", "$", "name", ")", ";", "return", "$", "container", "->", "getNew", "(", "$", "id", ")", ";", ...
more @see Container::getNew() @param $id @param string $name @return mixed
[ "more" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/ContainerManager.php#L147-L152
Smile-SA/CronBundle
Repository/SmileCronRepository.php
SmileCronRepository.isQueued
public function isQueued($alias) { $query = $this->createQueryBuilder('c') ->where('c.alias = :alias') ->andWhere('c.ended is NULL') ->setParameter('alias', $alias) ->getQuery(); $result = $query->setMaxResults(1)->getOneOrNullResult(); if ($...
php
public function isQueued($alias) { $query = $this->createQueryBuilder('c') ->where('c.alias = :alias') ->andWhere('c.ended is NULL') ->setParameter('alias', $alias) ->getQuery(); $result = $query->setMaxResults(1)->getOneOrNullResult(); if ($...
[ "public", "function", "isQueued", "(", "$", "alias", ")", "{", "$", "query", "=", "$", "this", "->", "createQueryBuilder", "(", "'c'", ")", "->", "where", "(", "'c.alias = :alias'", ")", "->", "andWhere", "(", "'c.ended is NULL'", ")", "->", "setParameter", ...
Identify of cron command is queued @param string $alias cron alias @return bool true if cron is already queued
[ "Identify", "of", "cron", "command", "is", "queued" ]
train
https://github.com/Smile-SA/CronBundle/blob/3e6d29112915fa957cc04386ba9c6d1fc134d31f/Repository/SmileCronRepository.php#L20-L34
Smile-SA/CronBundle
Repository/SmileCronRepository.php
SmileCronRepository.addQueued
public function addQueued($alias) { $query = $this->createQueryBuilder('c') ->where('c.alias = :alias') ->setParameter('alias', $alias) ->getQuery(); /** @var SmileCron $smileCron */ $smileCron = $query->setMaxResults(1)->getOneOrNullResult(); if...
php
public function addQueued($alias) { $query = $this->createQueryBuilder('c') ->where('c.alias = :alias') ->setParameter('alias', $alias) ->getQuery(); /** @var SmileCron $smileCron */ $smileCron = $query->setMaxResults(1)->getOneOrNullResult(); if...
[ "public", "function", "addQueued", "(", "$", "alias", ")", "{", "$", "query", "=", "$", "this", "->", "createQueryBuilder", "(", "'c'", ")", "->", "where", "(", "'c.alias = :alias'", ")", "->", "setParameter", "(", "'alias'", ",", "$", "alias", ")", "->"...
Add cron to queued @param string $alias cron alias
[ "Add", "cron", "to", "queued" ]
train
https://github.com/Smile-SA/CronBundle/blob/3e6d29112915fa957cc04386ba9c6d1fc134d31f/Repository/SmileCronRepository.php#L41-L64
Smile-SA/CronBundle
Repository/SmileCronRepository.php
SmileCronRepository.run
public function run(SmileCron $smileCron) { $now = new \DateTime('now'); $smileCron->setStarted($now); $this->getEntityManager()->persist($smileCron); $this->getEntityManager()->flush(); }
php
public function run(SmileCron $smileCron) { $now = new \DateTime('now'); $smileCron->setStarted($now); $this->getEntityManager()->persist($smileCron); $this->getEntityManager()->flush(); }
[ "public", "function", "run", "(", "SmileCron", "$", "smileCron", ")", "{", "$", "now", "=", "new", "\\", "DateTime", "(", "'now'", ")", ";", "$", "smileCron", "->", "setStarted", "(", "$", "now", ")", ";", "$", "this", "->", "getEntityManager", "(", ...
Run cron command @param SmileCron $smileCron cron command
[ "Run", "cron", "command" ]
train
https://github.com/Smile-SA/CronBundle/blob/3e6d29112915fa957cc04386ba9c6d1fc134d31f/Repository/SmileCronRepository.php#L86-L92
Smile-SA/CronBundle
Repository/SmileCronRepository.php
SmileCronRepository.end
public function end(SmileCron $smileCron, $status = 0) { $now = new \DateTime('now'); $smileCron->setEnded($now); $smileCron->setStatus($status); $this->getEntityManager()->persist($smileCron); $this->getEntityManager()->flush(); }
php
public function end(SmileCron $smileCron, $status = 0) { $now = new \DateTime('now'); $smileCron->setEnded($now); $smileCron->setStatus($status); $this->getEntityManager()->persist($smileCron); $this->getEntityManager()->flush(); }
[ "public", "function", "end", "(", "SmileCron", "$", "smileCron", ",", "$", "status", "=", "0", ")", "{", "$", "now", "=", "new", "\\", "DateTime", "(", "'now'", ")", ";", "$", "smileCron", "->", "setEnded", "(", "$", "now", ")", ";", "$", "smileCro...
End cron command @param SmileCron $smileCron cron command @param int $status cron command status
[ "End", "cron", "command" ]
train
https://github.com/Smile-SA/CronBundle/blob/3e6d29112915fa957cc04386ba9c6d1fc134d31f/Repository/SmileCronRepository.php#L100-L107
eymengunay/php-keyclient
src/Client.php
Client.createPaymentUrl
public function createPaymentUrl(PaymentRequestInterface $payment) { $params = $payment->toArray(); $params = array_merge($params, array( 'alias' => $this->alias, 'mac' => $this->calculateMac($payment) )); return sprintf('%s?%s', $this->endpoint, http_build...
php
public function createPaymentUrl(PaymentRequestInterface $payment) { $params = $payment->toArray(); $params = array_merge($params, array( 'alias' => $this->alias, 'mac' => $this->calculateMac($payment) )); return sprintf('%s?%s', $this->endpoint, http_build...
[ "public", "function", "createPaymentUrl", "(", "PaymentRequestInterface", "$", "payment", ")", "{", "$", "params", "=", "$", "payment", "->", "toArray", "(", ")", ";", "$", "params", "=", "array_merge", "(", "$", "params", ",", "array", "(", "'alias'", "=>...
Create paymentUrl @param PaymentRequestInterface $payment @return string
[ "Create", "paymentUrl" ]
train
https://github.com/eymengunay/php-keyclient/blob/867e035a2a0707c5df4198a8c321ddfd048a9c56/src/Client.php#L49-L58
eymengunay/php-keyclient
src/Client.php
Client.parsePaymentResponse
public function parsePaymentResponse(Request $request = null) { $response = new PaymentResponse($request); // Verify mac if ($this->verifyMac($response) !== true) { throw new KeyClientException('Mac can not be verified'); } return $response; }
php
public function parsePaymentResponse(Request $request = null) { $response = new PaymentResponse($request); // Verify mac if ($this->verifyMac($response) !== true) { throw new KeyClientException('Mac can not be verified'); } return $response; }
[ "public", "function", "parsePaymentResponse", "(", "Request", "$", "request", "=", "null", ")", "{", "$", "response", "=", "new", "PaymentResponse", "(", "$", "request", ")", ";", "// Verify mac", "if", "(", "$", "this", "->", "verifyMac", "(", "$", "respo...
Parse paymentResponse @param Request $request @return PaymentResponse
[ "Parse", "paymentResponse" ]
train
https://github.com/eymengunay/php-keyclient/blob/867e035a2a0707c5df4198a8c321ddfd048a9c56/src/Client.php#L66-L76
eymengunay/php-keyclient
src/Client.php
Client.calculateMac
public function calculateMac(PaymentRequestInterface $paymentRequest) { $mac = strtr('codTrans={transactionCode}divisa={currency}importo={amount}{secret}', array( '{transactionCode}' => $paymentRequest->get('codTrans'), '{currency}' => $paymentRequest->get('divisa'), ...
php
public function calculateMac(PaymentRequestInterface $paymentRequest) { $mac = strtr('codTrans={transactionCode}divisa={currency}importo={amount}{secret}', array( '{transactionCode}' => $paymentRequest->get('codTrans'), '{currency}' => $paymentRequest->get('divisa'), ...
[ "public", "function", "calculateMac", "(", "PaymentRequestInterface", "$", "paymentRequest", ")", "{", "$", "mac", "=", "strtr", "(", "'codTrans={transactionCode}divisa={currency}importo={amount}{secret}'", ",", "array", "(", "'{transactionCode}'", "=>", "$", "paymentReques...
Calculate mac @param PaymentRequestInterface $paymentRequest @return string
[ "Calculate", "mac" ]
train
https://github.com/eymengunay/php-keyclient/blob/867e035a2a0707c5df4198a8c321ddfd048a9c56/src/Client.php#L84-L94
eymengunay/php-keyclient
src/Client.php
Client.verifyMac
public function verifyMac(PaymentResponseInterface $paymentResponse) { $mac = strtr('codTrans={transactionCode}esito={result}importo={amount}divisa={currency}data={date}orario={time}codAut={authCode}{secret}', array( '{transactionCode}' => $paymentResponse->get('codTrans'), '{result}...
php
public function verifyMac(PaymentResponseInterface $paymentResponse) { $mac = strtr('codTrans={transactionCode}esito={result}importo={amount}divisa={currency}data={date}orario={time}codAut={authCode}{secret}', array( '{transactionCode}' => $paymentResponse->get('codTrans'), '{result}...
[ "public", "function", "verifyMac", "(", "PaymentResponseInterface", "$", "paymentResponse", ")", "{", "$", "mac", "=", "strtr", "(", "'codTrans={transactionCode}esito={result}importo={amount}divisa={currency}data={date}orario={time}codAut={authCode}{secret}'", ",", "array", "(", ...
Verify mac @param PaymentResponseInterface $paymentResponse @return bool
[ "Verify", "mac" ]
train
https://github.com/eymengunay/php-keyclient/blob/867e035a2a0707c5df4198a8c321ddfd048a9c56/src/Client.php#L102-L119
Innmind/neo4j-dbal
src/Transport/Http.php
Http.execute
public function execute(Query $query): Result { $response = ($this->fulfill)( ($this->translate)($query) ); if (!$this->isSuccessful($response)) { throw new QueryFailed($query, $response); } $response = Json::decode((string) $response->body()); ...
php
public function execute(Query $query): Result { $response = ($this->fulfill)( ($this->translate)($query) ); if (!$this->isSuccessful($response)) { throw new QueryFailed($query, $response); } $response = Json::decode((string) $response->body()); ...
[ "public", "function", "execute", "(", "Query", "$", "query", ")", ":", "Result", "{", "$", "response", "=", "(", "$", "this", "->", "fulfill", ")", "(", "(", "$", "this", "->", "translate", ")", "(", "$", "query", ")", ")", ";", "if", "(", "!", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Transport/Http.php#L40-L54
Innmind/neo4j-dbal
src/Transport/Http.php
Http.ping
public function ping(): Transport { try { $code = ($this->fulfill) ( new Request( Url::fromString('/'), Method::options(), new ProtocolVersion(1, 1) ) )...
php
public function ping(): Transport { try { $code = ($this->fulfill) ( new Request( Url::fromString('/'), Method::options(), new ProtocolVersion(1, 1) ) )...
[ "public", "function", "ping", "(", ")", ":", "Transport", "{", "try", "{", "$", "code", "=", "(", "$", "this", "->", "fulfill", ")", "(", "new", "Request", "(", "Url", "::", "fromString", "(", "'/'", ")", ",", "Method", "::", "options", "(", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Transport/Http.php#L59-L85
Innmind/neo4j-dbal
src/Transport/Http.php
Http.isSuccessful
private function isSuccessful(Response $response): bool { if ($response->statusCode()->value() !== 200) { return false; } $json = Json::decode((string) $response->body()); return count($json['errors']) === 0; }
php
private function isSuccessful(Response $response): bool { if ($response->statusCode()->value() !== 200) { return false; } $json = Json::decode((string) $response->body()); return count($json['errors']) === 0; }
[ "private", "function", "isSuccessful", "(", "Response", "$", "response", ")", ":", "bool", "{", "if", "(", "$", "response", "->", "statusCode", "(", ")", "->", "value", "(", ")", "!==", "200", ")", "{", "return", "false", ";", "}", "$", "json", "=", ...
Check if the response is successful @param Response $response @return bool
[ "Check", "if", "the", "response", "is", "successful" ]
train
https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Transport/Http.php#L94-L103
HedronDev/hedron
src/Parser/ComposerWP.php
ComposerWP.parse
public function parse(GitPostReceiveHandler $handler, CommandStackInterface $commandStack) { $commands = []; $git_directory = $this->getGitDirectoryPath(); $site_directory = $this->getDataDirectoryPath(); $composer_file = "$site_directory/composer.json"; $git_composer = "$git_directory/composer.json...
php
public function parse(GitPostReceiveHandler $handler, CommandStackInterface $commandStack) { $commands = []; $git_directory = $this->getGitDirectoryPath(); $site_directory = $this->getDataDirectoryPath(); $composer_file = "$site_directory/composer.json"; $git_composer = "$git_directory/composer.json...
[ "public", "function", "parse", "(", "GitPostReceiveHandler", "$", "handler", ",", "CommandStackInterface", "$", "commandStack", ")", "{", "$", "commands", "=", "[", "]", ";", "$", "git_directory", "=", "$", "this", "->", "getGitDirectoryPath", "(", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/HedronDev/hedron/blob/3b4adec4912f2d7c0b7e7262dc36515fbc2e8e00/src/Parser/ComposerWP.php#L24-L74
FriendsOfApi/phraseapp
src/Api/Locale.php
Locale.download
public function download(string $projectKey, string $localeId, string $ext, array $params = []) { $params['file_format'] = $ext; $response = $this->httpGet(sprintf('/api/v2/projects/%s/locales/%s/download', $projectKey, $localeId), $params); if (!$this->hydrator) { return $resp...
php
public function download(string $projectKey, string $localeId, string $ext, array $params = []) { $params['file_format'] = $ext; $response = $this->httpGet(sprintf('/api/v2/projects/%s/locales/%s/download', $projectKey, $localeId), $params); if (!$this->hydrator) { return $resp...
[ "public", "function", "download", "(", "string", "$", "projectKey", ",", "string", "$", "localeId", ",", "string", "$", "ext", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "params", "[", "'file_format'", "]", "=", "$", "ext", ";", "$", ...
Download a locale. @param string $projectKey @param string $localeId @param string $ext @param array $params @throws Exception @return string|ResponseInterface
[ "Download", "a", "locale", "." ]
train
https://github.com/FriendsOfApi/phraseapp/blob/1553bf857eb0858f9a7eb905b085864d24f80886/src/Api/Locale.php#L32-L47
Eresus/EresusCMS
src/core/Client/Controller/Content/List.php
Eresus_Client_Controller_Content_List.getHtml
public function getHtml(Eresus_CMS_Request $request, TClientUI $page) { $legacyKernel = Eresus_CMS::getLegacyKernel(); /* Если в URL указано что-либо кроме адреса раздела, отправляет ответ 404 */ if ($legacyKernel->request['file'] || $legacyKernel->request['query'] ||...
php
public function getHtml(Eresus_CMS_Request $request, TClientUI $page) { $legacyKernel = Eresus_CMS::getLegacyKernel(); /* Если в URL указано что-либо кроме адреса раздела, отправляет ответ 404 */ if ($legacyKernel->request['file'] || $legacyKernel->request['query'] ||...
[ "public", "function", "getHtml", "(", "Eresus_CMS_Request", "$", "request", ",", "TClientUI", "$", "page", ")", "{", "$", "legacyKernel", "=", "Eresus_CMS", "::", "getLegacyKernel", "(", ")", ";", "/* Если в URL указано что-либо кроме адреса раздела, отправляет ответ 404 ...
Возвращает разметку области контента @param Eresus_CMS_Request $request @param TClientUI $page @throws Eresus_CMS_Exception_NotFound @return string|Eresus_HTTP_Response @since 3.01
[ "Возвращает", "разметку", "области", "контента" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Client/Controller/Content/List.php#L47-L102
weew/http
src/Weew/Http/ReceivedRequestParser.php
ReceivedRequestParser.parseRequest
public function parseRequest(array $server, IHttpRequest $request = null) { if ( ! $request instanceof IHttpRequest) { $request = $this->createRequest(); } $this->setMethod($request, $server); $this->setUrl($request, $server); $this->setHeaders($request, $server); ...
php
public function parseRequest(array $server, IHttpRequest $request = null) { if ( ! $request instanceof IHttpRequest) { $request = $this->createRequest(); } $this->setMethod($request, $server); $this->setUrl($request, $server); $this->setHeaders($request, $server); ...
[ "public", "function", "parseRequest", "(", "array", "$", "server", ",", "IHttpRequest", "$", "request", "=", "null", ")", "{", "if", "(", "!", "$", "request", "instanceof", "IHttpRequest", ")", "{", "$", "request", "=", "$", "this", "->", "createRequest", ...
@param array $server @param IHttpRequest $request @return IHttpRequest
[ "@param", "array", "$server", "@param", "IHttpRequest", "$request" ]
train
https://github.com/weew/http/blob/fd34d3d5643ca01c8e0946e888224a8e8dcc3c0d/src/Weew/Http/ReceivedRequestParser.php#L14-L27
weew/http
src/Weew/Http/ReceivedRequestParser.php
ReceivedRequestParser.parseMethod
public function parseMethod(array $server) { $method = array_get($server, 'REQUEST_METHOD'); if (array_has($server, '_method')) { $_method = strtoupper(array_get($server, '_method')); if (array_contains(HttpRequestMethod::getMethods(), $_method)) { return $_meth...
php
public function parseMethod(array $server) { $method = array_get($server, 'REQUEST_METHOD'); if (array_has($server, '_method')) { $_method = strtoupper(array_get($server, '_method')); if (array_contains(HttpRequestMethod::getMethods(), $_method)) { return $_meth...
[ "public", "function", "parseMethod", "(", "array", "$", "server", ")", "{", "$", "method", "=", "array_get", "(", "$", "server", ",", "'REQUEST_METHOD'", ")", ";", "if", "(", "array_has", "(", "$", "server", ",", "'_method'", ")", ")", "{", "$", "_meth...
@param array $server @return mixed
[ "@param", "array", "$server" ]
train
https://github.com/weew/http/blob/fd34d3d5643ca01c8e0946e888224a8e8dcc3c0d/src/Weew/Http/ReceivedRequestParser.php#L43-L55
weew/http
src/Weew/Http/ReceivedRequestParser.php
ReceivedRequestParser.parseUrl
public function parseUrl(array $server) { $protocol = array_has($server, 'HTTPS') ? 'https' : 'http'; $host = array_get($server, 'HTTP_HOST'); $uri = array_get($server, 'REQUEST_URI'); return new Url(s('%s://%s%s', $protocol, $host, $uri)); }
php
public function parseUrl(array $server) { $protocol = array_has($server, 'HTTPS') ? 'https' : 'http'; $host = array_get($server, 'HTTP_HOST'); $uri = array_get($server, 'REQUEST_URI'); return new Url(s('%s://%s%s', $protocol, $host, $uri)); }
[ "public", "function", "parseUrl", "(", "array", "$", "server", ")", "{", "$", "protocol", "=", "array_has", "(", "$", "server", ",", "'HTTPS'", ")", "?", "'https'", ":", "'http'", ";", "$", "host", "=", "array_get", "(", "$", "server", ",", "'HTTP_HOST...
@param array $server @return Url
[ "@param", "array", "$server" ]
train
https://github.com/weew/http/blob/fd34d3d5643ca01c8e0946e888224a8e8dcc3c0d/src/Weew/Http/ReceivedRequestParser.php#L62-L68
yireo-training/magento2-example-cms-block
Model/Config/Source/Block.php
Block.toOptionArray
public function toOptionArray(): array { if (empty($this->options)) { $this->options[] = array( 'value' => '', 'label' => __('Pick a CMS block'), ); $collection = $this->collectionFactory->create(); foreach ($collection as $i...
php
public function toOptionArray(): array { if (empty($this->options)) { $this->options[] = array( 'value' => '', 'label' => __('Pick a CMS block'), ); $collection = $this->collectionFactory->create(); foreach ($collection as $i...
[ "public", "function", "toOptionArray", "(", ")", ":", "array", "{", "if", "(", "empty", "(", "$", "this", "->", "options", ")", ")", "{", "$", "this", "->", "options", "[", "]", "=", "array", "(", "'value'", "=>", "''", ",", "'label'", "=>", "__", ...
To option array @return array
[ "To", "option", "array" ]
train
https://github.com/yireo-training/magento2-example-cms-block/blob/db97fff488a92ee25acf83ae2ec56c9c635a4272/Model/Config/Source/Block.php#L36-L56
gordalina/mangopay-php
src/Gordalina/Mangopay/Request/Wallet/ListWalletUsers.php
ListWalletUsers.getPath
public function getPath() { $path = sprintf('/wallets/%s/users', $this->id); if ($this->include) { return sprintf('%s?include=%s', $path, $this->include); } return $path; }
php
public function getPath() { $path = sprintf('/wallets/%s/users', $this->id); if ($this->include) { return sprintf('%s?include=%s', $path, $this->include); } return $path; }
[ "public", "function", "getPath", "(", ")", "{", "$", "path", "=", "sprintf", "(", "'/wallets/%s/users'", ",", "$", "this", "->", "id", ")", ";", "if", "(", "$", "this", "->", "include", ")", "{", "return", "sprintf", "(", "'%s?include=%s'", ",", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/gordalina/mangopay-php/blob/6807992416d964e25670d961b66dbccd7a46ef62/src/Gordalina/Mangopay/Request/Wallet/ListWalletUsers.php#L46-L55
kbond/ControllerUtil
src/View.php
View.createCached
public static function createCached($data, $sharedMaxAge, $statusCode = self::DEFAULT_STATUS_CODE) { return new static($data, $statusCode, null, array('s_maxage' => $sharedMaxAge)); }
php
public static function createCached($data, $sharedMaxAge, $statusCode = self::DEFAULT_STATUS_CODE) { return new static($data, $statusCode, null, array('s_maxage' => $sharedMaxAge)); }
[ "public", "static", "function", "createCached", "(", "$", "data", ",", "$", "sharedMaxAge", ",", "$", "statusCode", "=", "self", "::", "DEFAULT_STATUS_CODE", ")", "{", "return", "new", "static", "(", "$", "data", ",", "$", "statusCode", ",", "null", ",", ...
@param mixed $data @param int $sharedMaxAge @param int $statusCode @return static
[ "@param", "mixed", "$data", "@param", "int", "$sharedMaxAge", "@param", "int", "$statusCode" ]
train
https://github.com/kbond/ControllerUtil/blob/67375d43c73d6a3f16356f3d683f62b176766e91/src/View.php#L25-L28
kbond/ControllerUtil
src/View.php
View.getDataAsArray
public function getDataAsArray($key = 'data') { $data = $this->getData(); if (null === $data) { return array(); } if (!is_array($data)) { $data = array($key => $data); } return $data; }
php
public function getDataAsArray($key = 'data') { $data = $this->getData(); if (null === $data) { return array(); } if (!is_array($data)) { $data = array($key => $data); } return $data; }
[ "public", "function", "getDataAsArray", "(", "$", "key", "=", "'data'", ")", "{", "$", "data", "=", "$", "this", "->", "getData", "(", ")", ";", "if", "(", "null", "===", "$", "data", ")", "{", "return", "array", "(", ")", ";", "}", "if", "(", ...
@param string $key The key to use when creating array if data isn't already an array @return array
[ "@param", "string", "$key", "The", "key", "to", "use", "when", "creating", "array", "if", "data", "isn", "t", "already", "an", "array" ]
train
https://github.com/kbond/ControllerUtil/blob/67375d43c73d6a3f16356f3d683f62b176766e91/src/View.php#L64-L77
thienhungho/yii2-product-management
src/modules/ProductBase/Product.php
Product.beforeSave
public function beforeSave($insert) { if (parent::beforeSave($insert)) { $feature_img = upload_img('Product[feature_img]'); if (!empty($feature_img)) { $this->feature_img = $feature_img; } elseif(empty($feature_img) && !$this->isNewRecord) { ...
php
public function beforeSave($insert) { if (parent::beforeSave($insert)) { $feature_img = upload_img('Product[feature_img]'); if (!empty($feature_img)) { $this->feature_img = $feature_img; } elseif(empty($feature_img) && !$this->isNewRecord) { ...
[ "public", "function", "beforeSave", "(", "$", "insert", ")", "{", "if", "(", "parent", "::", "beforeSave", "(", "$", "insert", ")", ")", "{", "$", "feature_img", "=", "upload_img", "(", "'Product[feature_img]'", ")", ";", "if", "(", "!", "empty", "(", ...
@param bool $insert @return bool @throws \yii\base\Exception @throws \yii\base\InvalidConfigException
[ "@param", "bool", "$insert" ]
train
https://github.com/thienhungho/yii2-product-management/blob/72e1237bba123faf671e44491bd93077b50adde9/src/modules/ProductBase/Product.php#L72-L99
mainio/c5pkg_symfony_forms
src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/DateTimeSelectorType.php
DateTimeSelectorType.buildView
public function buildView(FormView $view, FormInterface $form, array $options) { $dh = \Core::make('helper/form/date_time'); $name = $view->vars["full_name"]; $prefix = substr($name, 0, strlen($name)-1); $selector = $dh->datetime($name, $view->vars["value"]); // Change the...
php
public function buildView(FormView $view, FormInterface $form, array $options) { $dh = \Core::make('helper/form/date_time'); $name = $view->vars["full_name"]; $prefix = substr($name, 0, strlen($name)-1); $selector = $dh->datetime($name, $view->vars["value"]); // Change the...
[ "public", "function", "buildView", "(", "FormView", "$", "view", ",", "FormInterface", "$", "form", ",", "array", "$", "options", ")", "{", "$", "dh", "=", "\\", "Core", "::", "make", "(", "'helper/form/date_time'", ")", ";", "$", "name", "=", "$", "vi...
{@inheritdoc}
[ "{" ]
train
https://github.com/mainio/c5pkg_symfony_forms/blob/41a93c293d986574ec5cade8a7c8700e083dbaaa/src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/DateTimeSelectorType.php#L36-L54
ekuiter/feature-php
FeaturePhp/Generator/CopyGenerator.php
CopyGenerator.processFileSpecification
protected function processFileSpecification($artifact, $fileSpecification) { $this->files[] = fphp\File\StoredFile::fromSpecification($fileSpecification); $this->tracingLinks[] = new fphp\Artifact\TracingLink( "file", $artifact, $fileSpecification->getSourcePlace(), $fileSpecification->getTa...
php
protected function processFileSpecification($artifact, $fileSpecification) { $this->files[] = fphp\File\StoredFile::fromSpecification($fileSpecification); $this->tracingLinks[] = new fphp\Artifact\TracingLink( "file", $artifact, $fileSpecification->getSourcePlace(), $fileSpecification->getTa...
[ "protected", "function", "processFileSpecification", "(", "$", "artifact", ",", "$", "fileSpecification", ")", "{", "$", "this", "->", "files", "[", "]", "=", "fphp", "\\", "File", "\\", "StoredFile", "::", "fromSpecification", "(", "$", "fileSpecification", "...
Adds a stored file from a specification. Considers globally excluded files. Only exact file names are supported. @param \FeaturePhp\Artifact\Artifact $artifact @param \FeaturePhp\Specification\FileSpecification $fileSpecification
[ "Adds", "a", "stored", "file", "from", "a", "specification", ".", "Considers", "globally", "excluded", "files", ".", "Only", "exact", "file", "names", "are", "supported", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Generator/CopyGenerator.php#L34-L39
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.getType
public function getType($name) { if (!is_string($name)) { throw new Exception\UnexpectedTypeException($name, 'string'); } if (isset($this->types[$name])) { return $this->types[$name]; } $type = null; $extensions = $this->getExtensions(); ...
php
public function getType($name) { if (!is_string($name)) { throw new Exception\UnexpectedTypeException($name, 'string'); } if (isset($this->types[$name])) { return $this->types[$name]; } $type = null; $extensions = $this->getExtensions(); ...
[ "public", "function", "getType", "(", "$", "name", ")", "{", "if", "(", "!", "is_string", "(", "$", "name", ")", ")", "{", "throw", "new", "Exception", "\\", "UnexpectedTypeException", "(", "$", "name", ",", "'string'", ")", ";", "}", "if", "(", "iss...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L29-L54
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.getTypeExtensions
public function getTypeExtensions($name) { return isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); }
php
public function getTypeExtensions($name) { return isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); }
[ "public", "function", "getTypeExtensions", "(", "$", "name", ")", "{", "return", "isset", "(", "$", "this", "->", "typeExtensions", "[", "$", "name", "]", ")", "?", "$", "this", "->", "typeExtensions", "[", "$", "name", "]", ":", "$", "this", "->", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L59-L64
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.getContextConfigurators
public function getContextConfigurators() { $configurators = []; $extensions = $this->getExtensions(); foreach ($extensions as $extension) { if ($extension->hasContextConfigurators()) { $configurators = array_merge($configurators, $extension->getContextConfigurat...
php
public function getContextConfigurators() { $configurators = []; $extensions = $this->getExtensions(); foreach ($extensions as $extension) { if ($extension->hasContextConfigurators()) { $configurators = array_merge($configurators, $extension->getContextConfigurat...
[ "public", "function", "getContextConfigurators", "(", ")", "{", "$", "configurators", "=", "[", "]", ";", "$", "extensions", "=", "$", "this", "->", "getExtensions", "(", ")", ";", "foreach", "(", "$", "extensions", "as", "$", "extension", ")", "{", "if"...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L69-L81
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.findDataProvider
public function findDataProvider($name) { if (!is_string($name)) { throw new Exception\UnexpectedTypeException($name, 'string'); } if (isset($this->dataProviders[$name])) { return $this->dataProviders[$name]; } $dataProvider = null; $extensi...
php
public function findDataProvider($name) { if (!is_string($name)) { throw new Exception\UnexpectedTypeException($name, 'string'); } if (isset($this->dataProviders[$name])) { return $this->dataProviders[$name]; } $dataProvider = null; $extensi...
[ "public", "function", "findDataProvider", "(", "$", "name", ")", "{", "if", "(", "!", "is_string", "(", "$", "name", ")", ")", "{", "throw", "new", "Exception", "\\", "UnexpectedTypeException", "(", "$", "name", ",", "'string'", ")", ";", "}", "if", "(...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L86-L108
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.configureOptions
public function configureOptions($name, OptionsResolver $resolver) { $extensions = isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); foreach ($extensions as $extension) { $extension->configureOptions($resolver)...
php
public function configureOptions($name, OptionsResolver $resolver) { $extensions = isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); foreach ($extensions as $extension) { $extension->configureOptions($resolver)...
[ "public", "function", "configureOptions", "(", "$", "name", ",", "OptionsResolver", "$", "resolver", ")", "{", "$", "extensions", "=", "isset", "(", "$", "this", "->", "typeExtensions", "[", "$", "name", "]", ")", "?", "$", "this", "->", "typeExtensions", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L113-L122
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.buildBlock
public function buildBlock($name, BlockBuilderInterface $builder, Options $options) { $extensions = isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); foreach ($extensions as $extension) { $extension->buildBlock...
php
public function buildBlock($name, BlockBuilderInterface $builder, Options $options) { $extensions = isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); foreach ($extensions as $extension) { $extension->buildBlock...
[ "public", "function", "buildBlock", "(", "$", "name", ",", "BlockBuilderInterface", "$", "builder", ",", "Options", "$", "options", ")", "{", "$", "extensions", "=", "isset", "(", "$", "this", "->", "typeExtensions", "[", "$", "name", "]", ")", "?", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L127-L136
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.buildView
public function buildView($name, BlockView $view, BlockInterface $block, Options $options) { $extensions = isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); foreach ($extensions as $extension) { $extension->bui...
php
public function buildView($name, BlockView $view, BlockInterface $block, Options $options) { $extensions = isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); foreach ($extensions as $extension) { $extension->bui...
[ "public", "function", "buildView", "(", "$", "name", ",", "BlockView", "$", "view", ",", "BlockInterface", "$", "block", ",", "Options", "$", "options", ")", "{", "$", "extensions", "=", "isset", "(", "$", "this", "->", "typeExtensions", "[", "$", "name"...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L141-L150
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.finishView
public function finishView($name, BlockView $view, BlockInterface $block) { $extensions = isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); foreach ($extensions as $extension) { $extension->finishView($view, $b...
php
public function finishView($name, BlockView $view, BlockInterface $block) { $extensions = isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : $this->loadTypeExtensions($name); foreach ($extensions as $extension) { $extension->finishView($view, $b...
[ "public", "function", "finishView", "(", "$", "name", ",", "BlockView", "$", "view", ",", "BlockInterface", "$", "block", ")", "{", "$", "extensions", "=", "isset", "(", "$", "this", "->", "typeExtensions", "[", "$", "name", "]", ")", "?", "$", "this",...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L155-L164
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.updateLayout
public function updateLayout($id, LayoutManipulatorInterface $layoutManipulator, LayoutItemInterface $item) { $extensions = $this->getExtensions(); foreach ($extensions as $extension) { if ($extension->hasLayoutUpdates($item)) { $layoutUpdates = $extension->getLayoutUpdat...
php
public function updateLayout($id, LayoutManipulatorInterface $layoutManipulator, LayoutItemInterface $item) { $extensions = $this->getExtensions(); foreach ($extensions as $extension) { if ($extension->hasLayoutUpdates($item)) { $layoutUpdates = $extension->getLayoutUpdat...
[ "public", "function", "updateLayout", "(", "$", "id", ",", "LayoutManipulatorInterface", "$", "layoutManipulator", ",", "LayoutItemInterface", "$", "item", ")", "{", "$", "extensions", "=", "$", "this", "->", "getExtensions", "(", ")", ";", "foreach", "(", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L169-L180
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.configureContext
public function configureContext(ContextInterface $context) { $extensions = $this->getExtensions(); foreach ($extensions as $extension) { if ($extension->hasContextConfigurators()) { $configurators = $extension->getContextConfigurators(); foreach ($configu...
php
public function configureContext(ContextInterface $context) { $extensions = $this->getExtensions(); foreach ($extensions as $extension) { if ($extension->hasContextConfigurators()) { $configurators = $extension->getContextConfigurators(); foreach ($configu...
[ "public", "function", "configureContext", "(", "ContextInterface", "$", "context", ")", "{", "$", "extensions", "=", "$", "this", "->", "getExtensions", "(", ")", ";", "foreach", "(", "$", "extensions", "as", "$", "extension", ")", "{", "if", "(", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L185-L196
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.addExtension
public function addExtension(ExtensionInterface $extension, $priority = 0) { $this->extensions[$priority][] = $extension; $this->sorted = null; $this->typeExtensions = []; }
php
public function addExtension(ExtensionInterface $extension, $priority = 0) { $this->extensions[$priority][] = $extension; $this->sorted = null; $this->typeExtensions = []; }
[ "public", "function", "addExtension", "(", "ExtensionInterface", "$", "extension", ",", "$", "priority", "=", "0", ")", "{", "$", "this", "->", "extensions", "[", "$", "priority", "]", "[", "]", "=", "$", "extension", ";", "$", "this", "->", "sorted", ...
Registers an layout extension. @param ExtensionInterface $extension @param int $priority
[ "Registers", "an", "layout", "extension", "." ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L204-L209
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.getExtensions
protected function getExtensions() { if (null === $this->sorted) { ksort($this->extensions); $this->sorted = !empty($this->extensions) ? call_user_func_array('array_merge', $this->extensions) : []; } return $this->sorted; }
php
protected function getExtensions() { if (null === $this->sorted) { ksort($this->extensions); $this->sorted = !empty($this->extensions) ? call_user_func_array('array_merge', $this->extensions) : []; } return $this->sorted; }
[ "protected", "function", "getExtensions", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "sorted", ")", "{", "ksort", "(", "$", "this", "->", "extensions", ")", ";", "$", "this", "->", "sorted", "=", "!", "empty", "(", "$", "this", "->...
Returns all registered extensions sorted by priority. @return ExtensionInterface[]
[ "Returns", "all", "registered", "extensions", "sorted", "by", "priority", "." ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L216-L226
oroinc/OroLayoutComponent
LayoutRegistry.php
LayoutRegistry.loadTypeExtensions
protected function loadTypeExtensions($name) { $typeExtensions = []; $extensions = $this->getExtensions(); foreach ($extensions as $extension) { if ($extension->hasTypeExtensions($name)) { $typeExtensions = array_merge($typeExtensions, $extension->getTypeExtensio...
php
protected function loadTypeExtensions($name) { $typeExtensions = []; $extensions = $this->getExtensions(); foreach ($extensions as $extension) { if ($extension->hasTypeExtensions($name)) { $typeExtensions = array_merge($typeExtensions, $extension->getTypeExtensio...
[ "protected", "function", "loadTypeExtensions", "(", "$", "name", ")", "{", "$", "typeExtensions", "=", "[", "]", ";", "$", "extensions", "=", "$", "this", "->", "getExtensions", "(", ")", ";", "foreach", "(", "$", "extensions", "as", "$", "extension", ")...
@param string $name @return BlockTypeExtensionInterface[]
[ "@param", "string", "$name" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRegistry.php#L233-L246
ekuiter/feature-php
FeaturePhp/Helper/_String.php
_String.truncate
public static function truncate($text, $chars = 60) { if (!$text) return $text; $lines = explode("\n", $text); foreach ($lines as &$line) $line = trim($line); $text = implode(" ", $lines); if (strlen($text) <= $chars) return $text; ...
php
public static function truncate($text, $chars = 60) { if (!$text) return $text; $lines = explode("\n", $text); foreach ($lines as &$line) $line = trim($line); $text = implode(" ", $lines); if (strlen($text) <= $chars) return $text; ...
[ "public", "static", "function", "truncate", "(", "$", "text", ",", "$", "chars", "=", "60", ")", "{", "if", "(", "!", "$", "text", ")", "return", "$", "text", ";", "$", "lines", "=", "explode", "(", "\"\\n\"", ",", "$", "text", ")", ";", "foreach...
Truncates a multi-line string. Appends an ellipsis (see {@see https://stackoverflow.com/q/9219795}). @param string $text @param int $chars @return string
[ "Truncates", "a", "multi", "-", "line", "string", ".", "Appends", "an", "ellipsis", "(", "see", "{" ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Helper/_String.php#L21-L37
ekuiter/feature-php
FeaturePhp/Helper/_String.php
_String.getMaxLength
public static function getMaxLength($array, $key) { $maxLen = 0; foreach ($array as $element) { $str = call_user_func(array($element, $key)); $maxLen = strlen($str) > $maxLen ? strlen($str) : $maxLen; } return $maxLen; }
php
public static function getMaxLength($array, $key) { $maxLen = 0; foreach ($array as $element) { $str = call_user_func(array($element, $key)); $maxLen = strlen($str) > $maxLen ? strlen($str) : $maxLen; } return $maxLen; }
[ "public", "static", "function", "getMaxLength", "(", "$", "array", ",", "$", "key", ")", "{", "$", "maxLen", "=", "0", ";", "foreach", "(", "$", "array", "as", "$", "element", ")", "{", "$", "str", "=", "call_user_func", "(", "array", "(", "$", "el...
Returns the maximum member length of an array of objects. @param array $array @param callable $key @return int
[ "Returns", "the", "maximum", "member", "length", "of", "an", "array", "of", "objects", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Helper/_String.php#L45-L52
qlake/framework
src/Qlake/Config/Config.php
Config.aliases
public function aliases(array $aliases = null) { if (is_null($aliases)) { return $this->aliases; } else { $this->aliases = array_merge($this->aliases, $aliases); } }
php
public function aliases(array $aliases = null) { if (is_null($aliases)) { return $this->aliases; } else { $this->aliases = array_merge($this->aliases, $aliases); } }
[ "public", "function", "aliases", "(", "array", "$", "aliases", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "aliases", ")", ")", "{", "return", "$", "this", "->", "aliases", ";", "}", "else", "{", "$", "this", "->", "aliases", "=", "array...
Set or get config aliases @param array $aliases @return array|null
[ "Set", "or", "get", "config", "aliases" ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Config/Config.php#L48-L58
qlake/framework
src/Qlake/Config/Config.php
Config.alias
public function alias($alias, $path = null) { if (is_null($path)) { return $this->aliases[$alias] ?: null; } else { $this->aliases[$alias] = $path; } }
php
public function alias($alias, $path = null) { if (is_null($path)) { return $this->aliases[$alias] ?: null; } else { $this->aliases[$alias] = $path; } }
[ "public", "function", "alias", "(", "$", "alias", ",", "$", "path", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "path", ")", ")", "{", "return", "$", "this", "->", "aliases", "[", "$", "alias", "]", "?", ":", "null", ";", "}", "else"...
Set or get a config alias @param string $alias @param string $path @return string|null
[ "Set", "or", "get", "a", "config", "alias" ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Config/Config.php#L68-L78
qlake/framework
src/Qlake/Config/Config.php
Config.loadConfig
protected function loadConfig($alias, $configName) { if (isset($this->aliases[$alias])) { $aliasPath = $this->aliases[$alias]; } else { throw new ClearException("Config Alias [$alias] Not Found.", 4); } $file = $aliasPath . $configName . '.php'; if (is_file($file)) { return $this->configs[...
php
protected function loadConfig($alias, $configName) { if (isset($this->aliases[$alias])) { $aliasPath = $this->aliases[$alias]; } else { throw new ClearException("Config Alias [$alias] Not Found.", 4); } $file = $aliasPath . $configName . '.php'; if (is_file($file)) { return $this->configs[...
[ "protected", "function", "loadConfig", "(", "$", "alias", ",", "$", "configName", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "aliases", "[", "$", "alias", "]", ")", ")", "{", "$", "aliasPath", "=", "$", "this", "->", "aliases", "[", "$",...
Open and load configs from a file @param string $alias @param string $configName @return array
[ "Open", "and", "load", "configs", "from", "a", "file" ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Config/Config.php#L111-L130
qlake/framework
src/Qlake/Config/Config.php
Config.get
public function get($mixedKey, $default = null) { list($alias, $configName, $key) = $this->parseKey($mixedKey); if (is_null($key)) { return $this->configs[$alias][$configName] ?: $this->loadConfig($alias, $configName) ?: $default; } return $this->configs[$alias][$configName][$key] ?: $this->loadConfig($...
php
public function get($mixedKey, $default = null) { list($alias, $configName, $key) = $this->parseKey($mixedKey); if (is_null($key)) { return $this->configs[$alias][$configName] ?: $this->loadConfig($alias, $configName) ?: $default; } return $this->configs[$alias][$configName][$key] ?: $this->loadConfig($...
[ "public", "function", "get", "(", "$", "mixedKey", ",", "$", "default", "=", "null", ")", "{", "list", "(", "$", "alias", ",", "$", "configName", ",", "$", "key", ")", "=", "$", "this", "->", "parseKey", "(", "$", "mixedKey", ")", ";", "if", "(",...
Get a config @param string $mixedKey May be a key or a config file name @param mixed $default @return array|mixed
[ "Get", "a", "config" ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Config/Config.php#L140-L150
qlake/framework
src/Qlake/Config/Config.php
Config.set
public function set($mixedKey, $value) { list($alias, $configName, $key) = $this->parseKey($mixedKey); if (is_null($key)) { $this->configs[$alias][$configName] = $value; } $this->configs[$alias][$configName][$key] = $value; }
php
public function set($mixedKey, $value) { list($alias, $configName, $key) = $this->parseKey($mixedKey); if (is_null($key)) { $this->configs[$alias][$configName] = $value; } $this->configs[$alias][$configName][$key] = $value; }
[ "public", "function", "set", "(", "$", "mixedKey", ",", "$", "value", ")", "{", "list", "(", "$", "alias", ",", "$", "configName", ",", "$", "key", ")", "=", "$", "this", "->", "parseKey", "(", "$", "mixedKey", ")", ";", "if", "(", "is_null", "("...
Set a config @param string $mixedKey May be a key or a config file name @param mixed $value @return array|mixed
[ "Set", "a", "config" ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Config/Config.php#L160-L170
qlake/framework
src/Qlake/Config/Config.php
Config.parseKey
protected function parseKey($mixedKey) { if (preg_match('/^((?P<alias>[\w]+)::)?(?P<name>\w+)(\.(?P<key>\w+))?$/', $mixedKey, $matches) !==1) { throw new ClearException("Invalid Config Variable Name. Name Must Be Like [alias::name.key] Or [name.key].", 4); } $alias = $matches['alias']; $name = $matches[...
php
protected function parseKey($mixedKey) { if (preg_match('/^((?P<alias>[\w]+)::)?(?P<name>\w+)(\.(?P<key>\w+))?$/', $mixedKey, $matches) !==1) { throw new ClearException("Invalid Config Variable Name. Name Must Be Like [alias::name.key] Or [name.key].", 4); } $alias = $matches['alias']; $name = $matches[...
[ "protected", "function", "parseKey", "(", "$", "mixedKey", ")", "{", "if", "(", "preg_match", "(", "'/^((?P<alias>[\\w]+)::)?(?P<name>\\w+)(\\.(?P<key>\\w+))?$/'", ",", "$", "mixedKey", ",", "$", "matches", ")", "!==", "1", ")", "{", "throw", "new", "ClearExceptio...
Parse requested mixed-key and split alias, name and key @param string $mixedKey @return array An array like [alias, name, key]
[ "Parse", "requested", "mixed", "-", "key", "and", "split", "alias", "name", "and", "key" ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Config/Config.php#L179-L191
42mate/towel
src/Towel/BaseApp.php
BaseApp.db
public function db($database = null) { if (empty($database)) { $database = $this->database; } return $this->silex['dbs'][$database]; }
php
public function db($database = null) { if (empty($database)) { $database = $this->database; } return $this->silex['dbs'][$database]; }
[ "public", "function", "db", "(", "$", "database", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "database", ")", ")", "{", "$", "database", "=", "$", "this", "->", "database", ";", "}", "return", "$", "this", "->", "silex", "[", "'dbs'", "...
Gets dbal engine. @param string $database : Database to use, check config to see available sources. default is the default source. @return \Doctrine\DBAL\Connection
[ "Gets", "dbal", "engine", "." ]
train
https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/BaseApp.php#L55-L61
42mate/towel
src/Towel/BaseApp.php
BaseApp.getCurrentUser
public function getCurrentUser() { if (Towel::isCli()) { return false; //Cli is not logged. } $userRecord = $this->session()->get('user', false); if (!$userRecord) { return false; } $userModel = $this->getInstance('user_model'); $userMo...
php
public function getCurrentUser() { if (Towel::isCli()) { return false; //Cli is not logged. } $userRecord = $this->session()->get('user', false); if (!$userRecord) { return false; } $userModel = $this->getInstance('user_model'); $userMo...
[ "public", "function", "getCurrentUser", "(", ")", "{", "if", "(", "Towel", "::", "isCli", "(", ")", ")", "{", "return", "false", ";", "//Cli is not logged.", "}", "$", "userRecord", "=", "$", "this", "->", "session", "(", ")", "->", "get", "(", "'user'...
Gets the current user or false if is not authenticated. @returns \Towel\Model\BaseModel
[ "Gets", "the", "current", "user", "or", "false", "if", "is", "not", "authenticated", "." ]
train
https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/BaseApp.php#L97-L112
42mate/towel
src/Towel/BaseApp.php
BaseApp.sendMail
public function sendMail($to, $subject = '', $message = '', $headers = '') { if (empty($headers)) { $headers = 'From: ' . APP_SYS_EMAIL; } mail($to, $subject, $message, $headers); }
php
public function sendMail($to, $subject = '', $message = '', $headers = '') { if (empty($headers)) { $headers = 'From: ' . APP_SYS_EMAIL; } mail($to, $subject, $message, $headers); }
[ "public", "function", "sendMail", "(", "$", "to", ",", "$", "subject", "=", "''", ",", "$", "message", "=", "''", ",", "$", "headers", "=", "''", ")", "{", "if", "(", "empty", "(", "$", "headers", ")", ")", "{", "$", "headers", "=", "'From: '", ...
Sends an Email. @param $to @param string $subject @param string $message @param string $headers
[ "Sends", "an", "Email", "." ]
train
https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/BaseApp.php#L154-L160
42mate/towel
src/Towel/BaseApp.php
BaseApp.path
public function path($route, $parameters = array()) { return $this->silex['url_generator']->generate($route, $parameters, \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_PATH); }
php
public function path($route, $parameters = array()) { return $this->silex['url_generator']->generate($route, $parameters, \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_PATH); }
[ "public", "function", "path", "(", "$", "route", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "silex", "[", "'url_generator'", "]", "->", "generate", "(", "$", "route", ",", "$", "parameters", ",", "\\", "Sym...
Generates a path from the given parameters. @param string $route The name of the route @param mixed $parameters An array of parameters @return string The generated path
[ "Generates", "a", "path", "from", "the", "given", "parameters", "." ]
train
https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/BaseApp.php#L170-L173
42mate/towel
src/Towel/BaseApp.php
BaseApp.url
public function url($route, $parameters = array()) { return $this->silex['url_generator']->generate($route, $parameters, \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL); }
php
public function url($route, $parameters = array()) { return $this->silex['url_generator']->generate($route, $parameters, \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL); }
[ "public", "function", "url", "(", "$", "route", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "silex", "[", "'url_generator'", "]", "->", "generate", "(", "$", "route", ",", "$", "parameters", ",", "\\", "Symf...
Generates an absolute URL from the given parameters. @param string $route The name of the route @param mixed $parameters An array of parameters @return string The generated URL
[ "Generates", "an", "absolute", "URL", "from", "the", "given", "parameters", "." ]
train
https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/BaseApp.php#L183-L186
42mate/towel
src/Towel/BaseApp.php
BaseApp.getCache
public function getCache() { if (null === self::$cache) { if (!empty($this->appConfig['cache']['driver'])) { // Options definition. if (empty($this->appConfig['cache']['options'])) { $options = array(); } else { ...
php
public function getCache() { if (null === self::$cache) { if (!empty($this->appConfig['cache']['driver'])) { // Options definition. if (empty($this->appConfig['cache']['options'])) { $options = array(); } else { ...
[ "public", "function", "getCache", "(", ")", "{", "if", "(", "null", "===", "self", "::", "$", "cache", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "appConfig", "[", "'cache'", "]", "[", "'driver'", "]", ")", ")", "{", "// Options def...
Instantiate Cache driver @return \Towel\Cache\CacheInterface
[ "Instantiate", "Cache", "driver" ]
train
https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/BaseApp.php#L192-L219
42mate/towel
src/Towel/BaseApp.php
BaseApp.sluggify
public function sluggify($string) { $human_name = strtolower($string); $human_name = str_replace('á', 'a', $human_name); $human_name = str_replace('é', 'e', $human_name); $human_name = str_replace('í', 'i', $human_name); $human_name = str_replace('ó', 'o', $human_name); ...
php
public function sluggify($string) { $human_name = strtolower($string); $human_name = str_replace('á', 'a', $human_name); $human_name = str_replace('é', 'e', $human_name); $human_name = str_replace('í', 'i', $human_name); $human_name = str_replace('ó', 'o', $human_name); ...
[ "public", "function", "sluggify", "(", "$", "string", ")", "{", "$", "human_name", "=", "strtolower", "(", "$", "string", ")", ";", "$", "human_name", "=", "str_replace", "(", "'á',", " ", "a',", " ", "h", "uman_name)", ";", "", "$", "human_name", "=",...
Generates a machine readable slug of the string. @param $string @return String A machine readable string.
[ "Generates", "a", "machine", "readable", "slug", "of", "the", "string", "." ]
train
https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/BaseApp.php#L238-L253
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php
Xml.createErrorEntry
protected function createErrorEntry($error, $parse_errors) { $marker_obj = new \DOMElement(strtolower($error->getSeverity())); $parse_errors->appendChild($marker_obj); $message = ($this->getTranslator()) ? vsprintf($this->getTranslator()->translate($error->getCode()), $error->ge...
php
protected function createErrorEntry($error, $parse_errors) { $marker_obj = new \DOMElement(strtolower($error->getSeverity())); $parse_errors->appendChild($marker_obj); $message = ($this->getTranslator()) ? vsprintf($this->getTranslator()->translate($error->getCode()), $error->ge...
[ "protected", "function", "createErrorEntry", "(", "$", "error", ",", "$", "parse_errors", ")", "{", "$", "marker_obj", "=", "new", "\\", "DOMElement", "(", "strtolower", "(", "$", "error", "->", "getSeverity", "(", ")", ")", ")", ";", "$", "parse_errors", ...
Creates an entry in the ParseErrors collection of a file for a given error. @param Error $error @param \DOMElement $parse_errors @return void
[ "Creates", "an", "entry", "in", "the", "ParseErrors", "collection", "of", "a", "file", "for", "a", "given", "error", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php#L253-L265
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php
Xml.buildFunction
public function buildFunction(\DOMElement $parent, FunctionDescriptor $function, \DOMElement $child = null) { if (!$child) { $child = new \DOMElement('function'); $parent->appendChild($child); } $namespace = $function->getNamespace() ? $function->getNames...
php
public function buildFunction(\DOMElement $parent, FunctionDescriptor $function, \DOMElement $child = null) { if (!$child) { $child = new \DOMElement('function'); $parent->appendChild($child); } $namespace = $function->getNamespace() ? $function->getNames...
[ "public", "function", "buildFunction", "(", "\\", "DOMElement", "$", "parent", ",", "FunctionDescriptor", "$", "function", ",", "\\", "DOMElement", "$", "child", "=", "null", ")", "{", "if", "(", "!", "$", "child", ")", "{", "$", "child", "=", "new", "...
Export this function definition to the given parent DOMElement. @param \DOMElement $parent Element to augment. @param FunctionDescriptor $function Element to export. @param \DOMElement $child if supplied this element will be augmented instead of freshly added. @return void
[ "Export", "this", "function", "definition", "to", "the", "given", "parent", "DOMElement", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php#L289-L310
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php
Xml.buildClass
public function buildClass(\DOMElement $parent, ClassDescriptor $class, \DOMElement $child = null) { if (!$child) { $child = new \DOMElement('class'); $parent->appendChild($child); } $child->setAttribute('final', $class->isFinal() ? 'true' : 'false'); $child-...
php
public function buildClass(\DOMElement $parent, ClassDescriptor $class, \DOMElement $child = null) { if (!$child) { $child = new \DOMElement('class'); $parent->appendChild($child); } $child->setAttribute('final', $class->isFinal() ? 'true' : 'false'); $child-...
[ "public", "function", "buildClass", "(", "\\", "DOMElement", "$", "parent", ",", "ClassDescriptor", "$", "class", ",", "\\", "DOMElement", "$", "child", "=", "null", ")", "{", "if", "(", "!", "$", "child", ")", "{", "$", "child", "=", "new", "\\", "D...
Exports the given reflection object to the parent XML element. This method creates a new child element on the given parent XML element and takes the properties of the Reflection argument and sets the elements and attributes on the child. If a child DOMElement is provided then the properties and attributes are set on ...
[ "Exports", "the", "given", "reflection", "object", "to", "the", "parent", "XML", "element", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php#L331-L415
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php
Xml.buildPackageTree
protected function buildPackageTree(\DOMDocument $dom) { $xpath = new \DOMXPath($dom); $packages = array('global' => true); $qry = $xpath->query('//@package'); for ($i = 0; $i < $qry->length; $i++) { if (isset($packages[$qry->item($i)->nodeValue])) { conti...
php
protected function buildPackageTree(\DOMDocument $dom) { $xpath = new \DOMXPath($dom); $packages = array('global' => true); $qry = $xpath->query('//@package'); for ($i = 0; $i < $qry->length; $i++) { if (isset($packages[$qry->item($i)->nodeValue])) { conti...
[ "protected", "function", "buildPackageTree", "(", "\\", "DOMDocument", "$", "dom", ")", "{", "$", "xpath", "=", "new", "\\", "DOMXPath", "(", "$", "dom", ")", ";", "$", "packages", "=", "array", "(", "'global'", "=>", "true", ")", ";", "$", "qry", "=...
Collects all packages and subpackages, and adds a new section in the DOM to provide an overview. @param \DOMDocument $dom Packages are extracted and a summary inserted in this object. @return void
[ "Collects", "all", "packages", "and", "subpackages", "and", "adds", "a", "new", "section", "in", "the", "DOM", "to", "provide", "an", "overview", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php#L474-L489
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php
Xml.buildNamespaceTree
protected function buildNamespaceTree(\DOMDocument $dom) { $xpath = new \DOMXPath($dom); $namespaces = array(); $qry = $xpath->query('//@namespace'); for ($i = 0; $i < $qry->length; $i++) { if (isset($namespaces[$qry->item($i)->nodeValue])) { continue; ...
php
protected function buildNamespaceTree(\DOMDocument $dom) { $xpath = new \DOMXPath($dom); $namespaces = array(); $qry = $xpath->query('//@namespace'); for ($i = 0; $i < $qry->length; $i++) { if (isset($namespaces[$qry->item($i)->nodeValue])) { continue; ...
[ "protected", "function", "buildNamespaceTree", "(", "\\", "DOMDocument", "$", "dom", ")", "{", "$", "xpath", "=", "new", "\\", "DOMXPath", "(", "$", "dom", ")", ";", "$", "namespaces", "=", "array", "(", ")", ";", "$", "qry", "=", "$", "xpath", "->",...
Collects all namespaces and sub-namespaces, and adds a new section in the DOM to provide an overview. @param \DOMDocument $dom Namespaces are extracted and a summary inserted in this object. @return void
[ "Collects", "all", "namespaces", "and", "sub", "-", "namespaces", "and", "adds", "a", "new", "section", "in", "the", "DOM", "to", "provide", "an", "overview", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php#L500-L515
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php
Xml.generateNamespaceTree
protected function generateNamespaceTree($namespaces) { sort($namespaces); $result = array(); foreach ($namespaces as $namespace) { if (!$namespace) { $namespace = 'global'; } $namespace_list = explode('\\', $namespace); $nod...
php
protected function generateNamespaceTree($namespaces) { sort($namespaces); $result = array(); foreach ($namespaces as $namespace) { if (!$namespace) { $namespace = 'global'; } $namespace_list = explode('\\', $namespace); $nod...
[ "protected", "function", "generateNamespaceTree", "(", "$", "namespaces", ")", "{", "sort", "(", "$", "namespaces", ")", ";", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "namespaces", "as", "$", "namespace", ")", "{", "if", "(", "!...
Generates a hierarchical array of namespaces with their singular name from a single level list of namespaces with their full name. @param array $namespaces the list of namespaces as retrieved from the xml. @return array
[ "Generates", "a", "hierarchical", "array", "of", "namespaces", "with", "their", "singular", "name", "from", "a", "single", "level", "list", "of", "namespaces", "with", "their", "full", "name", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php#L568-L591
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php
Xml.generateNamespaceElements
protected function generateNamespaceElements($namespaces, $parent_element, $node_name = 'namespace') { foreach ($namespaces as $name => $sub_namespaces) { $node = new \DOMElement($node_name); $parent_element->appendChild($node); $node->setAttribute('name', $name); ...
php
protected function generateNamespaceElements($namespaces, $parent_element, $node_name = 'namespace') { foreach ($namespaces as $name => $sub_namespaces) { $node = new \DOMElement($node_name); $parent_element->appendChild($node); $node->setAttribute('name', $name); ...
[ "protected", "function", "generateNamespaceElements", "(", "$", "namespaces", ",", "$", "parent_element", ",", "$", "node_name", "=", "'namespace'", ")", "{", "foreach", "(", "$", "namespaces", "as", "$", "name", "=>", "$", "sub_namespaces", ")", "{", "$", "...
Recursive method to create a hierarchical set of nodes in the dom. @param array[] $namespaces the list of namespaces to process. @param \DOMElement $parent_element the node to receive the children of the above list. @param string $node_name the name of the summary element. @return void
[ "Recursive", "method", "to", "create", "a", "hierarchical", "set", "of", "nodes", "in", "the", "dom", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php#L603-L615
yosymfony/ConfigServiceProvider
src/Yosymfony/Silex/ConfigServiceProvider/ConfigFileLoader.php
ConfigFileLoader.getLocation
public function getLocation($resource) { if(false === $this->isDistExtension($resource)) { try { return $this->getLocator()->locate($resource, null, true); } catch (\InvalidArgumentException $ex) { $resour...
php
public function getLocation($resource) { if(false === $this->isDistExtension($resource)) { try { return $this->getLocator()->locate($resource, null, true); } catch (\InvalidArgumentException $ex) { $resour...
[ "public", "function", "getLocation", "(", "$", "resource", ")", "{", "if", "(", "false", "===", "$", "this", "->", "isDistExtension", "(", "$", "resource", ")", ")", "{", "try", "{", "return", "$", "this", "->", "getLocator", "(", ")", "->", "locate", ...
Get the location of a file resource follow the next hierachy: 1. filename.ext 2. filename.ext.dist (if filename.ext not exists) or filename.ext.dist if the .dist is included in the resource. @param string $resource Filename path @return string @throws \InvalidArgumentException When the file is not found
[ "Get", "the", "location", "of", "a", "file", "resource", "follow", "the", "next", "hierachy", ":", "1", ".", "filename", ".", "ext", "2", ".", "filename", ".", "ext", ".", "dist", "(", "if", "filename", ".", "ext", "not", "exists", ")" ]
train
https://github.com/yosymfony/ConfigServiceProvider/blob/f6cb9a9fc707b6c92e0d03201e5ecc17eaee3114/src/Yosymfony/Silex/ConfigServiceProvider/ConfigFileLoader.php#L38-L53
hametuha/wpametu
src/WPametu/Service/Recaptcha.php
Recaptcha.get_html
public function get_html($theme = 'light', $lang = 'en', $type = 'image'){ if( $this->enabled ){ // Option value $option = []; // Select theme switch($theme){ case 'dark': $option['theme'] = $theme; break; ...
php
public function get_html($theme = 'light', $lang = 'en', $type = 'image'){ if( $this->enabled ){ // Option value $option = []; // Select theme switch($theme){ case 'dark': $option['theme'] = $theme; break; ...
[ "public", "function", "get_html", "(", "$", "theme", "=", "'light'", ",", "$", "lang", "=", "'en'", ",", "$", "type", "=", "'image'", ")", "{", "if", "(", "$", "this", "->", "enabled", ")", "{", "// Option value", "$", "option", "=", "[", "]", ";",...
Return reCaptcha's HTML @link https://developers.google.com/recaptcha/docs/language @param string $theme light(default), dark @param string $lang en(default), fr, nl, de, pt, ru, es, tr, ja and more. @param string $type image(default) audio @return string|false
[ "Return", "reCaptcha", "s", "HTML" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/Service/Recaptcha.php#L70-L167
hametuha/wpametu
src/WPametu/Service/Recaptcha.php
Recaptcha.validate
public function validate(){ if( $this->enabled && ($response = $this->input->request('g-recaptcha-response')) && $this->input->remote_ip() ){ $endpoint = sprintf('https://www.google.com/recaptcha/api/siteverify?secret=%s&response=%s&remoteip=%s', constant(self::PRIVATE_KEY), rawurlencode($res...
php
public function validate(){ if( $this->enabled && ($response = $this->input->request('g-recaptcha-response')) && $this->input->remote_ip() ){ $endpoint = sprintf('https://www.google.com/recaptcha/api/siteverify?secret=%s&response=%s&remoteip=%s', constant(self::PRIVATE_KEY), rawurlencode($res...
[ "public", "function", "validate", "(", ")", "{", "if", "(", "$", "this", "->", "enabled", "&&", "(", "$", "response", "=", "$", "this", "->", "input", "->", "request", "(", "'g-recaptcha-response'", ")", ")", "&&", "$", "this", "->", "input", "->", "...
Validate reCaptcha @return bool
[ "Validate", "reCaptcha" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/Service/Recaptcha.php#L174-L187
Speicher210/monsum-api
src/Model/Subscription.php
Subscription.isRunning
public function isRunning() { $runningStatuses = [ self::SUBSCRIPTION_STATUS_ACTIVE, self::SUBSCRIPTION_STATUS_TRIAL, ]; return in_array($this->getStatus(), $runningStatuses, true); }
php
public function isRunning() { $runningStatuses = [ self::SUBSCRIPTION_STATUS_ACTIVE, self::SUBSCRIPTION_STATUS_TRIAL, ]; return in_array($this->getStatus(), $runningStatuses, true); }
[ "public", "function", "isRunning", "(", ")", "{", "$", "runningStatuses", "=", "[", "self", "::", "SUBSCRIPTION_STATUS_ACTIVE", ",", "self", "::", "SUBSCRIPTION_STATUS_TRIAL", ",", "]", ";", "return", "in_array", "(", "$", "this", "->", "getStatus", "(", ")", ...
Check if the current subscription is running. @return boolean
[ "Check", "if", "the", "current", "subscription", "is", "running", "." ]
train
https://github.com/Speicher210/monsum-api/blob/4611a048097de5d2b0efe9d4426779c783c0af4d/src/Model/Subscription.php#L71-L79
CalderaWP/metaplate-core
src/helper_loader.php
helper_loader.add_helpers
private function add_helpers( $helpers ) { foreach( $helpers as $helper ) { $helper = $this->validate_helper_input( $helper ); if ( is_array( $helper ) ) { $this->add_helper( $helper ); } } }
php
private function add_helpers( $helpers ) { foreach( $helpers as $helper ) { $helper = $this->validate_helper_input( $helper ); if ( is_array( $helper ) ) { $this->add_helper( $helper ); } } }
[ "private", "function", "add_helpers", "(", "$", "helpers", ")", "{", "foreach", "(", "$", "helpers", "as", "$", "helper", ")", "{", "$", "helper", "=", "$", "this", "->", "validate_helper_input", "(", "$", "helper", ")", ";", "if", "(", "is_array", "("...
Add the helpers to the Handlebars instance, if validation passes. @param array $helpers Array of helpers to add
[ "Add", "the", "helpers", "to", "the", "Handlebars", "instance", "if", "validation", "passes", "." ]
train
https://github.com/CalderaWP/metaplate-core/blob/15ede9c4250ab23112a32f8e45d5393f8278bbb8/src/helper_loader.php#L58-L67
CalderaWP/metaplate-core
src/helper_loader.php
helper_loader.validate_helper_input
private function validate_helper_input( $helper ) { if ( ! is_array( $helper ) || empty( $helper ) ) { return false; } if ( ! isset( $helper[ 'name' ] ) || ! isset( $helper[ 'class' ] ) ) { return false; } //if not set, set callback name to "helper" if ( ! isset( $helper[ 'callback' ] ) ) { $he...
php
private function validate_helper_input( $helper ) { if ( ! is_array( $helper ) || empty( $helper ) ) { return false; } if ( ! isset( $helper[ 'name' ] ) || ! isset( $helper[ 'class' ] ) ) { return false; } //if not set, set callback name to "helper" if ( ! isset( $helper[ 'callback' ] ) ) { $he...
[ "private", "function", "validate_helper_input", "(", "$", "helper", ")", "{", "if", "(", "!", "is_array", "(", "$", "helper", ")", "||", "empty", "(", "$", "helper", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "isset", "(", "$", "he...
Make sure each helper passed in is valid. @todo ensure helper class/callback are callable. Preferably, without creating object of the class. @param array $helper Array to add helper with. @return bool|array Returns the array if valid, false if not.
[ "Make", "sure", "each", "helper", "passed", "in", "is", "valid", "." ]
train
https://github.com/CalderaWP/metaplate-core/blob/15ede9c4250ab23112a32f8e45d5393f8278bbb8/src/helper_loader.php#L93-L109
CalderaWP/metaplate-core
src/pods/access.php
access.offsetGet
public function offsetGet($offset) { if ( $this->offsetExists( $offset ) ) { return parent::offsetGet( $offset ); } else { if( 'id' == $offset || 'ID' == $offset ) { $_value = $this->pod->id(); }else{ $_value = $this->pod->field( $offset ); } if( $_value ) { parent::offsetSet( $offset, $...
php
public function offsetGet($offset) { if ( $this->offsetExists( $offset ) ) { return parent::offsetGet( $offset ); } else { if( 'id' == $offset || 'ID' == $offset ) { $_value = $this->pod->id(); }else{ $_value = $this->pod->field( $offset ); } if( $_value ) { parent::offsetSet( $offset, $...
[ "public", "function", "offsetGet", "(", "$", "offset", ")", "{", "if", "(", "$", "this", "->", "offsetExists", "(", "$", "offset", ")", ")", "{", "return", "parent", "::", "offsetGet", "(", "$", "offset", ")", ";", "}", "else", "{", "if", "(", "'id...
Get an offset if already set or traverse Pod and then set plus reutrn. @since 0.1.0 @param mixed $offset Offset to get @return mixed
[ "Get", "an", "offset", "if", "already", "set", "or", "traverse", "Pod", "and", "then", "set", "plus", "reutrn", "." ]
train
https://github.com/CalderaWP/metaplate-core/blob/15ede9c4250ab23112a32f8e45d5393f8278bbb8/src/pods/access.php#L66-L81
ezsystems/ezdfs-fsbackend-dispatcher
classes/ezdfsfilehandlerdfsregistry.php
eZDFSFileHandlerDFSRegistry.getHandler
public function getHandler( $path ) { foreach ( $this->pathHandlers as $supportedPath => $handler ) { if ( strstr( $path, $supportedPath ) !== false ) { return $handler; } } return $this->defaultHandler; }
php
public function getHandler( $path ) { foreach ( $this->pathHandlers as $supportedPath => $handler ) { if ( strstr( $path, $supportedPath ) !== false ) { return $handler; } } return $this->defaultHandler; }
[ "public", "function", "getHandler", "(", "$", "path", ")", "{", "foreach", "(", "$", "this", "->", "pathHandlers", "as", "$", "supportedPath", "=>", "$", "handler", ")", "{", "if", "(", "strstr", "(", "$", "path", ",", "$", "supportedPath", ")", "!==",...
Returns the FSHandler for $path @param $path @return eZDFSFileHandlerDFSBackendInterface @throws OutOfRangeException If no handler supports $path
[ "Returns", "the", "FSHandler", "for", "$path" ]
train
https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsregistry.php#L53-L64
ezsystems/ezdfs-fsbackend-dispatcher
classes/ezdfsfilehandlerdfsregistry.php
eZDFSFileHandlerDFSRegistry.build
public static function build() { $ini = eZINI::instance( 'file.ini' ); $defaultHandler = eZDFSFileHandlerBackendFactory::buildHandler( $ini->variable( 'DispatchableDFS', 'DefaultBackend' ) ); $pathHandlers = array(); foreach ( $ini->variable( 'DispatchableDFS', '...
php
public static function build() { $ini = eZINI::instance( 'file.ini' ); $defaultHandler = eZDFSFileHandlerBackendFactory::buildHandler( $ini->variable( 'DispatchableDFS', 'DefaultBackend' ) ); $pathHandlers = array(); foreach ( $ini->variable( 'DispatchableDFS', '...
[ "public", "static", "function", "build", "(", ")", "{", "$", "ini", "=", "eZINI", "::", "instance", "(", "'file.ini'", ")", ";", "$", "defaultHandler", "=", "eZDFSFileHandlerBackendFactory", "::", "buildHandler", "(", "$", "ini", "->", "variable", "(", "'Dis...
Builds a registry using either the provided configuration, or settings from self::getConfiguration @return self
[ "Builds", "a", "registry", "using", "either", "the", "provided", "configuration", "or", "settings", "from", "self", "::", "getConfiguration" ]
train
https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsregistry.php#L77-L92
ekuiter/feature-php
FeaturePhp/Generator/CollaborationGenerator.php
CollaborationGenerator.processFileSpecification
protected function processFileSpecification($artifact, $fileSpecification) { $collaboration = fphp\Collaboration\Collaboration::findByArtifact($this->collaborations, $artifact); if (!$collaboration) $this->collaborations[] = $collaboration = new fphp\Collaboration\Collaboration($artifact); ...
php
protected function processFileSpecification($artifact, $fileSpecification) { $collaboration = fphp\Collaboration\Collaboration::findByArtifact($this->collaborations, $artifact); if (!$collaboration) $this->collaborations[] = $collaboration = new fphp\Collaboration\Collaboration($artifact); ...
[ "protected", "function", "processFileSpecification", "(", "$", "artifact", ",", "$", "fileSpecification", ")", "{", "$", "collaboration", "=", "fphp", "\\", "Collaboration", "\\", "Collaboration", "::", "findByArtifact", "(", "$", "this", "->", "collaborations", "...
Adds a role from a file to a collaboration. @param \FeaturePhp\Artifact\Artifact $artifact @param \FeaturePhp\Specification\FileSpecification $fileSpecification
[ "Adds", "a", "role", "from", "a", "file", "to", "a", "collaboration", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Generator/CollaborationGenerator.php#L62-L70
ekuiter/feature-php
FeaturePhp/Generator/CollaborationGenerator.php
CollaborationGenerator._generateFiles
protected function _generateFiles() { foreach ($this->getRegisteredArtifacts() as $artifact) { $featureName = $artifact->getFeature()->getName(); if (array_search($featureName, $this->featureOrder) === false) throw new CollaborationGeneratorException("no feature order sup...
php
protected function _generateFiles() { foreach ($this->getRegisteredArtifacts() as $artifact) { $featureName = $artifact->getFeature()->getName(); if (array_search($featureName, $this->featureOrder) === false) throw new CollaborationGeneratorException("no feature order sup...
[ "protected", "function", "_generateFiles", "(", ")", "{", "foreach", "(", "$", "this", "->", "getRegisteredArtifacts", "(", ")", "as", "$", "artifact", ")", "{", "$", "featureName", "=", "$", "artifact", "->", "getFeature", "(", ")", "->", "getName", "(", ...
Generates the refined files.
[ "Generates", "the", "refined", "files", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Generator/CollaborationGenerator.php#L75-L96
crysalead/storage-stream
src/MultiStream.php
MultiStream.add
public function add($stream) { if (is_scalar($stream) || is_resource($stream)) { $stream = new Stream(['data' => $stream]); } if (!$stream->isReadable()) { throw new InvalidArgumentException("Cannot append on a non readable stream."); } // The stream...
php
public function add($stream) { if (is_scalar($stream) || is_resource($stream)) { $stream = new Stream(['data' => $stream]); } if (!$stream->isReadable()) { throw new InvalidArgumentException("Cannot append on a non readable stream."); } // The stream...
[ "public", "function", "add", "(", "$", "stream", ")", "{", "if", "(", "is_scalar", "(", "$", "stream", ")", "||", "is_resource", "(", "$", "stream", ")", ")", "{", "$", "stream", "=", "new", "Stream", "(", "[", "'data'", "=>", "$", "stream", "]", ...
Add a stream @param object $stream Stream to append. @throws InvalidArgumentException if the stream is not readable
[ "Add", "a", "stream" ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L129-L146
crysalead/storage-stream
src/MultiStream.php
MultiStream.seek
public function seek($offset, $whence = SEEK_SET) { if (!$this->_seekable) { throw new RuntimeException("Cannot seek on non seekable stream."); } if ($whence !== SEEK_SET) { if (!$offset && $whence === SEEK_END) { return $this->end(); } ...
php
public function seek($offset, $whence = SEEK_SET) { if (!$this->_seekable) { throw new RuntimeException("Cannot seek on non seekable stream."); } if ($whence !== SEEK_SET) { if (!$offset && $whence === SEEK_END) { return $this->end(); } ...
[ "public", "function", "seek", "(", "$", "offset", ",", "$", "whence", "=", "SEEK_SET", ")", "{", "if", "(", "!", "$", "this", "->", "_seekable", ")", "{", "throw", "new", "RuntimeException", "(", "\"Cannot seek on non seekable stream.\"", ")", ";", "}", "i...
Attempts to seek to the given position. Only supports SEEK_SET. {@inheritdoc}
[ "Attempts", "to", "seek", "to", "the", "given", "position", ".", "Only", "supports", "SEEK_SET", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L163-L186
crysalead/storage-stream
src/MultiStream.php
MultiStream.end
public function end() { if (!$this->_seekable) { throw new RuntimeException("Cannot seek on non seekable stream."); } if (!count($this->_streams)) { throw new RuntimeException('The stream container is empty no seek operation is possible.'); } $this->_c...
php
public function end() { if (!$this->_seekable) { throw new RuntimeException("Cannot seek on non seekable stream."); } if (!count($this->_streams)) { throw new RuntimeException('The stream container is empty no seek operation is possible.'); } $this->_c...
[ "public", "function", "end", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_seekable", ")", "{", "throw", "new", "RuntimeException", "(", "\"Cannot seek on non seekable stream.\"", ")", ";", "}", "if", "(", "!", "count", "(", "$", "this", "->", "_st...
Seek to the end of the stream. @return Boolean
[ "Seek", "to", "the", "end", "of", "the", "stream", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L213-L224
crysalead/storage-stream
src/MultiStream.php
MultiStream.read
public function read($length = null) { $buffer = ''; $total = count($this->_streams) - 1; $remaining = (integer) ($length === null ? $this->_bufferSize : $length); $progressToNext = false; while ($remaining > 0) { // Progress to the next stream if needed. ...
php
public function read($length = null) { $buffer = ''; $total = count($this->_streams) - 1; $remaining = (integer) ($length === null ? $this->_bufferSize : $length); $progressToNext = false; while ($remaining > 0) { // Progress to the next stream if needed. ...
[ "public", "function", "read", "(", "$", "length", "=", "null", ")", "{", "$", "buffer", "=", "''", ";", "$", "total", "=", "count", "(", "$", "this", "->", "_streams", ")", "-", "1", ";", "$", "remaining", "=", "(", "integer", ")", "(", "$", "l...
Read data from the stream. Binary-safe. @param integer $length Maximum number of bytes to read (default to buffer size). @return string The data.
[ "Read", "data", "from", "the", "stream", ".", "Binary", "-", "safe", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L233-L264
crysalead/storage-stream
src/MultiStream.php
MultiStream.write
public function write($string, $length = null) { if (!count($this->_streams)) { throw new RuntimeException('The stream container is empty no write operation is possible.'); } $stream = $this->_streams[$this->_current]; return $stream->write($string, $length); }
php
public function write($string, $length = null) { if (!count($this->_streams)) { throw new RuntimeException('The stream container is empty no write operation is possible.'); } $stream = $this->_streams[$this->_current]; return $stream->write($string, $length); }
[ "public", "function", "write", "(", "$", "string", ",", "$", "length", "=", "null", ")", "{", "if", "(", "!", "count", "(", "$", "this", "->", "_streams", ")", ")", "{", "throw", "new", "RuntimeException", "(", "'The stream container is empty no write operat...
Write data to the stream. @param string $string The string that is to be written. @param integer $length If the length argument is given, writing will stop after length bytes have been written or the end of string if reached, whichever comes first. @return integer Number of bytes written
[ "Write", "data", "to", "the", "stream", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L274-L281
crysalead/storage-stream
src/MultiStream.php
MultiStream.append
public function append($string, $length = null) { $this->end(); return $this->write($string, $length); }
php
public function append($string, $length = null) { $this->end(); return $this->write($string, $length); }
[ "public", "function", "append", "(", "$", "string", ",", "$", "length", "=", "null", ")", "{", "$", "this", "->", "end", "(", ")", ";", "return", "$", "this", "->", "write", "(", "$", "string", ",", "$", "length", ")", ";", "}" ]
Append data to the stream. @param string $string The string that is to be written. @param integer $length If the length argument is given, writing will stop after length bytes have been written or the end of string if reached, whichever comes first. @return integer Number of bytes written
[ "Append", "data", "to", "the", "stream", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L291-L295
crysalead/storage-stream
src/MultiStream.php
MultiStream.length
public function length() { $length = 0; foreach ($this->_streams as $stream) { $len = $stream->length(); if ($len === null) { return; } $length += $len; } return $length; }
php
public function length() { $length = 0; foreach ($this->_streams as $stream) { $len = $stream->length(); if ($len === null) { return; } $length += $len; } return $length; }
[ "public", "function", "length", "(", ")", "{", "$", "length", "=", "0", ";", "foreach", "(", "$", "this", "->", "_streams", "as", "$", "stream", ")", "{", "$", "len", "=", "$", "stream", "->", "length", "(", ")", ";", "if", "(", "$", "len", "==...
Tries to calculate the size by adding the size of each stream. If any of the streams do not return a valid number, then the size of the append stream cannot be determined and null is returned.
[ "Tries", "to", "calculate", "the", "size", "by", "adding", "the", "size", "of", "each", "stream", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L304-L316
crysalead/storage-stream
src/MultiStream.php
MultiStream.get
public function get($index) { if (!isset($this->_streams[$index])) { throw new InvalidArgumentException("Unexisting stream index `{$index}`."); } return $this->_streams[$index]; }
php
public function get($index) { if (!isset($this->_streams[$index])) { throw new InvalidArgumentException("Unexisting stream index `{$index}`."); } return $this->_streams[$index]; }
[ "public", "function", "get", "(", "$", "index", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_streams", "[", "$", "index", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"Unexisting stream index `{$index}`.\"", ")", "...
Return a contained stream. @param integer $index An index. @return object
[ "Return", "a", "contained", "stream", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L335-L341
crysalead/storage-stream
src/MultiStream.php
MultiStream.remove
public function remove($index) { if (!isset($this->_streams[$index])) { throw new InvalidArgumentException("Unexisting stream index `{$index}`."); } $stream = $this->_streams[$index]; unset($this->_streams[$index]); $this->_streams = array_values($this->_streams);...
php
public function remove($index) { if (!isset($this->_streams[$index])) { throw new InvalidArgumentException("Unexisting stream index `{$index}`."); } $stream = $this->_streams[$index]; unset($this->_streams[$index]); $this->_streams = array_values($this->_streams);...
[ "public", "function", "remove", "(", "$", "index", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_streams", "[", "$", "index", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"Unexisting stream index `{$index}`.\"", ")", ...
Remove a stream. @param integer $index An index. @return object The removed stream.
[ "Remove", "a", "stream", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L349-L358
crysalead/storage-stream
src/MultiStream.php
MultiStream.eof
public function eof() { return !$this->_streams || ($this->_current >= count($this->_streams) - 1 && $this->_streams[$this->_current]->eof()); }
php
public function eof() { return !$this->_streams || ($this->_current >= count($this->_streams) - 1 && $this->_streams[$this->_current]->eof()); }
[ "public", "function", "eof", "(", ")", "{", "return", "!", "$", "this", "->", "_streams", "||", "(", "$", "this", "->", "_current", ">=", "count", "(", "$", "this", "->", "_streams", ")", "-", "1", "&&", "$", "this", "->", "_streams", "[", "$", "...
Checks for EOF. @return boolean
[ "Checks", "for", "EOF", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L385-L388
crysalead/storage-stream
src/MultiStream.php
MultiStream.flush
public function flush() { $buffer = ''; while (!$this->eof()) { $buffer .= $this->read($this->_bufferSize); } return $buffer; }
php
public function flush() { $buffer = ''; while (!$this->eof()) { $buffer .= $this->read($this->_bufferSize); } return $buffer; }
[ "public", "function", "flush", "(", ")", "{", "$", "buffer", "=", "''", ";", "while", "(", "!", "$", "this", "->", "eof", "(", ")", ")", "{", "$", "buffer", ".=", "$", "this", "->", "read", "(", "$", "this", "->", "_bufferSize", ")", ";", "}", ...
Return the remaining data from the stream. @return string
[ "Return", "the", "remaining", "data", "from", "the", "stream", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L395-L402
crysalead/storage-stream
src/MultiStream.php
MultiStream.detach
public function detach() { $this->_offset = $this->_current = 0; $this->_seekable = true; foreach ($this->_streams as $stream) { $stream->detach(); } $this->_streams = []; }
php
public function detach() { $this->_offset = $this->_current = 0; $this->_seekable = true; foreach ($this->_streams as $stream) { $stream->detach(); } $this->_streams = []; }
[ "public", "function", "detach", "(", ")", "{", "$", "this", "->", "_offset", "=", "$", "this", "->", "_current", "=", "0", ";", "$", "this", "->", "_seekable", "=", "true", ";", "foreach", "(", "$", "this", "->", "_streams", "as", "$", "stream", ")...
Detaches each attached stream. Returns null as it's not clear which underlying stream resource to return.
[ "Detaches", "each", "attached", "stream", "." ]
train
https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/MultiStream.php#L423-L433
blast-project/BaseEntitiesBundle
src/Loggable/Mapping/Event/Adapter/ODM.php
ODM.getNewVersion
public function getNewVersion($meta, $object) { $dm = $this->getObjectManager(); $objectMeta = $dm->getClassMetadata(get_class($object)); $identifierField = $this->getSingleIdentifierFieldName($objectMeta); $objectId = $objectMeta->getReflectionProperty($identifierField)->getValue($o...
php
public function getNewVersion($meta, $object) { $dm = $this->getObjectManager(); $objectMeta = $dm->getClassMetadata(get_class($object)); $identifierField = $this->getSingleIdentifierFieldName($objectMeta); $objectId = $objectMeta->getReflectionProperty($identifierField)->getValue($o...
[ "public", "function", "getNewVersion", "(", "$", "meta", ",", "$", "object", ")", "{", "$", "dm", "=", "$", "this", "->", "getObjectManager", "(", ")", ";", "$", "objectMeta", "=", "$", "dm", "->", "getClassMetadata", "(", "get_class", "(", "$", "objec...
{@inheritdoc}
[ "{" ]
train
https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Loggable/Mapping/Event/Adapter/ODM.php#L46-L68
Innmind/neo4j-dbal
src/Translator/HttpTranslator.php
HttpTranslator.computeEndpoint
private function computeEndpoint(): UrlInterface { if (!$this->transactions->isOpened()) { return Url::fromString('/db/data/transaction/commit'); } return $this->transactions->current()->endpoint(); }
php
private function computeEndpoint(): UrlInterface { if (!$this->transactions->isOpened()) { return Url::fromString('/db/data/transaction/commit'); } return $this->transactions->current()->endpoint(); }
[ "private", "function", "computeEndpoint", "(", ")", ":", "UrlInterface", "{", "if", "(", "!", "$", "this", "->", "transactions", "->", "isOpened", "(", ")", ")", "{", "return", "Url", "::", "fromString", "(", "'/db/data/transaction/commit'", ")", ";", "}", ...
Determine the appropriate endpoint based on the transactions
[ "Determine", "the", "appropriate", "endpoint", "based", "on", "the", "transactions" ]
train
https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Translator/HttpTranslator.php#L77-L84
Innmind/neo4j-dbal
src/Translator/HttpTranslator.php
HttpTranslator.computeBody
private function computeBody(Query $query): StringStream { $statement = [ 'statement' => $query->cypher(), 'resultDataContents' => ['graph', 'row'], ]; if ($query->hasParameters()) { $parameters = []; foreach ($query->parameters() as $paramet...
php
private function computeBody(Query $query): StringStream { $statement = [ 'statement' => $query->cypher(), 'resultDataContents' => ['graph', 'row'], ]; if ($query->hasParameters()) { $parameters = []; foreach ($query->parameters() as $paramet...
[ "private", "function", "computeBody", "(", "Query", "$", "query", ")", ":", "StringStream", "{", "$", "statement", "=", "[", "'statement'", "=>", "$", "query", "->", "cypher", "(", ")", ",", "'resultDataContents'", "=>", "[", "'graph'", ",", "'row'", "]", ...
Build the json payload to be sent to the server
[ "Build", "the", "json", "payload", "to", "be", "sent", "to", "the", "server" ]
train
https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Translator/HttpTranslator.php#L89-L109
zicht/z
src/Zicht/Tool/Container/ContainerBuilder.php
ContainerBuilder.isExpressionPath
public function isExpressionPath($path, $node) { if (is_scalar($node)) { foreach ($this->expressionPaths as $callable) { if (call_user_func($callable, $path)) { return true; } } } return false; }
php
public function isExpressionPath($path, $node) { if (is_scalar($node)) { foreach ($this->expressionPaths as $callable) { if (call_user_func($callable, $path)) { return true; } } } return false; }
[ "public", "function", "isExpressionPath", "(", "$", "path", ",", "$", "node", ")", "{", "if", "(", "is_scalar", "(", "$", "node", ")", ")", "{", "foreach", "(", "$", "this", "->", "expressionPaths", "as", "$", "callable", ")", "{", "if", "(", "call_u...
Decides if a node should be an expression. @param array $path @param mixed $node @return bool
[ "Decides", "if", "a", "node", "should", "be", "an", "expression", "." ]
train
https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerBuilder.php#L58-L68
zicht/z
src/Zicht/Tool/Container/ContainerBuilder.php
ContainerBuilder.build
public function build() { Debug::enterScope('build'); $traverser = $this->createNodeCreatorTraverser($this->config); $result = $traverser->traverse(); $node = new ContainerNode(); $gatherer = $this->createNodeGathererTraverser($result, $node); $gatherer->traverse(); ...
php
public function build() { Debug::enterScope('build'); $traverser = $this->createNodeCreatorTraverser($this->config); $result = $traverser->traverse(); $node = new ContainerNode(); $gatherer = $this->createNodeGathererTraverser($result, $node); $gatherer->traverse(); ...
[ "public", "function", "build", "(", ")", "{", "Debug", "::", "enterScope", "(", "'build'", ")", ";", "$", "traverser", "=", "$", "this", "->", "createNodeCreatorTraverser", "(", "$", "this", "->", "config", ")", ";", "$", "result", "=", "$", "traverser",...
Build the container node @return ContainerNode
[ "Build", "the", "container", "node" ]
train
https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerBuilder.php#L76-L88
zicht/z
src/Zicht/Tool/Container/ContainerBuilder.php
ContainerBuilder.createNodeGathererTraverser
public function createNodeGathererTraverser($result, $containerNode) { $gatherer = new Traverser($result); $gatherer->addVisitor( function ($path, $node) use($containerNode) { $containerNode->append($node); }, function ($path, $node) { ...
php
public function createNodeGathererTraverser($result, $containerNode) { $gatherer = new Traverser($result); $gatherer->addVisitor( function ($path, $node) use($containerNode) { $containerNode->append($node); }, function ($path, $node) { ...
[ "public", "function", "createNodeGathererTraverser", "(", "$", "result", ",", "$", "containerNode", ")", "{", "$", "gatherer", "=", "new", "Traverser", "(", "$", "result", ")", ";", "$", "gatherer", "->", "addVisitor", "(", "function", "(", "$", "path", ",...
Creates the traverser that gathers all nodes (i.e. Node instances) that are specified in the tree. @param array $result @param \Zicht\Tool\Script\Node\Branch $containerNode @return Traverser
[ "Creates", "the", "traverser", "that", "gathers", "all", "nodes", "(", "i", ".", "e", ".", "Node", "instances", ")", "that", "are", "specified", "in", "the", "tree", "." ]
train
https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerBuilder.php#L98-L111
zicht/z
src/Zicht/Tool/Container/ContainerBuilder.php
ContainerBuilder.createArgNode
public function createArgNode($path, $node) { $v = trim($node); if (substr($v, 0, 1) == '?') { $conditional = true; $v = ltrim(substr($v, 1)); } else { $conditional = false; } return new ArgNode(end($path), $this->exprcompiler->parse($v), $...
php
public function createArgNode($path, $node) { $v = trim($node); if (substr($v, 0, 1) == '?') { $conditional = true; $v = ltrim(substr($v, 1)); } else { $conditional = false; } return new ArgNode(end($path), $this->exprcompiler->parse($v), $...
[ "public", "function", "createArgNode", "(", "$", "path", ",", "$", "node", ")", "{", "$", "v", "=", "trim", "(", "$", "node", ")", ";", "if", "(", "substr", "(", "$", "v", ",", "0", ",", "1", ")", "==", "'?'", ")", "{", "$", "conditional", "=...
Creates a node for the 'args' definition of the task. @param array $path @param string $node @return \Zicht\Tool\Script\Node\Task\ArgNode
[ "Creates", "a", "node", "for", "the", "args", "definition", "of", "the", "task", "." ]
train
https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerBuilder.php#L160-L170
zicht/z
src/Zicht/Tool/Container/ContainerBuilder.php
ContainerBuilder.createOptNode
public function createOptNode($path, $node) { return new OptNode(end($path), $this->exprcompiler->parse($node)); }
php
public function createOptNode($path, $node) { return new OptNode(end($path), $this->exprcompiler->parse($node)); }
[ "public", "function", "createOptNode", "(", "$", "path", ",", "$", "node", ")", "{", "return", "new", "OptNode", "(", "end", "(", "$", "path", ")", ",", "$", "this", "->", "exprcompiler", "->", "parse", "(", "$", "node", ")", ")", ";", "}" ]
Creates a node for the 'opts' definition of the task. @param array $path @param string $node @return \Zicht\Tool\Script\Node\Task\OptNode
[ "Creates", "a", "node", "for", "the", "opts", "definition", "of", "the", "task", "." ]
train
https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerBuilder.php#L179-L182
zicht/z
src/Zicht/Tool/Container/ContainerBuilder.php
ContainerBuilder.createSetNode
public function createSetNode($path, $node) { return new SetNode(end($path), $this->exprcompiler->parse($node)); }
php
public function createSetNode($path, $node) { return new SetNode(end($path), $this->exprcompiler->parse($node)); }
[ "public", "function", "createSetNode", "(", "$", "path", ",", "$", "node", ")", "{", "return", "new", "SetNode", "(", "end", "(", "$", "path", ")", ",", "$", "this", "->", "exprcompiler", "->", "parse", "(", "$", "node", ")", ")", ";", "}" ]
Creates a node for the 'set' definition of the task. @param array $path @param string $node @return SetNode
[ "Creates", "a", "node", "for", "the", "set", "definition", "of", "the", "task", "." ]
train
https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerBuilder.php#L192-L195
zicht/z
src/Zicht/Tool/Container/ContainerBuilder.php
ContainerBuilder.createNodeCreatorTraverser
public function createNodeCreatorTraverser($config) { $traverser = new Traverser($config); $traverser->addVisitor( array($this, 'createArgNode'), function ($path) { return (count($path) == 4 && $path[0] == 'tasks' && $path[2] == 'args'); }, ...
php
public function createNodeCreatorTraverser($config) { $traverser = new Traverser($config); $traverser->addVisitor( array($this, 'createArgNode'), function ($path) { return (count($path) == 4 && $path[0] == 'tasks' && $path[2] == 'args'); }, ...
[ "public", "function", "createNodeCreatorTraverser", "(", "$", "config", ")", "{", "$", "traverser", "=", "new", "Traverser", "(", "$", "config", ")", ";", "$", "traverser", "->", "addVisitor", "(", "array", "(", "$", "this", ",", "'createArgNode'", ")", ",...
Creates the traverser that creates relevant nodes at all known paths. @param array $config @return Traverser
[ "Creates", "the", "traverser", "that", "creates", "relevant", "nodes", "at", "all", "known", "paths", "." ]
train
https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerBuilder.php#L230-L299
qlake/framework
src/Qlake/Routing/Route.php
Route.hasParam
public function hasParam($param) { $param = (string)$this->params[$param]; return strlen($param) > 0 ? true : false; }
php
public function hasParam($param) { $param = (string)$this->params[$param]; return strlen($param) > 0 ? true : false; }
[ "public", "function", "hasParam", "(", "$", "param", ")", "{", "$", "param", "=", "(", "string", ")", "$", "this", "->", "params", "[", "$", "param", "]", ";", "return", "strlen", "(", "$", "param", ")", ">", "0", "?", "true", ":", "false", ";", ...
Determine that route param exists. @param string $param @return bool
[ "Determine", "that", "route", "param", "exists", "." ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Routing/Route.php#L160-L165
qlake/framework
src/Qlake/Routing/Route.php
Route.setPrefixUri
public function setPrefixUri($prefix) { //$prefix = $this->normalizeUri($prefix); if (empty($prefix)) { return $this; } $this->uri = $prefix .'/'. $this->uri; return $this; }
php
public function setPrefixUri($prefix) { //$prefix = $this->normalizeUri($prefix); if (empty($prefix)) { return $this; } $this->uri = $prefix .'/'. $this->uri; return $this; }
[ "public", "function", "setPrefixUri", "(", "$", "prefix", ")", "{", "//$prefix = $this->normalizeUri($prefix);", "if", "(", "empty", "(", "$", "prefix", ")", ")", "{", "return", "$", "this", ";", "}", "$", "this", "->", "uri", "=", "$", "prefix", ".", "...
Set prefix to current route's uri. use by Route::group method. @param string $prefix @return Qlake\Routing\Route
[ "Set", "prefix", "to", "current", "route", "s", "uri", ".", "use", "by", "Route", "::", "group", "method", "." ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Routing/Route.php#L239-L251
qlake/framework
src/Qlake/Routing/Route.php
Route.isMatch
public function isMatch($pathInfo) { $this->compile(); $pathInfo = trim($pathInfo, '/'); if (!preg_match($this->pattern, $pathInfo, $paramValues)) { return false; } foreach ($this->paramNames as $name) { $this->params[$name] = isset($paramValues[$name]) ? urldecode($paramValues[$name]) : null; ...
php
public function isMatch($pathInfo) { $this->compile(); $pathInfo = trim($pathInfo, '/'); if (!preg_match($this->pattern, $pathInfo, $paramValues)) { return false; } foreach ($this->paramNames as $name) { $this->params[$name] = isset($paramValues[$name]) ? urldecode($paramValues[$name]) : null; ...
[ "public", "function", "isMatch", "(", "$", "pathInfo", ")", "{", "$", "this", "->", "compile", "(", ")", ";", "$", "pathInfo", "=", "trim", "(", "$", "pathInfo", ",", "'/'", ")", ";", "if", "(", "!", "preg_match", "(", "$", "this", "->", "pattern",...
Determine matching route by given uri. @param string $pathInfo @return bool
[ "Determine", "matching", "route", "by", "given", "uri", "." ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Routing/Route.php#L261-L278
qlake/framework
src/Qlake/Routing/Route.php
Route.compile
public function compile() { //reset arrays $this->params = []; $this->paramNames = []; $this->conditions = []; $this->compiled = true; $uri = $this->normalizeUri($this->getUri()); // match patterns like /{param?:regex} // tested in https://regex101.com/r/gP6yH7 $regex = preg_replace_callback( ...
php
public function compile() { //reset arrays $this->params = []; $this->paramNames = []; $this->conditions = []; $this->compiled = true; $uri = $this->normalizeUri($this->getUri()); // match patterns like /{param?:regex} // tested in https://regex101.com/r/gP6yH7 $regex = preg_replace_callback( ...
[ "public", "function", "compile", "(", ")", "{", "//reset arrays", "$", "this", "->", "params", "=", "[", "]", ";", "$", "this", "->", "paramNames", "=", "[", "]", ";", "$", "this", "->", "conditions", "=", "[", "]", ";", "$", "this", "->", "compile...
Compile route uri pattern regex @return Qlake\Routing\Route
[ "Compile", "route", "uri", "pattern", "regex" ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Routing/Route.php#L391-L422
qlake/framework
src/Qlake/Routing/Route.php
Route.createRegex
protected function createRegex($matched) { $startSlash = $matched[1] ? true : false; $param = $matched[2]; $optional = $matched[3] ? true : false; $pattern = $matched[4] ?: null; $pattern = $this->conditions[$param] ?: $pattern ?: '[^/]+'; $this->paramNames[] = $param; if ($startSlash) { ...
php
protected function createRegex($matched) { $startSlash = $matched[1] ? true : false; $param = $matched[2]; $optional = $matched[3] ? true : false; $pattern = $matched[4] ?: null; $pattern = $this->conditions[$param] ?: $pattern ?: '[^/]+'; $this->paramNames[] = $param; if ($startSlash) { ...
[ "protected", "function", "createRegex", "(", "$", "matched", ")", "{", "$", "startSlash", "=", "$", "matched", "[", "1", "]", "?", "true", ":", "false", ";", "$", "param", "=", "$", "matched", "[", "2", "]", ";", "$", "optional", "=", "$", "matched...
Callback for creating route param names regex @param array $matched @return string
[ "Callback", "for", "creating", "route", "param", "names", "regex" ]
train
https://github.com/qlake/framework/blob/0b7bad459ae0721bc5cdd141344f9dfc1acee28a/src/Qlake/Routing/Route.php#L432-L453