id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
17,600
zircote/AMQP
library/AMQP/Wire/Writer.php
Writer.writeLongLong
public function writeLongLong($n) { $this->flushBits(); $this->out .= implode('', Writer::chrByteSplit($n, 8)); return $this; }
php
public function writeLongLong($n) { $this->flushBits(); $this->out .= implode('', Writer::chrByteSplit($n, 8)); return $this; }
[ "public", "function", "writeLongLong", "(", "$", "n", ")", "{", "$", "this", "->", "flushBits", "(", ")", ";", "$", "this", "->", "out", ".=", "implode", "(", "''", ",", "Writer", "::", "chrByteSplit", "(", "$", "n", ",", "8", ")", ")", ";", "return", "$", "this", ";", "}" ]
Write an integer as an unsigned 64-bit value. @param $n @return Writer
[ "Write", "an", "integer", "as", "an", "unsigned", "64", "-", "bit", "value", "." ]
b96777b372f556797db4fd0ba02edb18d4bf4a1e
https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/Writer.php#L201-L206
17,601
zircote/AMQP
library/AMQP/Wire/Writer.php
Writer.writeShortStr
public function writeShortStr($s) { $this->flushBits(); if (strlen($s) > 255) { throw new \InvalidArgumentException('String too long'); } $this->writeOctet(strlen($s)); $this->out .= $s; return $this; }
php
public function writeShortStr($s) { $this->flushBits(); if (strlen($s) > 255) { throw new \InvalidArgumentException('String too long'); } $this->writeOctet(strlen($s)); $this->out .= $s; return $this; }
[ "public", "function", "writeShortStr", "(", "$", "s", ")", "{", "$", "this", "->", "flushBits", "(", ")", ";", "if", "(", "strlen", "(", "$", "s", ")", ">", "255", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'String too long'", ")", ";", "}", "$", "this", "->", "writeOctet", "(", "strlen", "(", "$", "s", ")", ")", ";", "$", "this", "->", "out", ".=", "$", "s", ";", "return", "$", "this", ";", "}" ]
Write a string up to 255 bytes long after encoding. Assume UTF-8 encoding. @param $s @return Writer @throws \InvalidArgumentException
[ "Write", "a", "string", "up", "to", "255", "bytes", "long", "after", "encoding", ".", "Assume", "UTF", "-", "8", "encoding", "." ]
b96777b372f556797db4fd0ba02edb18d4bf4a1e
https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/Writer.php#L217-L227
17,602
GrahamDeprecated/CMS-Core
src/CMSCoreServiceProvider.php
CMSCoreServiceProvider.setupViewer
protected function setupViewer() { $this->app->bindShared('viewer', function ($app) { $view = $app['view']; $credentials = $app['credentials']; $navigation = $app['navigation']; $pageprovider = $app['pageprovider']; $name = $app['config']['platform.name']; $inverse = $app['config']['theme.inverse']; return new Classes\Viewer($view, $credentials, $navigation, $pageprovider, $name, $inverse); }); }
php
protected function setupViewer() { $this->app->bindShared('viewer', function ($app) { $view = $app['view']; $credentials = $app['credentials']; $navigation = $app['navigation']; $pageprovider = $app['pageprovider']; $name = $app['config']['platform.name']; $inverse = $app['config']['theme.inverse']; return new Classes\Viewer($view, $credentials, $navigation, $pageprovider, $name, $inverse); }); }
[ "protected", "function", "setupViewer", "(", ")", "{", "$", "this", "->", "app", "->", "bindShared", "(", "'viewer'", ",", "function", "(", "$", "app", ")", "{", "$", "view", "=", "$", "app", "[", "'view'", "]", ";", "$", "credentials", "=", "$", "app", "[", "'credentials'", "]", ";", "$", "navigation", "=", "$", "app", "[", "'navigation'", "]", ";", "$", "pageprovider", "=", "$", "app", "[", "'pageprovider'", "]", ";", "$", "name", "=", "$", "app", "[", "'config'", "]", "[", "'platform.name'", "]", ";", "$", "inverse", "=", "$", "app", "[", "'config'", "]", "[", "'theme.inverse'", "]", ";", "return", "new", "Classes", "\\", "Viewer", "(", "$", "view", ",", "$", "credentials", ",", "$", "navigation", ",", "$", "pageprovider", ",", "$", "name", ",", "$", "inverse", ")", ";", "}", ")", ";", "}" ]
Setup the viewer class. @return void
[ "Setup", "the", "viewer", "class", "." ]
5603e2bfa2fac6cf46ca3ed62d21518f2f653675
https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/CMSCoreServiceProvider.php#L56-L68
17,603
GrahamDeprecated/CMS-Core
src/CMSCoreServiceProvider.php
CMSCoreServiceProvider.registerCommentProvider
protected function registerCommentProvider() { $this->app->bindShared('commentprovider', function ($app) { $model = $app['config']['graham-campbell/cms-core::comment']; $comment = new $model(); return new Providers\CommentProvider($comment); }); }
php
protected function registerCommentProvider() { $this->app->bindShared('commentprovider', function ($app) { $model = $app['config']['graham-campbell/cms-core::comment']; $comment = new $model(); return new Providers\CommentProvider($comment); }); }
[ "protected", "function", "registerCommentProvider", "(", ")", "{", "$", "this", "->", "app", "->", "bindShared", "(", "'commentprovider'", ",", "function", "(", "$", "app", ")", "{", "$", "model", "=", "$", "app", "[", "'config'", "]", "[", "'graham-campbell/cms-core::comment'", "]", ";", "$", "comment", "=", "new", "$", "model", "(", ")", ";", "return", "new", "Providers", "\\", "CommentProvider", "(", "$", "comment", ")", ";", "}", ")", ";", "}" ]
Register the comment provider class. @return void
[ "Register", "the", "comment", "provider", "class", "." ]
5603e2bfa2fac6cf46ca3ed62d21518f2f653675
https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/CMSCoreServiceProvider.php#L88-L96
17,604
GrahamDeprecated/CMS-Core
src/CMSCoreServiceProvider.php
CMSCoreServiceProvider.registerEventProvider
protected function registerEventProvider() { $this->app->bindShared('eventprovider', function ($app) { $model = $app['config']['graham-campbell/cms-core::event']; $event = new $model(); return new Providers\EventProvider($event); }); }
php
protected function registerEventProvider() { $this->app->bindShared('eventprovider', function ($app) { $model = $app['config']['graham-campbell/cms-core::event']; $event = new $model(); return new Providers\EventProvider($event); }); }
[ "protected", "function", "registerEventProvider", "(", ")", "{", "$", "this", "->", "app", "->", "bindShared", "(", "'eventprovider'", ",", "function", "(", "$", "app", ")", "{", "$", "model", "=", "$", "app", "[", "'config'", "]", "[", "'graham-campbell/cms-core::event'", "]", ";", "$", "event", "=", "new", "$", "model", "(", ")", ";", "return", "new", "Providers", "\\", "EventProvider", "(", "$", "event", ")", ";", "}", ")", ";", "}" ]
Register the event provider class. @return void
[ "Register", "the", "event", "provider", "class", "." ]
5603e2bfa2fac6cf46ca3ed62d21518f2f653675
https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/CMSCoreServiceProvider.php#L103-L111
17,605
GrahamDeprecated/CMS-Core
src/CMSCoreServiceProvider.php
CMSCoreServiceProvider.registerPageProvider
protected function registerPageProvider() { $this->app->bindShared('pageprovider', function ($app) { $model = $app['config']['graham-campbell/cms-core::page']; $page = new $model(); return new Providers\PageProvider($page); }); }
php
protected function registerPageProvider() { $this->app->bindShared('pageprovider', function ($app) { $model = $app['config']['graham-campbell/cms-core::page']; $page = new $model(); return new Providers\PageProvider($page); }); }
[ "protected", "function", "registerPageProvider", "(", ")", "{", "$", "this", "->", "app", "->", "bindShared", "(", "'pageprovider'", ",", "function", "(", "$", "app", ")", "{", "$", "model", "=", "$", "app", "[", "'config'", "]", "[", "'graham-campbell/cms-core::page'", "]", ";", "$", "page", "=", "new", "$", "model", "(", ")", ";", "return", "new", "Providers", "\\", "PageProvider", "(", "$", "page", ")", ";", "}", ")", ";", "}" ]
Register the page provider class. @return void
[ "Register", "the", "page", "provider", "class", "." ]
5603e2bfa2fac6cf46ca3ed62d21518f2f653675
https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/CMSCoreServiceProvider.php#L118-L126
17,606
GrahamDeprecated/CMS-Core
src/CMSCoreServiceProvider.php
CMSCoreServiceProvider.registerPostProvider
protected function registerPostProvider() { $this->app->bindShared('postprovider', function ($app) { $model = $app['config']['graham-campbell/cms-core::post']; $post = new $model(); return new Providers\PostProvider($post); }); }
php
protected function registerPostProvider() { $this->app->bindShared('postprovider', function ($app) { $model = $app['config']['graham-campbell/cms-core::post']; $post = new $model(); return new Providers\PostProvider($post); }); }
[ "protected", "function", "registerPostProvider", "(", ")", "{", "$", "this", "->", "app", "->", "bindShared", "(", "'postprovider'", ",", "function", "(", "$", "app", ")", "{", "$", "model", "=", "$", "app", "[", "'config'", "]", "[", "'graham-campbell/cms-core::post'", "]", ";", "$", "post", "=", "new", "$", "model", "(", ")", ";", "return", "new", "Providers", "\\", "PostProvider", "(", "$", "post", ")", ";", "}", ")", ";", "}" ]
Register the post provider class. @return void
[ "Register", "the", "post", "provider", "class", "." ]
5603e2bfa2fac6cf46ca3ed62d21518f2f653675
https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/CMSCoreServiceProvider.php#L133-L141
17,607
forxer/tao
src/Tao/Templating/Helpers/TitleTag.php
TitleTag.add
public function add($sTitle, $bPrepend = false) { if ($bPrepend) { $this->aTitles = array_reverse($this->aTitles, true); $this->aTitles[$sTitle] = $sTitle; $this->aTitles = array_reverse($this->aTitles, true); } else { $this->aTitles[$sTitle] = $sTitle; } }
php
public function add($sTitle, $bPrepend = false) { if ($bPrepend) { $this->aTitles = array_reverse($this->aTitles, true); $this->aTitles[$sTitle] = $sTitle; $this->aTitles = array_reverse($this->aTitles, true); } else { $this->aTitles[$sTitle] = $sTitle; } }
[ "public", "function", "add", "(", "$", "sTitle", ",", "$", "bPrepend", "=", "false", ")", "{", "if", "(", "$", "bPrepend", ")", "{", "$", "this", "->", "aTitles", "=", "array_reverse", "(", "$", "this", "->", "aTitles", ",", "true", ")", ";", "$", "this", "->", "aTitles", "[", "$", "sTitle", "]", "=", "$", "sTitle", ";", "$", "this", "->", "aTitles", "=", "array_reverse", "(", "$", "this", "->", "aTitles", ",", "true", ")", ";", "}", "else", "{", "$", "this", "->", "aTitles", "[", "$", "sTitle", "]", "=", "$", "sTitle", ";", "}", "}" ]
Add a title tag to the titles tag stack. @param string $sTitle @param boolean $bPrepend
[ "Add", "a", "title", "tag", "to", "the", "titles", "tag", "stack", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/TitleTag.php#L16-L27
17,608
forxer/tao
src/Tao/Templating/Helpers/TitleTag.php
TitleTag.has
public function has($sTitle = null) { if (null === $sTitle) { return !empty($this->aTitles); } return isset($this->aTitles[$sTitle]); }
php
public function has($sTitle = null) { if (null === $sTitle) { return !empty($this->aTitles); } return isset($this->aTitles[$sTitle]); }
[ "public", "function", "has", "(", "$", "sTitle", "=", "null", ")", "{", "if", "(", "null", "===", "$", "sTitle", ")", "{", "return", "!", "empty", "(", "$", "this", "->", "aTitles", ")", ";", "}", "return", "isset", "(", "$", "this", "->", "aTitles", "[", "$", "sTitle", "]", ")", ";", "}" ]
Indicate if a given title tag exists or if there are items in the titles tag stack. @param string $sTitle @return boolean
[ "Indicate", "if", "a", "given", "title", "tag", "exists", "or", "if", "there", "are", "items", "in", "the", "titles", "tag", "stack", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/TitleTag.php#L47-L54
17,609
christianvizarra/laravel-service-provider
src/Publisher/MigrationPublisher.php
MigrationPublisher.getSource
protected function getSource($packagePath) { $sources = [ "{$packagePath}/resources/database/migrations", "{$packagePath}/resources/migrations", "{$packagePath}/migrations", ]; // iterate through all possible locations foreach ($sources as $source) { if ($this->files->isDirectory($source)) { $paths = []; // get all files of the current directory $files = $this->getSourceFiles($source); // iterate through all files foreach ($files as $file) { // if the destination doesn't exist we can add the file to the queue if (!class_exists($this->getClassFromFile($file))) { $paths[$file] = $this->getDestinationPath('migrations', [ date('Y_m_d_His', time()), $this->getFileName($file), ]); } } return $paths; } } throw new InvalidArgumentException('Migrations not found.'); }
php
protected function getSource($packagePath) { $sources = [ "{$packagePath}/resources/database/migrations", "{$packagePath}/resources/migrations", "{$packagePath}/migrations", ]; // iterate through all possible locations foreach ($sources as $source) { if ($this->files->isDirectory($source)) { $paths = []; // get all files of the current directory $files = $this->getSourceFiles($source); // iterate through all files foreach ($files as $file) { // if the destination doesn't exist we can add the file to the queue if (!class_exists($this->getClassFromFile($file))) { $paths[$file] = $this->getDestinationPath('migrations', [ date('Y_m_d_His', time()), $this->getFileName($file), ]); } } return $paths; } } throw new InvalidArgumentException('Migrations not found.'); }
[ "protected", "function", "getSource", "(", "$", "packagePath", ")", "{", "$", "sources", "=", "[", "\"{$packagePath}/resources/database/migrations\"", ",", "\"{$packagePath}/resources/migrations\"", ",", "\"{$packagePath}/migrations\"", ",", "]", ";", "// iterate through all possible locations", "foreach", "(", "$", "sources", "as", "$", "source", ")", "{", "if", "(", "$", "this", "->", "files", "->", "isDirectory", "(", "$", "source", ")", ")", "{", "$", "paths", "=", "[", "]", ";", "// get all files of the current directory", "$", "files", "=", "$", "this", "->", "getSourceFiles", "(", "$", "source", ")", ";", "// iterate through all files", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "// if the destination doesn't exist we can add the file to the queue", "if", "(", "!", "class_exists", "(", "$", "this", "->", "getClassFromFile", "(", "$", "file", ")", ")", ")", "{", "$", "paths", "[", "$", "file", "]", "=", "$", "this", "->", "getDestinationPath", "(", "'migrations'", ",", "[", "date", "(", "'Y_m_d_His'", ",", "time", "(", ")", ")", ",", "$", "this", "->", "getFileName", "(", "$", "file", ")", ",", "]", ")", ";", "}", "}", "return", "$", "paths", ";", "}", "}", "throw", "new", "InvalidArgumentException", "(", "'Migrations not found.'", ")", ";", "}" ]
Get the source assets directory to publish. @param string $packagePath @return string @throws \InvalidArgumentException
[ "Get", "the", "source", "assets", "directory", "to", "publish", "." ]
73e6b664c34ce228d4a3a48ed3b96cf2546ccfee
https://github.com/christianvizarra/laravel-service-provider/blob/73e6b664c34ce228d4a3a48ed3b96cf2546ccfee/src/Publisher/MigrationPublisher.php#L27-L58
17,610
turanct/showpad-api
src/Showpad/Client.php
Client.assetsAdd
public function assetsAdd($file) { $resource = '/assets.json'; $parameters = array( 'file' => '@' . $file, ); // Create request $data = $this->auth->request( 'POST', $resource, $parameters ); return $data; }
php
public function assetsAdd($file) { $resource = '/assets.json'; $parameters = array( 'file' => '@' . $file, ); // Create request $data = $this->auth->request( 'POST', $resource, $parameters ); return $data; }
[ "public", "function", "assetsAdd", "(", "$", "file", ")", "{", "$", "resource", "=", "'/assets.json'", ";", "$", "parameters", "=", "array", "(", "'file'", "=>", "'@'", ".", "$", "file", ",", ")", ";", "// Create request", "$", "data", "=", "$", "this", "->", "auth", "->", "request", "(", "'POST'", ",", "$", "resource", ",", "$", "parameters", ")", ";", "return", "$", "data", ";", "}" ]
Add an asset POST /assets.json @param string $file The path to the file @return array
[ "Add", "an", "asset" ]
6b17a2bb3609b3696529014911287688b54bea19
https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Client.php#L62-L78
17,611
turanct/showpad-api
src/Showpad/Client.php
Client.assetsGet
public function assetsGet($id) { $resource = '/assets/' . $id . '.json'; // Create request $data = $this->auth->request('GET', $resource); return $data; }
php
public function assetsGet($id) { $resource = '/assets/' . $id . '.json'; // Create request $data = $this->auth->request('GET', $resource); return $data; }
[ "public", "function", "assetsGet", "(", "$", "id", ")", "{", "$", "resource", "=", "'/assets/'", ".", "$", "id", ".", "'.json'", ";", "// Create request", "$", "data", "=", "$", "this", "->", "auth", "->", "request", "(", "'GET'", ",", "$", "resource", ")", ";", "return", "$", "data", ";", "}" ]
Get an asset by id GET /assets/{id}.json @param string $id The asset id @return array
[ "Get", "an", "asset", "by", "id" ]
6b17a2bb3609b3696529014911287688b54bea19
https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Client.php#L89-L97
17,612
turanct/showpad-api
src/Showpad/Client.php
Client.assetsDelete
public function assetsDelete($id) { $resource = '/assets/' . $id . '.json'; // Create request $data = $this->auth->request('DELETE', $resource); return $data; }
php
public function assetsDelete($id) { $resource = '/assets/' . $id . '.json'; // Create request $data = $this->auth->request('DELETE', $resource); return $data; }
[ "public", "function", "assetsDelete", "(", "$", "id", ")", "{", "$", "resource", "=", "'/assets/'", ".", "$", "id", ".", "'.json'", ";", "// Create request", "$", "data", "=", "$", "this", "->", "auth", "->", "request", "(", "'DELETE'", ",", "$", "resource", ")", ";", "return", "$", "data", ";", "}" ]
Delete asset by id DELETE /assets/{id}.json @param string $id The asset id @return array
[ "Delete", "asset", "by", "id" ]
6b17a2bb3609b3696529014911287688b54bea19
https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Client.php#L108-L116
17,613
turanct/showpad-api
src/Showpad/Client.php
Client.assetsTagsAddById
public function assetsTagsAddById($id, $tag) { $resource = '/assets/' . $id . '/tags/' . $tag . '.json'; $parameters = array( 'query' => array('method' => 'link'), ); // Create request $data = $this->auth->request( 'GET', $resource, $parameters ); return $data; }
php
public function assetsTagsAddById($id, $tag) { $resource = '/assets/' . $id . '/tags/' . $tag . '.json'; $parameters = array( 'query' => array('method' => 'link'), ); // Create request $data = $this->auth->request( 'GET', $resource, $parameters ); return $data; }
[ "public", "function", "assetsTagsAddById", "(", "$", "id", ",", "$", "tag", ")", "{", "$", "resource", "=", "'/assets/'", ".", "$", "id", ".", "'/tags/'", ".", "$", "tag", ".", "'.json'", ";", "$", "parameters", "=", "array", "(", "'query'", "=>", "array", "(", "'method'", "=>", "'link'", ")", ",", ")", ";", "// Create request", "$", "data", "=", "$", "this", "->", "auth", "->", "request", "(", "'GET'", ",", "$", "resource", ",", "$", "parameters", ")", ";", "return", "$", "data", ";", "}" ]
Add a tag to an asset by tag id POST /assets/{id}/tags.json @param string $id The asset id @param string $tag The tag id @return array
[ "Add", "a", "tag", "to", "an", "asset", "by", "tag", "id" ]
6b17a2bb3609b3696529014911287688b54bea19
https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Client.php#L156-L172
17,614
turanct/showpad-api
src/Showpad/Client.php
Client.tagsList
public function tagsList($limit = 25, $offset = 0) { $resource = '/tags.json'; // Create request $data = $this->auth->request( 'GET', $resource, array('query' => array('limit' => (int) $limit, 'offset' => (int) $offset)) ); return $data; }
php
public function tagsList($limit = 25, $offset = 0) { $resource = '/tags.json'; // Create request $data = $this->auth->request( 'GET', $resource, array('query' => array('limit' => (int) $limit, 'offset' => (int) $offset)) ); return $data; }
[ "public", "function", "tagsList", "(", "$", "limit", "=", "25", ",", "$", "offset", "=", "0", ")", "{", "$", "resource", "=", "'/tags.json'", ";", "// Create request", "$", "data", "=", "$", "this", "->", "auth", "->", "request", "(", "'GET'", ",", "$", "resource", ",", "array", "(", "'query'", "=>", "array", "(", "'limit'", "=>", "(", "int", ")", "$", "limit", ",", "'offset'", "=>", "(", "int", ")", "$", "offset", ")", ")", ")", ";", "return", "$", "data", ";", "}" ]
Get a list of existing tags GET /tags.json @param int $limit The max number of items we want to retrieve @param int $offset The number of items to skip from the top of the list @return array
[ "Get", "a", "list", "of", "existing", "tags" ]
6b17a2bb3609b3696529014911287688b54bea19
https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Client.php#L225-L237
17,615
turanct/showpad-api
src/Showpad/Client.php
Client.ticketsGet
public function ticketsGet($id) { $resource = '/tickets/' . $id . '.json'; // Create request $data = $this->auth->request('GET', $resource); return $data; }
php
public function ticketsGet($id) { $resource = '/tickets/' . $id . '.json'; // Create request $data = $this->auth->request('GET', $resource); return $data; }
[ "public", "function", "ticketsGet", "(", "$", "id", ")", "{", "$", "resource", "=", "'/tickets/'", ".", "$", "id", ".", "'.json'", ";", "// Create request", "$", "data", "=", "$", "this", "->", "auth", "->", "request", "(", "'GET'", ",", "$", "resource", ")", ";", "return", "$", "data", ";", "}" ]
Get a ticket by id GET /tickets/{id}.json @param string $id The ticket id @return array
[ "Get", "a", "ticket", "by", "id" ]
6b17a2bb3609b3696529014911287688b54bea19
https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Client.php#L266-L274
17,616
turanct/showpad-api
src/Showpad/Client.php
Client.tagAssetsList
public function tagAssetsList($tagId, $limit = 25, $offset = 0) { return $this->auth->request( 'GET', '/tags/' . $tagId . '/assets.json', array('query' => array('limit' => (int) $limit, 'offset' => (int) $offset)) ); }
php
public function tagAssetsList($tagId, $limit = 25, $offset = 0) { return $this->auth->request( 'GET', '/tags/' . $tagId . '/assets.json', array('query' => array('limit' => (int) $limit, 'offset' => (int) $offset)) ); }
[ "public", "function", "tagAssetsList", "(", "$", "tagId", ",", "$", "limit", "=", "25", ",", "$", "offset", "=", "0", ")", "{", "return", "$", "this", "->", "auth", "->", "request", "(", "'GET'", ",", "'/tags/'", ".", "$", "tagId", ".", "'/assets.json'", ",", "array", "(", "'query'", "=>", "array", "(", "'limit'", "=>", "(", "int", ")", "$", "limit", ",", "'offset'", "=>", "(", "int", ")", "$", "offset", ")", ")", ")", ";", "}" ]
Get a list of assets coupled to a certain tag GET /tags/{id}/assets.json @param int $limit The max number of items we want to retrieve @param int $offset The number of items to skip from the top of the list @return array
[ "Get", "a", "list", "of", "assets", "coupled", "to", "a", "certain", "tag" ]
6b17a2bb3609b3696529014911287688b54bea19
https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Client.php#L286-L293
17,617
turanct/showpad-api
src/Showpad/Client.php
Client.channelsList
public function channelsList($limit = 25, $offset = 0) { return $this->auth->request( 'GET', '/channels.json', array('query' => array('limit' => (int) $limit, 'offset' => (int) $offset)) ); }
php
public function channelsList($limit = 25, $offset = 0) { return $this->auth->request( 'GET', '/channels.json', array('query' => array('limit' => (int) $limit, 'offset' => (int) $offset)) ); }
[ "public", "function", "channelsList", "(", "$", "limit", "=", "25", ",", "$", "offset", "=", "0", ")", "{", "return", "$", "this", "->", "auth", "->", "request", "(", "'GET'", ",", "'/channels.json'", ",", "array", "(", "'query'", "=>", "array", "(", "'limit'", "=>", "(", "int", ")", "$", "limit", ",", "'offset'", "=>", "(", "int", ")", "$", "offset", ")", ")", ")", ";", "}" ]
Get a list of existing channels @note: this works only with API v3 GET /channels.json @param int $limit The max number of items we want to retrieve @param int $offset The number of items to skip from the top of the list @return array
[ "Get", "a", "list", "of", "existing", "channels" ]
6b17a2bb3609b3696529014911287688b54bea19
https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Client.php#L307-L314
17,618
GrahamDeprecated/CMS-Core
src/Models/User.php
User.beforeDelete
public function beforeDelete() { $this->invites()->sync(array()); $this->deletePages(); $this->deletePosts(); $this->deleteEvents(); $this->deleteComments(); }
php
public function beforeDelete() { $this->invites()->sync(array()); $this->deletePages(); $this->deletePosts(); $this->deleteEvents(); $this->deleteComments(); }
[ "public", "function", "beforeDelete", "(", ")", "{", "$", "this", "->", "invites", "(", ")", "->", "sync", "(", "array", "(", ")", ")", ";", "$", "this", "->", "deletePages", "(", ")", ";", "$", "this", "->", "deletePosts", "(", ")", ";", "$", "this", "->", "deleteEvents", "(", ")", ";", "$", "this", "->", "deleteComments", "(", ")", ";", "}" ]
Before deleting an existing model. @return mixed
[ "Before", "deleting", "an", "existing", "model", "." ]
5603e2bfa2fac6cf46ca3ed62d21518f2f653675
https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/Models/User.php#L49-L56
17,619
2amigos/yiifoundation
helpers/Alert.php
Alert.success
public static function success($content, $htmlOptions = array(), $close = '&times') { ArrayHelper::addValue('class', Enum::COLOR_SUCCESS, $htmlOptions); return static::alert($content, $htmlOptions, $close); }
php
public static function success($content, $htmlOptions = array(), $close = '&times') { ArrayHelper::addValue('class', Enum::COLOR_SUCCESS, $htmlOptions); return static::alert($content, $htmlOptions, $close); }
[ "public", "static", "function", "success", "(", "$", "content", ",", "$", "htmlOptions", "=", "array", "(", ")", ",", "$", "close", "=", "'&times'", ")", "{", "ArrayHelper", "::", "addValue", "(", "'class'", ",", "Enum", "::", "COLOR_SUCCESS", ",", "$", "htmlOptions", ")", ";", "return", "static", "::", "alert", "(", "$", "content", ",", "$", "htmlOptions", ",", "$", "close", ")", ";", "}" ]
Generates a success alert @param string $content the text within the alert box @param array $htmlOptions the HTML attributes of the alert box @param string $close the label for the close button. Set to false if you don't wish to display it. @return string the alert box
[ "Generates", "a", "success", "alert" ]
49bed0d3ca1a9bac9299000e48a2661bdc8f9a29
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Alert.php#L28-L32
17,620
2amigos/yiifoundation
helpers/Alert.php
Alert.important
public static function important($content, $htmlOptions = array(), $close = '&times') { ArrayHelper::addValue('class', Enum::COLOR_ALERT, $htmlOptions); return static::alert($content, $htmlOptions, $close); }
php
public static function important($content, $htmlOptions = array(), $close = '&times') { ArrayHelper::addValue('class', Enum::COLOR_ALERT, $htmlOptions); return static::alert($content, $htmlOptions, $close); }
[ "public", "static", "function", "important", "(", "$", "content", ",", "$", "htmlOptions", "=", "array", "(", ")", ",", "$", "close", "=", "'&times'", ")", "{", "ArrayHelper", "::", "addValue", "(", "'class'", ",", "Enum", "::", "COLOR_ALERT", ",", "$", "htmlOptions", ")", ";", "return", "static", "::", "alert", "(", "$", "content", ",", "$", "htmlOptions", ",", "$", "close", ")", ";", "}" ]
Generates an red coloured alert box @param string $content the text within the alert box @param array $htmlOptions the HTML attributes of the alert box @param string $close the label for the close button. Set to false if you don't wish to display it. @return string the alert box
[ "Generates", "an", "red", "coloured", "alert", "box" ]
49bed0d3ca1a9bac9299000e48a2661bdc8f9a29
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Alert.php#L42-L46
17,621
2amigos/yiifoundation
helpers/Alert.php
Alert.secondary
public static function secondary($content, $htmlOptions = array(), $close = '&times') { ArrayHelper::addValue('class', Enum::COLOR_SECONDARY, $htmlOptions); return static::alert($content, $htmlOptions, $close); }
php
public static function secondary($content, $htmlOptions = array(), $close = '&times') { ArrayHelper::addValue('class', Enum::COLOR_SECONDARY, $htmlOptions); return static::alert($content, $htmlOptions, $close); }
[ "public", "static", "function", "secondary", "(", "$", "content", ",", "$", "htmlOptions", "=", "array", "(", ")", ",", "$", "close", "=", "'&times'", ")", "{", "ArrayHelper", "::", "addValue", "(", "'class'", ",", "Enum", "::", "COLOR_SECONDARY", ",", "$", "htmlOptions", ")", ";", "return", "static", "::", "alert", "(", "$", "content", ",", "$", "htmlOptions", ",", "$", "close", ")", ";", "}" ]
Generates a secondary alert box @param string $content the text within the alert box @param array $htmlOptions the HTML attributes of the alert box @param string $close the label for the close button. Set to false if you don't wish to display it. @return string the alert box
[ "Generates", "a", "secondary", "alert", "box" ]
49bed0d3ca1a9bac9299000e48a2661bdc8f9a29
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Alert.php#L56-L60
17,622
2amigos/yiifoundation
helpers/Alert.php
Alert.alert
public static function alert($content, $htmlOptions = array(), $close = '&times') { ArrayHelper::addValue('class', 'alert-box', $htmlOptions); ob_start(); echo '<div data-alert ' . \CHtml::renderAttributes($htmlOptions) . '>'; echo $content; if ($close !== false) echo static::closeLink($close); echo '</div>'; return ob_get_clean(); }
php
public static function alert($content, $htmlOptions = array(), $close = '&times') { ArrayHelper::addValue('class', 'alert-box', $htmlOptions); ob_start(); echo '<div data-alert ' . \CHtml::renderAttributes($htmlOptions) . '>'; echo $content; if ($close !== false) echo static::closeLink($close); echo '</div>'; return ob_get_clean(); }
[ "public", "static", "function", "alert", "(", "$", "content", ",", "$", "htmlOptions", "=", "array", "(", ")", ",", "$", "close", "=", "'&times'", ")", "{", "ArrayHelper", "::", "addValue", "(", "'class'", ",", "'alert-box'", ",", "$", "htmlOptions", ")", ";", "ob_start", "(", ")", ";", "echo", "'<div data-alert '", ".", "\\", "CHtml", "::", "renderAttributes", "(", "$", "htmlOptions", ")", ".", "'>'", ";", "echo", "$", "content", ";", "if", "(", "$", "close", "!==", "false", ")", "echo", "static", "::", "closeLink", "(", "$", "close", ")", ";", "echo", "'</div>'", ";", "return", "ob_get_clean", "(", ")", ";", "}" ]
Returns an alert box @param string $content the text within the alert box @param array $htmlOptions the HTML attributes of the alert box @param string $close the label for the close button. Set to false if you don't wish to display it. @return string the alert box @see http://foundation.zurb.com/docs/components/alert-boxes.html
[ "Returns", "an", "alert", "box" ]
49bed0d3ca1a9bac9299000e48a2661bdc8f9a29
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Alert.php#L71-L82
17,623
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/Sub/ContentTypeGroupSubManager.php
ContentTypeGroupSubManager.detachContentTypeGroupsByIdentifiers
private function detachContentTypeGroupsByIdentifiers(ContentType $contentType, array $contentTypeGroupsIdentifiers) { $contentTypeGroups = $this->loadContentTypeGroupsByIdentifiers($contentTypeGroupsIdentifiers); foreach ($contentTypeGroups as $contentTypeGroup) { $this->contentTypeService->unassignContentTypeGroup($contentType, $contentTypeGroup); } }
php
private function detachContentTypeGroupsByIdentifiers(ContentType $contentType, array $contentTypeGroupsIdentifiers) { $contentTypeGroups = $this->loadContentTypeGroupsByIdentifiers($contentTypeGroupsIdentifiers); foreach ($contentTypeGroups as $contentTypeGroup) { $this->contentTypeService->unassignContentTypeGroup($contentType, $contentTypeGroup); } }
[ "private", "function", "detachContentTypeGroupsByIdentifiers", "(", "ContentType", "$", "contentType", ",", "array", "$", "contentTypeGroupsIdentifiers", ")", "{", "$", "contentTypeGroups", "=", "$", "this", "->", "loadContentTypeGroupsByIdentifiers", "(", "$", "contentTypeGroupsIdentifiers", ")", ";", "foreach", "(", "$", "contentTypeGroups", "as", "$", "contentTypeGroup", ")", "{", "$", "this", "->", "contentTypeService", "->", "unassignContentTypeGroup", "(", "$", "contentType", ",", "$", "contentTypeGroup", ")", ";", "}", "}" ]
Load contenttype groups, and unassign them from a contenttype. @param ContentType $contentType @param array $contentTypeGroupsIdentifiers @throws NotFoundException
[ "Load", "contenttype", "groups", "and", "unassign", "them", "from", "a", "contenttype", "." ]
1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/Sub/ContentTypeGroupSubManager.php#L149-L155
17,624
php-rise/rise
src/Router/UrlGenerator.php
UrlGenerator.compile
protected function compile($name) { if (!isset($this->raw[$name])) { return; } $count = preg_match_all( self::ROUTE_PARAM_PATTERN, $this->raw[$name], $matches, PREG_OFFSET_CAPTURE ); if ($count === 0) { $this->compiled[$name] = $this->raw[$name]; } else if ($count > 0) { $routePath = $this->raw[$name]; $params = []; $chunks = []; $pos = 0; for ($i = 0; $i < $count; $i++) { $chunks[] = substr($routePath, $pos, $matches[1][$i][1] - $pos); $size = array_push($chunks, ''); // Empty string is just a placeholder, it can be anything $params[$matches[2][$i][0]] = $size - 1; // Set index $pos = $matches[1][$i][1] + strlen($matches[1][$i][0]); } $chunks[] = substr($routePath, $pos); $this->compiled[$name] = [ 'params' => $params, 'chunks' => $chunks, ]; } }
php
protected function compile($name) { if (!isset($this->raw[$name])) { return; } $count = preg_match_all( self::ROUTE_PARAM_PATTERN, $this->raw[$name], $matches, PREG_OFFSET_CAPTURE ); if ($count === 0) { $this->compiled[$name] = $this->raw[$name]; } else if ($count > 0) { $routePath = $this->raw[$name]; $params = []; $chunks = []; $pos = 0; for ($i = 0; $i < $count; $i++) { $chunks[] = substr($routePath, $pos, $matches[1][$i][1] - $pos); $size = array_push($chunks, ''); // Empty string is just a placeholder, it can be anything $params[$matches[2][$i][0]] = $size - 1; // Set index $pos = $matches[1][$i][1] + strlen($matches[1][$i][0]); } $chunks[] = substr($routePath, $pos); $this->compiled[$name] = [ 'params' => $params, 'chunks' => $chunks, ]; } }
[ "protected", "function", "compile", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "raw", "[", "$", "name", "]", ")", ")", "{", "return", ";", "}", "$", "count", "=", "preg_match_all", "(", "self", "::", "ROUTE_PARAM_PATTERN", ",", "$", "this", "->", "raw", "[", "$", "name", "]", ",", "$", "matches", ",", "PREG_OFFSET_CAPTURE", ")", ";", "if", "(", "$", "count", "===", "0", ")", "{", "$", "this", "->", "compiled", "[", "$", "name", "]", "=", "$", "this", "->", "raw", "[", "$", "name", "]", ";", "}", "else", "if", "(", "$", "count", ">", "0", ")", "{", "$", "routePath", "=", "$", "this", "->", "raw", "[", "$", "name", "]", ";", "$", "params", "=", "[", "]", ";", "$", "chunks", "=", "[", "]", ";", "$", "pos", "=", "0", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "i", "++", ")", "{", "$", "chunks", "[", "]", "=", "substr", "(", "$", "routePath", ",", "$", "pos", ",", "$", "matches", "[", "1", "]", "[", "$", "i", "]", "[", "1", "]", "-", "$", "pos", ")", ";", "$", "size", "=", "array_push", "(", "$", "chunks", ",", "''", ")", ";", "// Empty string is just a placeholder, it can be anything", "$", "params", "[", "$", "matches", "[", "2", "]", "[", "$", "i", "]", "[", "0", "]", "]", "=", "$", "size", "-", "1", ";", "// Set index", "$", "pos", "=", "$", "matches", "[", "1", "]", "[", "$", "i", "]", "[", "1", "]", "+", "strlen", "(", "$", "matches", "[", "1", "]", "[", "$", "i", "]", "[", "0", "]", ")", ";", "}", "$", "chunks", "[", "]", "=", "substr", "(", "$", "routePath", ",", "$", "pos", ")", ";", "$", "this", "->", "compiled", "[", "$", "name", "]", "=", "[", "'params'", "=>", "$", "params", ",", "'chunks'", "=>", "$", "chunks", ",", "]", ";", "}", "}" ]
Compile raw route to a format for generation. @param string $name
[ "Compile", "raw", "route", "to", "a", "format", "for", "generation", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Router/UrlGenerator.php#L69-L100
17,625
php-rise/rise
src/Router/UrlGenerator.php
UrlGenerator.getCompiledRoute
protected function getCompiledRoute($name) { if (!isset($this->compiled[$name])) { $this->compile($name); } return isset($this->compiled[$name]) ? $this->compiled[$name] : null; }
php
protected function getCompiledRoute($name) { if (!isset($this->compiled[$name])) { $this->compile($name); } return isset($this->compiled[$name]) ? $this->compiled[$name] : null; }
[ "protected", "function", "getCompiledRoute", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "compiled", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "compile", "(", "$", "name", ")", ";", "}", "return", "isset", "(", "$", "this", "->", "compiled", "[", "$", "name", "]", ")", "?", "$", "this", "->", "compiled", "[", "$", "name", "]", ":", "null", ";", "}" ]
Get a compiled route. @param string $name @return string|array|null
[ "Get", "a", "compiled", "route", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Router/UrlGenerator.php#L108-L114
17,626
php-rise/rise
src/Router/UrlGenerator.php
UrlGenerator.generatePath
protected function generatePath($name, $params = []) { $result = ''; $compiledRoute = $this->getCompiledRoute($name); if (is_string($compiledRoute)) { $result = $compiledRoute; } else if (is_array($compiledRoute)) { $chunks = $compiledRoute['chunks']; foreach ($params as $paramName => $value) { if (isset($compiledRoute['params'][$paramName])) { $index = $compiledRoute['params'][$paramName]; $chunks[$index] = $value; } } $result = implode($chunks); } return $result; }
php
protected function generatePath($name, $params = []) { $result = ''; $compiledRoute = $this->getCompiledRoute($name); if (is_string($compiledRoute)) { $result = $compiledRoute; } else if (is_array($compiledRoute)) { $chunks = $compiledRoute['chunks']; foreach ($params as $paramName => $value) { if (isset($compiledRoute['params'][$paramName])) { $index = $compiledRoute['params'][$paramName]; $chunks[$index] = $value; } } $result = implode($chunks); } return $result; }
[ "protected", "function", "generatePath", "(", "$", "name", ",", "$", "params", "=", "[", "]", ")", "{", "$", "result", "=", "''", ";", "$", "compiledRoute", "=", "$", "this", "->", "getCompiledRoute", "(", "$", "name", ")", ";", "if", "(", "is_string", "(", "$", "compiledRoute", ")", ")", "{", "$", "result", "=", "$", "compiledRoute", ";", "}", "else", "if", "(", "is_array", "(", "$", "compiledRoute", ")", ")", "{", "$", "chunks", "=", "$", "compiledRoute", "[", "'chunks'", "]", ";", "foreach", "(", "$", "params", "as", "$", "paramName", "=>", "$", "value", ")", "{", "if", "(", "isset", "(", "$", "compiledRoute", "[", "'params'", "]", "[", "$", "paramName", "]", ")", ")", "{", "$", "index", "=", "$", "compiledRoute", "[", "'params'", "]", "[", "$", "paramName", "]", ";", "$", "chunks", "[", "$", "index", "]", "=", "$", "value", ";", "}", "}", "$", "result", "=", "implode", "(", "$", "chunks", ")", ";", "}", "return", "$", "result", ";", "}" ]
Generate path from compiled route. @param string $name @param array $params @return string
[ "Generate", "path", "from", "compiled", "route", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Router/UrlGenerator.php#L123-L141
17,627
webforge-labs/psc-cms
lib/Psc/Form/HTML.php
HTML.select
public static function select($name, $options, $selected = NULL, Array $attributes = NULL) { $name = self::getName($name); if (is_string($options)) { // nothing, wir haben hier vermutlich schon was zusammengebaut, was so hinkommt } else { $options = self::selectOptions($options, $selected); } $select = static::tag('select',$options, $attributes) ->setAttribute('name',$name) ->setGlueContent("%s \n"); return $select; }
php
public static function select($name, $options, $selected = NULL, Array $attributes = NULL) { $name = self::getName($name); if (is_string($options)) { // nothing, wir haben hier vermutlich schon was zusammengebaut, was so hinkommt } else { $options = self::selectOptions($options, $selected); } $select = static::tag('select',$options, $attributes) ->setAttribute('name',$name) ->setGlueContent("%s \n"); return $select; }
[ "public", "static", "function", "select", "(", "$", "name", ",", "$", "options", ",", "$", "selected", "=", "NULL", ",", "Array", "$", "attributes", "=", "NULL", ")", "{", "$", "name", "=", "self", "::", "getName", "(", "$", "name", ")", ";", "if", "(", "is_string", "(", "$", "options", ")", ")", "{", "// nothing, wir haben hier vermutlich schon was zusammengebaut, was so hinkommt", "}", "else", "{", "$", "options", "=", "self", "::", "selectOptions", "(", "$", "options", ",", "$", "selected", ")", ";", "}", "$", "select", "=", "static", "::", "tag", "(", "'select'", ",", "$", "options", ",", "$", "attributes", ")", "->", "setAttribute", "(", "'name'", ",", "$", "name", ")", "->", "setGlueContent", "(", "\"%s \\n\"", ")", ";", "return", "$", "select", ";", "}" ]
Erstellt ein Select Element @param string $name @param HTMLTag[] $options @param mixed $selected das Ausgewählte elemt (muss die value einer option sein) @param Array $attributes @return HTMLTag
[ "Erstellt", "ein", "Select", "Element" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Form/HTML.php#L90-L104
17,628
crypto-markets/common
src/Common/GatewayFactory.php
GatewayFactory.create
public function create($abstract, array $options = []) { $concrete = $this->getConcrete($abstract); if (class_exists($concrete)) { return new $concrete($options); } throw new InvalidArgumentException("The gateway of [$abstract] not supported."); }
php
public function create($abstract, array $options = []) { $concrete = $this->getConcrete($abstract); if (class_exists($concrete)) { return new $concrete($options); } throw new InvalidArgumentException("The gateway of [$abstract] not supported."); }
[ "public", "function", "create", "(", "$", "abstract", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "concrete", "=", "$", "this", "->", "getConcrete", "(", "$", "abstract", ")", ";", "if", "(", "class_exists", "(", "$", "concrete", ")", ")", "{", "return", "new", "$", "concrete", "(", "$", "options", ")", ";", "}", "throw", "new", "InvalidArgumentException", "(", "\"The gateway of [$abstract] not supported.\"", ")", ";", "}" ]
Create an instance of the specified market driver. @param string $abstract @param array $options @return \CryptoMarkets\Common\Gateway @throws \InvalidArgumentException
[ "Create", "an", "instance", "of", "the", "specified", "market", "driver", "." ]
206b1d9b88502d3fb73cef1323cd086156d3e633
https://github.com/crypto-markets/common/blob/206b1d9b88502d3fb73cef1323cd086156d3e633/src/Common/GatewayFactory.php#L18-L27
17,629
boekkooi/tactician-amqp
src/Publisher/MessageCapturer.php
MessageCapturer.fetchMessages
public function fetchMessages($clear = true) { $messages = $this->messages; if ($clear) { $this->clear(); } return $messages; }
php
public function fetchMessages($clear = true) { $messages = $this->messages; if ($clear) { $this->clear(); } return $messages; }
[ "public", "function", "fetchMessages", "(", "$", "clear", "=", "true", ")", "{", "$", "messages", "=", "$", "this", "->", "messages", ";", "if", "(", "$", "clear", ")", "{", "$", "this", "->", "clear", "(", ")", ";", "}", "return", "$", "messages", ";", "}" ]
Fetch the captured messages. @param bool $clear Clear the stored messages @return Message[]
[ "Fetch", "the", "captured", "messages", "." ]
55cbb8b9e20aab7891e6a6090b248377c599360e
https://github.com/boekkooi/tactician-amqp/blob/55cbb8b9e20aab7891e6a6090b248377c599360e/src/Publisher/MessageCapturer.php#L33-L41
17,630
inc2734/wp-share-buttons
src/App/Model/Count_Cache.php
Count_Cache.update
public function update( $count ) { update_post_meta( $this->post_id, '_inc2734_count_cache_' . $this->service_name, [ 'count' => $count, 'expiration' => time() + (int) apply_filters( 'inc2734_wp_share_buttons_count_cache_seconds', 60 * 5 ), ] ); }
php
public function update( $count ) { update_post_meta( $this->post_id, '_inc2734_count_cache_' . $this->service_name, [ 'count' => $count, 'expiration' => time() + (int) apply_filters( 'inc2734_wp_share_buttons_count_cache_seconds', 60 * 5 ), ] ); }
[ "public", "function", "update", "(", "$", "count", ")", "{", "update_post_meta", "(", "$", "this", "->", "post_id", ",", "'_inc2734_count_cache_'", ".", "$", "this", "->", "service_name", ",", "[", "'count'", "=>", "$", "count", ",", "'expiration'", "=>", "time", "(", ")", "+", "(", "int", ")", "apply_filters", "(", "'inc2734_wp_share_buttons_count_cache_seconds'", ",", "60", "*", "5", ")", ",", "]", ")", ";", "}" ]
Update count cache @return bool
[ "Update", "count", "cache" ]
cd032893ca083a343f5871e855cce68f4ede3a17
https://github.com/inc2734/wp-share-buttons/blob/cd032893ca083a343f5871e855cce68f4ede3a17/src/App/Model/Count_Cache.php#L73-L82
17,631
yuncms/framework
src/base/Collection.php
Collection.only
public function only(array $keys): array { $return = []; foreach ($keys as $key) { $value = $this->get($key); if (!is_null($value)) { $return[$key] = $value; } } return $return; }
php
public function only(array $keys): array { $return = []; foreach ($keys as $key) { $value = $this->get($key); if (!is_null($value)) { $return[$key] = $value; } } return $return; }
[ "public", "function", "only", "(", "array", "$", "keys", ")", ":", "array", "{", "$", "return", "=", "[", "]", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "$", "value", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "!", "is_null", "(", "$", "value", ")", ")", "{", "$", "return", "[", "$", "key", "]", "=", "$", "value", ";", "}", "}", "return", "$", "return", ";", "}" ]
Return specific items. @param array $keys @return array
[ "Return", "specific", "items", "." ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/base/Collection.php#L86-L96
17,632
webforge-labs/psc-cms
lib/PHPWord/PHPWord/Style/Paragraph.php
PHPWord_Style_Paragraph.setAlign
public function setAlign($pValue = null) { if(strtolower($pValue) == 'justify') { // justify becames both $pValue = 'both'; } $this->_align = $pValue; return $this; }
php
public function setAlign($pValue = null) { if(strtolower($pValue) == 'justify') { // justify becames both $pValue = 'both'; } $this->_align = $pValue; return $this; }
[ "public", "function", "setAlign", "(", "$", "pValue", "=", "null", ")", "{", "if", "(", "strtolower", "(", "$", "pValue", ")", "==", "'justify'", ")", "{", "// justify becames both\r", "$", "pValue", "=", "'both'", ";", "}", "$", "this", "->", "_align", "=", "$", "pValue", ";", "return", "$", "this", ";", "}" ]
Set Paragraph Alignment @param string $pValue @return PHPWord_Style_Paragraph
[ "Set", "Paragraph", "Alignment" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Style/Paragraph.php#L105-L112
17,633
redaigbaria/oauth2
src/AuthorizationServer.php
AuthorizationServer.addGrantType
public function addGrantType(GrantTypeInterface $grantType, $identifier = null) { if (is_null($identifier)) { $identifier = $grantType->getIdentifier(); } // Inject server into grant $grantType->setAuthorizationServer($this); $this->grantTypes[$identifier] = $grantType; if (!is_null($grantType->getResponseType())) { $this->responseTypes[] = $grantType->getResponseType(); } return $this; }
php
public function addGrantType(GrantTypeInterface $grantType, $identifier = null) { if (is_null($identifier)) { $identifier = $grantType->getIdentifier(); } // Inject server into grant $grantType->setAuthorizationServer($this); $this->grantTypes[$identifier] = $grantType; if (!is_null($grantType->getResponseType())) { $this->responseTypes[] = $grantType->getResponseType(); } return $this; }
[ "public", "function", "addGrantType", "(", "GrantTypeInterface", "$", "grantType", ",", "$", "identifier", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "identifier", ")", ")", "{", "$", "identifier", "=", "$", "grantType", "->", "getIdentifier", "(", ")", ";", "}", "// Inject server into grant", "$", "grantType", "->", "setAuthorizationServer", "(", "$", "this", ")", ";", "$", "this", "->", "grantTypes", "[", "$", "identifier", "]", "=", "$", "grantType", ";", "if", "(", "!", "is_null", "(", "$", "grantType", "->", "getResponseType", "(", ")", ")", ")", "{", "$", "this", "->", "responseTypes", "[", "]", "=", "$", "grantType", "->", "getResponseType", "(", ")", ";", "}", "return", "$", "this", ";", "}" ]
Enable support for a grant @param GrantTypeInterface $grantType A grant class which conforms to Interface/GrantTypeInterface @param null|string $identifier An identifier for the grant (autodetected if not passed) @return self
[ "Enable", "support", "for", "a", "grant" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AuthorizationServer.php#L95-L111
17,634
redaigbaria/oauth2
src/AuthorizationServer.php
AuthorizationServer.issueAccessToken
public function issueAccessToken() { $grantType = $this->getRequest()->request->get('grant_type'); if (is_null($grantType)) { throw new Exception\InvalidRequestException('grant_type'); } // Ensure grant type is one that is recognised and is enabled if (!in_array($grantType, array_keys($this->grantTypes))) { throw new Exception\UnsupportedGrantTypeException($grantType); } // Complete the flow return $this->getGrantType($grantType)->completeFlow(); }
php
public function issueAccessToken() { $grantType = $this->getRequest()->request->get('grant_type'); if (is_null($grantType)) { throw new Exception\InvalidRequestException('grant_type'); } // Ensure grant type is one that is recognised and is enabled if (!in_array($grantType, array_keys($this->grantTypes))) { throw new Exception\UnsupportedGrantTypeException($grantType); } // Complete the flow return $this->getGrantType($grantType)->completeFlow(); }
[ "public", "function", "issueAccessToken", "(", ")", "{", "$", "grantType", "=", "$", "this", "->", "getRequest", "(", ")", "->", "request", "->", "get", "(", "'grant_type'", ")", ";", "if", "(", "is_null", "(", "$", "grantType", ")", ")", "{", "throw", "new", "Exception", "\\", "InvalidRequestException", "(", "'grant_type'", ")", ";", "}", "// Ensure grant type is one that is recognised and is enabled", "if", "(", "!", "in_array", "(", "$", "grantType", ",", "array_keys", "(", "$", "this", "->", "grantTypes", ")", ")", ")", "{", "throw", "new", "Exception", "\\", "UnsupportedGrantTypeException", "(", "$", "grantType", ")", ";", "}", "// Complete the flow", "return", "$", "this", "->", "getGrantType", "(", "$", "grantType", ")", "->", "completeFlow", "(", ")", ";", "}" ]
Issue an access token @return array Authorise request parameters @throws
[ "Issue", "an", "access", "token" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AuthorizationServer.php#L262-L276
17,635
redaigbaria/oauth2
src/AuthorizationServer.php
AuthorizationServer.getGrantType
public function getGrantType($grantType) { if (isset($this->grantTypes[$grantType])) { return $this->grantTypes[$grantType]; } throw new Exception\InvalidGrantException($grantType); }
php
public function getGrantType($grantType) { if (isset($this->grantTypes[$grantType])) { return $this->grantTypes[$grantType]; } throw new Exception\InvalidGrantException($grantType); }
[ "public", "function", "getGrantType", "(", "$", "grantType", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "grantTypes", "[", "$", "grantType", "]", ")", ")", "{", "return", "$", "this", "->", "grantTypes", "[", "$", "grantType", "]", ";", "}", "throw", "new", "Exception", "\\", "InvalidGrantException", "(", "$", "grantType", ")", ";", "}" ]
Return a grant type class @param string $grantType The grant type identifier @return Grant\GrantTypeInterface @throws
[ "Return", "a", "grant", "type", "class" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AuthorizationServer.php#L287-L294
17,636
2amigos/yiifoundation
widgets/SwitchButton.php
SwitchButton.renderButtons
public function renderButtons() { list($name, $id) = $this->resolveNameID(); $buttons = array(); $checked = $this->hasModel() ? (!$this->model->{$this->attribute}) : true; $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_on', 'value' => 1)); $buttons[] = \CHtml::label($this->offLabel, $id . '_on'); $checked = $checked ? false : true; $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_off', 'value' => 1)); $buttons[] = \CHtml::label($this->onLabel, $id . '_off'); $buttons[] = '<span></span>'; return \CHtml::tag('div', $this->htmlOptions, implode("\n", $buttons)); }
php
public function renderButtons() { list($name, $id) = $this->resolveNameID(); $buttons = array(); $checked = $this->hasModel() ? (!$this->model->{$this->attribute}) : true; $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_on', 'value' => 1)); $buttons[] = \CHtml::label($this->offLabel, $id . '_on'); $checked = $checked ? false : true; $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_off', 'value' => 1)); $buttons[] = \CHtml::label($this->onLabel, $id . '_off'); $buttons[] = '<span></span>'; return \CHtml::tag('div', $this->htmlOptions, implode("\n", $buttons)); }
[ "public", "function", "renderButtons", "(", ")", "{", "list", "(", "$", "name", ",", "$", "id", ")", "=", "$", "this", "->", "resolveNameID", "(", ")", ";", "$", "buttons", "=", "array", "(", ")", ";", "$", "checked", "=", "$", "this", "->", "hasModel", "(", ")", "?", "(", "!", "$", "this", "->", "model", "->", "{", "$", "this", "->", "attribute", "}", ")", ":", "true", ";", "$", "buttons", "[", "]", "=", "\\", "CHtml", "::", "radioButton", "(", "$", "name", ",", "$", "checked", ",", "array", "(", "'id'", "=>", "$", "id", ".", "'_on'", ",", "'value'", "=>", "1", ")", ")", ";", "$", "buttons", "[", "]", "=", "\\", "CHtml", "::", "label", "(", "$", "this", "->", "offLabel", ",", "$", "id", ".", "'_on'", ")", ";", "$", "checked", "=", "$", "checked", "?", "false", ":", "true", ";", "$", "buttons", "[", "]", "=", "\\", "CHtml", "::", "radioButton", "(", "$", "name", ",", "$", "checked", ",", "array", "(", "'id'", "=>", "$", "id", ".", "'_off'", ",", "'value'", "=>", "1", ")", ")", ";", "$", "buttons", "[", "]", "=", "\\", "CHtml", "::", "label", "(", "$", "this", "->", "onLabel", ",", "$", "id", ".", "'_off'", ")", ";", "$", "buttons", "[", "]", "=", "'<span></span>'", ";", "return", "\\", "CHtml", "::", "tag", "(", "'div'", ",", "$", "this", "->", "htmlOptions", ",", "implode", "(", "\"\\n\"", ",", "$", "buttons", ")", ")", ";", "}" ]
Returns the formatted button @return string the resulting HTML
[ "Returns", "the", "formatted", "button" ]
49bed0d3ca1a9bac9299000e48a2661bdc8f9a29
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/SwitchButton.php#L68-L81
17,637
qcubed/orm
src/Query/Node/Association.php
Association.join
public function join( Builder $objBuilder, $blnExpandSelection = false, iCondition $objJoinCondition = null, Clause\Select $objSelect = null ) { $objParentNode = $this->objParentNode; $objParentNode->join($objBuilder, $blnExpandSelection, null, $objSelect); if ($objJoinCondition && !$objJoinCondition->equalTables($this->fullAlias())) { throw new Caller("The join condition on the \"" . $this->strTableName . "\" table must only contain conditions for that table."); } try { $strParentAlias = $objParentNode->fullAlias(); $strAlias = $this->fullAlias(); //$strJoinTableAlias = $strParentAlias . '__' . ($this->strAlias ? $this->strAlias : $this->strName); $objBuilder->addJoinItem($this->strTableName, $strAlias, $strParentAlias, $objParentNode->_PrimaryKey, $this->strPrimaryKey, $objJoinCondition); if ($blnExpandSelection) { $this->putSelectFields($objBuilder, $strAlias, $objSelect); } } catch (Caller $objExc) { $objExc->incrementOffset(); throw $objExc; } }
php
public function join( Builder $objBuilder, $blnExpandSelection = false, iCondition $objJoinCondition = null, Clause\Select $objSelect = null ) { $objParentNode = $this->objParentNode; $objParentNode->join($objBuilder, $blnExpandSelection, null, $objSelect); if ($objJoinCondition && !$objJoinCondition->equalTables($this->fullAlias())) { throw new Caller("The join condition on the \"" . $this->strTableName . "\" table must only contain conditions for that table."); } try { $strParentAlias = $objParentNode->fullAlias(); $strAlias = $this->fullAlias(); //$strJoinTableAlias = $strParentAlias . '__' . ($this->strAlias ? $this->strAlias : $this->strName); $objBuilder->addJoinItem($this->strTableName, $strAlias, $strParentAlias, $objParentNode->_PrimaryKey, $this->strPrimaryKey, $objJoinCondition); if ($blnExpandSelection) { $this->putSelectFields($objBuilder, $strAlias, $objSelect); } } catch (Caller $objExc) { $objExc->incrementOffset(); throw $objExc; } }
[ "public", "function", "join", "(", "Builder", "$", "objBuilder", ",", "$", "blnExpandSelection", "=", "false", ",", "iCondition", "$", "objJoinCondition", "=", "null", ",", "Clause", "\\", "Select", "$", "objSelect", "=", "null", ")", "{", "$", "objParentNode", "=", "$", "this", "->", "objParentNode", ";", "$", "objParentNode", "->", "join", "(", "$", "objBuilder", ",", "$", "blnExpandSelection", ",", "null", ",", "$", "objSelect", ")", ";", "if", "(", "$", "objJoinCondition", "&&", "!", "$", "objJoinCondition", "->", "equalTables", "(", "$", "this", "->", "fullAlias", "(", ")", ")", ")", "{", "throw", "new", "Caller", "(", "\"The join condition on the \\\"\"", ".", "$", "this", "->", "strTableName", ".", "\"\\\" table must only contain conditions for that table.\"", ")", ";", "}", "try", "{", "$", "strParentAlias", "=", "$", "objParentNode", "->", "fullAlias", "(", ")", ";", "$", "strAlias", "=", "$", "this", "->", "fullAlias", "(", ")", ";", "//$strJoinTableAlias = $strParentAlias . '__' . ($this->strAlias ? $this->strAlias : $this->strName);", "$", "objBuilder", "->", "addJoinItem", "(", "$", "this", "->", "strTableName", ",", "$", "strAlias", ",", "$", "strParentAlias", ",", "$", "objParentNode", "->", "_PrimaryKey", ",", "$", "this", "->", "strPrimaryKey", ",", "$", "objJoinCondition", ")", ";", "if", "(", "$", "blnExpandSelection", ")", "{", "$", "this", "->", "putSelectFields", "(", "$", "objBuilder", ",", "$", "strAlias", ",", "$", "objSelect", ")", ";", "}", "}", "catch", "(", "Caller", "$", "objExc", ")", "{", "$", "objExc", "->", "incrementOffset", "(", ")", ";", "throw", "$", "objExc", ";", "}", "}" ]
Join the node to the query. Join condition here gets applied to parent item. @param Builder $objBuilder @param bool $blnExpandSelection @param iCondition|null $objJoinCondition @param Clause\Select|null $objSelect @throws Caller
[ "Join", "the", "node", "to", "the", "query", ".", "Join", "condition", "here", "gets", "applied", "to", "parent", "item", "." ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/Node/Association.php#L50-L76
17,638
CakeCMS/Core
src/Event/EventManager.php
EventManager.loadListeners
public static function loadListeners() { $manager = self::instance(); $plugins = Plugin::loaded(); foreach ($plugins as $plugin) { $events = Plugin::getData($plugin, 'events')->getArrayCopy(); foreach ($events as $name => $config) { if (is_numeric($name)) { $name = $config; $config = []; } $class = App::className($name, 'Event'); $config = (array) $config; if ($class !== false) { $listener = new $class($config); $manager->on($listener, $config); } } } }
php
public static function loadListeners() { $manager = self::instance(); $plugins = Plugin::loaded(); foreach ($plugins as $plugin) { $events = Plugin::getData($plugin, 'events')->getArrayCopy(); foreach ($events as $name => $config) { if (is_numeric($name)) { $name = $config; $config = []; } $class = App::className($name, 'Event'); $config = (array) $config; if ($class !== false) { $listener = new $class($config); $manager->on($listener, $config); } } } }
[ "public", "static", "function", "loadListeners", "(", ")", "{", "$", "manager", "=", "self", "::", "instance", "(", ")", ";", "$", "plugins", "=", "Plugin", "::", "loaded", "(", ")", ";", "foreach", "(", "$", "plugins", "as", "$", "plugin", ")", "{", "$", "events", "=", "Plugin", "::", "getData", "(", "$", "plugin", ",", "'events'", ")", "->", "getArrayCopy", "(", ")", ";", "foreach", "(", "$", "events", "as", "$", "name", "=>", "$", "config", ")", "{", "if", "(", "is_numeric", "(", "$", "name", ")", ")", "{", "$", "name", "=", "$", "config", ";", "$", "config", "=", "[", "]", ";", "}", "$", "class", "=", "App", "::", "className", "(", "$", "name", ",", "'Event'", ")", ";", "$", "config", "=", "(", "array", ")", "$", "config", ";", "if", "(", "$", "class", "!==", "false", ")", "{", "$", "listener", "=", "new", "$", "class", "(", "$", "config", ")", ";", "$", "manager", "->", "on", "(", "$", "listener", ",", "$", "config", ")", ";", "}", "}", "}", "}" ]
Load Event Handlers during bootstrap. Plugins can add their own custom EventHandler in Config/events.php with the following format: 'events' => [ 'Core.CoreEventHandler' => [ 'options' = [ 'callable' => '', 'priority' => '', ] ] ] @return void
[ "Load", "Event", "Handlers", "during", "bootstrap", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Event/EventManager.php#L48-L70
17,639
simplisti/jasper-starter
src/OptionDbTrait.php
OptionDbTrait.getDatabase
public function getDatabase ($key) { if (array_key_exists($key, $this->database)) { return $this->database[$key]; } return false; }
php
public function getDatabase ($key) { if (array_key_exists($key, $this->database)) { return $this->database[$key]; } return false; }
[ "public", "function", "getDatabase", "(", "$", "key", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "database", ")", ")", "{", "return", "$", "this", "->", "database", "[", "$", "key", "]", ";", "}", "return", "false", ";", "}" ]
Get the database details or false on failure @return string
[ "Get", "the", "database", "details", "or", "false", "on", "failure" ]
e03e24663e983710fb4f1afad6c85bde8553de65
https://github.com/simplisti/jasper-starter/blob/e03e24663e983710fb4f1afad6c85bde8553de65/src/OptionDbTrait.php#L18-L25
17,640
simplisti/jasper-starter
src/OptionDbTrait.php
OptionDbTrait.setDatabase
public function setDatabase ($name, $user, $pass, $host = 'localhost', $port = 3306) { $this->database['name'] = $name; $this->database['user'] = $user; $this->database['pass'] = $pass; $this->database['host'] = $host; $this->database['port'] = $port; return $this; }
php
public function setDatabase ($name, $user, $pass, $host = 'localhost', $port = 3306) { $this->database['name'] = $name; $this->database['user'] = $user; $this->database['pass'] = $pass; $this->database['host'] = $host; $this->database['port'] = $port; return $this; }
[ "public", "function", "setDatabase", "(", "$", "name", ",", "$", "user", ",", "$", "pass", ",", "$", "host", "=", "'localhost'", ",", "$", "port", "=", "3306", ")", "{", "$", "this", "->", "database", "[", "'name'", "]", "=", "$", "name", ";", "$", "this", "->", "database", "[", "'user'", "]", "=", "$", "user", ";", "$", "this", "->", "database", "[", "'pass'", "]", "=", "$", "pass", ";", "$", "this", "->", "database", "[", "'host'", "]", "=", "$", "host", ";", "$", "this", "->", "database", "[", "'port'", "]", "=", "$", "port", ";", "return", "$", "this", ";", "}" ]
Set the database details @return $this
[ "Set", "the", "database", "details" ]
e03e24663e983710fb4f1afad6c85bde8553de65
https://github.com/simplisti/jasper-starter/blob/e03e24663e983710fb4f1afad6c85bde8553de65/src/OptionDbTrait.php#L32-L41
17,641
simplisti/jasper-starter
src/OptionDbTrait.php
OptionDbTrait.setDatabaseUrl
public function setDatabaseUrl ($url) { $parts = parse_url($url); $this->database['name'] = trim($parts['path'], '/'); $this->database['user'] = $parts['user']; $this->database['pass'] = $parts['pass']; $this->database['host'] = $parts['host']; $this->database['port'] = $parts['port']; return $this; }
php
public function setDatabaseUrl ($url) { $parts = parse_url($url); $this->database['name'] = trim($parts['path'], '/'); $this->database['user'] = $parts['user']; $this->database['pass'] = $parts['pass']; $this->database['host'] = $parts['host']; $this->database['port'] = $parts['port']; return $this; }
[ "public", "function", "setDatabaseUrl", "(", "$", "url", ")", "{", "$", "parts", "=", "parse_url", "(", "$", "url", ")", ";", "$", "this", "->", "database", "[", "'name'", "]", "=", "trim", "(", "$", "parts", "[", "'path'", "]", ",", "'/'", ")", ";", "$", "this", "->", "database", "[", "'user'", "]", "=", "$", "parts", "[", "'user'", "]", ";", "$", "this", "->", "database", "[", "'pass'", "]", "=", "$", "parts", "[", "'pass'", "]", ";", "$", "this", "->", "database", "[", "'host'", "]", "=", "$", "parts", "[", "'host'", "]", ";", "$", "this", "->", "database", "[", "'port'", "]", "=", "$", "parts", "[", "'port'", "]", ";", "return", "$", "this", ";", "}" ]
Set the database details via URL @return $this
[ "Set", "the", "database", "details", "via", "URL" ]
e03e24663e983710fb4f1afad6c85bde8553de65
https://github.com/simplisti/jasper-starter/blob/e03e24663e983710fb4f1afad6c85bde8553de65/src/OptionDbTrait.php#L48-L59
17,642
simplisti/jasper-starter
src/OptionDbTrait.php
OptionDbTrait.setDatabaseJdbc
public function setDatabaseJdbc ($url, $dir, $class) { $this->database['url'] = $url; $this->database['dir'] = $dir; $this->database['class'] = $class; return $this; }
php
public function setDatabaseJdbc ($url, $dir, $class) { $this->database['url'] = $url; $this->database['dir'] = $dir; $this->database['class'] = $class; return $this; }
[ "public", "function", "setDatabaseJdbc", "(", "$", "url", ",", "$", "dir", ",", "$", "class", ")", "{", "$", "this", "->", "database", "[", "'url'", "]", "=", "$", "url", ";", "$", "this", "->", "database", "[", "'dir'", "]", "=", "$", "dir", ";", "$", "this", "->", "database", "[", "'class'", "]", "=", "$", "class", ";", "return", "$", "this", ";", "}" ]
Set the database JDBC details @return $this
[ "Set", "the", "database", "JDBC", "details" ]
e03e24663e983710fb4f1afad6c85bde8553de65
https://github.com/simplisti/jasper-starter/blob/e03e24663e983710fb4f1afad6c85bde8553de65/src/OptionDbTrait.php#L66-L73
17,643
PeekAndPoke/psi
src/Psi.php
Psi.filterBy
public function filterBy($mapper, $condition) { $this->operationChain->append(new FilterByPredicate($mapper, $condition)); return $this; }
php
public function filterBy($mapper, $condition) { $this->operationChain->append(new FilterByPredicate($mapper, $condition)); return $this; }
[ "public", "function", "filterBy", "(", "$", "mapper", ",", "$", "condition", ")", "{", "$", "this", "->", "operationChain", "->", "append", "(", "new", "FilterByPredicate", "(", "$", "mapper", ",", "$", "condition", ")", ")", ";", "return", "$", "this", ";", "}" ]
Filters the input stream by passing each element first through the mapper and the to the condition This is useful of one for example want to filter all items, that have a certain property starting with a certain string: <code> $result = Psi::it($input) ->filterBy( function (Person $p) { return $p->getName(); }, new Psi\Str\StartingWith('A') ) ->toArray() </code> @param callable|UnaryFunction|BinaryFunction $mapper @param callable|UnaryFunction|BinaryFunction $condition @return $this
[ "Filters", "the", "input", "stream", "by", "passing", "each", "element", "first", "through", "the", "mapper", "and", "the", "to", "the", "condition" ]
cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f
https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Psi.php#L203-L208
17,644
PeekAndPoke/psi
src/Psi.php
Psi.any
public function any($condition) { $this->filter($condition); $tmp = new \stdClass(); return $this->getFirst($tmp) !== $tmp; }
php
public function any($condition) { $this->filter($condition); $tmp = new \stdClass(); return $this->getFirst($tmp) !== $tmp; }
[ "public", "function", "any", "(", "$", "condition", ")", "{", "$", "this", "->", "filter", "(", "$", "condition", ")", ";", "$", "tmp", "=", "new", "\\", "stdClass", "(", ")", ";", "return", "$", "this", "->", "getFirst", "(", "$", "tmp", ")", "!==", "$", "tmp", ";", "}" ]
Returns true if at least one element matches the condition @param callable|UnaryFunction|BinaryFunction $condition @return bool
[ "Returns", "true", "if", "at", "least", "one", "element", "matches", "the", "condition" ]
cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f
https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Psi.php#L613-L620
17,645
PeekAndPoke/psi
src/Psi.php
Psi.all
public function all($condition) { return ! $this->any( // TODO: create Not predicate class function ($elem, $idx) use ($condition) { return ! $condition($elem, $idx); } ); }
php
public function all($condition) { return ! $this->any( // TODO: create Not predicate class function ($elem, $idx) use ($condition) { return ! $condition($elem, $idx); } ); }
[ "public", "function", "all", "(", "$", "condition", ")", "{", "return", "!", "$", "this", "->", "any", "(", "// TODO: create Not predicate class", "function", "(", "$", "elem", ",", "$", "idx", ")", "use", "(", "$", "condition", ")", "{", "return", "!", "$", "condition", "(", "$", "elem", ",", "$", "idx", ")", ";", "}", ")", ";", "}" ]
Returns true if all elements match the condition @param callable|UnaryFunction|BinaryFunction $condition @return bool
[ "Returns", "true", "if", "all", "elements", "match", "the", "condition" ]
cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f
https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Psi.php#L629-L637
17,646
limen/php-jobs
src/Helper.php
Helper.compareDatetime
public static function compareDatetime($a, $b) { $timea = strtotime($a); $timeb = strtotime($b); if ($timea === false || $timeb === false) { return false; } if ($timea > $timeb) { return 1; } elseif ($timea < $timeb) { return -1; } return 0; }
php
public static function compareDatetime($a, $b) { $timea = strtotime($a); $timeb = strtotime($b); if ($timea === false || $timeb === false) { return false; } if ($timea > $timeb) { return 1; } elseif ($timea < $timeb) { return -1; } return 0; }
[ "public", "static", "function", "compareDatetime", "(", "$", "a", ",", "$", "b", ")", "{", "$", "timea", "=", "strtotime", "(", "$", "a", ")", ";", "$", "timeb", "=", "strtotime", "(", "$", "b", ")", ";", "if", "(", "$", "timea", "===", "false", "||", "$", "timeb", "===", "false", ")", "{", "return", "false", ";", "}", "if", "(", "$", "timea", ">", "$", "timeb", ")", "{", "return", "1", ";", "}", "elseif", "(", "$", "timea", "<", "$", "timeb", ")", "{", "return", "-", "1", ";", "}", "return", "0", ";", "}" ]
compare two datetime @param string $a yyyy-mm-dd hh:ii:ss e.g. @param string $b yyyy-mm-dd hh:ii:ss e.g. @return int|bool return false if $a or $b is not valid
[ "compare", "two", "datetime" ]
525f4082b49a7a3e69acb4cea3a622244f1616b9
https://github.com/limen/php-jobs/blob/525f4082b49a7a3e69acb4cea3a622244f1616b9/src/Helper.php#L17-L33
17,647
restruct/silverstripe-namedlinkfield
src/NamedLinkFormField.php
NamedLinkFormField.setForm
public function setForm($form) { foreach ($this->namedLinkCompositeField->compositeDatabaseFields() as $field => $spec) { $fieldHandle = 'field' . $field; $this->{$fieldHandle}->setForm($form); } // $this->fieldPageID->setForm($form); // $this->fieldPageAnchor->setForm($form); // $this->fieldFileID->setForm($form); // $this->fieldCustomURL->setForm($form); // $this->fieldShortcode->setForm($form); // $this->fieldTitle->setForm($form); // $this->fieldLinkmode->setForm($form); parent::setForm($form); return $this; }
php
public function setForm($form) { foreach ($this->namedLinkCompositeField->compositeDatabaseFields() as $field => $spec) { $fieldHandle = 'field' . $field; $this->{$fieldHandle}->setForm($form); } // $this->fieldPageID->setForm($form); // $this->fieldPageAnchor->setForm($form); // $this->fieldFileID->setForm($form); // $this->fieldCustomURL->setForm($form); // $this->fieldShortcode->setForm($form); // $this->fieldTitle->setForm($form); // $this->fieldLinkmode->setForm($form); parent::setForm($form); return $this; }
[ "public", "function", "setForm", "(", "$", "form", ")", "{", "foreach", "(", "$", "this", "->", "namedLinkCompositeField", "->", "compositeDatabaseFields", "(", ")", "as", "$", "field", "=>", "$", "spec", ")", "{", "$", "fieldHandle", "=", "'field'", ".", "$", "field", ";", "$", "this", "->", "{", "$", "fieldHandle", "}", "->", "setForm", "(", "$", "form", ")", ";", "}", "//\t\t$this->fieldPageID->setForm($form);", "//\t\t$this->fieldPageAnchor->setForm($form);", "//\t\t$this->fieldFileID->setForm($form);", "//\t\t$this->fieldCustomURL->setForm($form);", "//\t\t$this->fieldShortcode->setForm($form);", "//\t\t$this->fieldTitle->setForm($form);", "//\t\t$this->fieldLinkmode->setForm($form);", "parent", "::", "setForm", "(", "$", "form", ")", ";", "return", "$", "this", ";", "}" ]
Set the container form. This is called automatically when fields are added to forms. @param Form $form @return $this
[ "Set", "the", "container", "form", "." ]
567c49fdc1b24c219dec2e989fc2013b1c7951af
https://github.com/restruct/silverstripe-namedlinkfield/blob/567c49fdc1b24c219dec2e989fc2013b1c7951af/src/NamedLinkFormField.php#L150-L167
17,648
PortaText/php-sdk
src/PortaText/Command/Result.php
Result.errors
public function errors() { if (isset($this->data) && isset($this->data["error_description"])) { return $this->data["error_description"]; } return null; }
php
public function errors() { if (isset($this->data) && isset($this->data["error_description"])) { return $this->data["error_description"]; } return null; }
[ "public", "function", "errors", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "data", ")", "&&", "isset", "(", "$", "this", "->", "data", "[", "\"error_description\"", "]", ")", ")", "{", "return", "$", "this", "->", "data", "[", "\"error_description\"", "]", ";", "}", "return", "null", ";", "}" ]
When the request was not successful, this will return all the errors. @return array|null
[ "When", "the", "request", "was", "not", "successful", "this", "will", "return", "all", "the", "errors", "." ]
dbe04ef043db5b251953f9de57aa4d0f1785dfcc
https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Result.php#L49-L55
17,649
photogabble/laravel-remember-uploads
src/Middleware/RememberFileUploads.php
RememberFileUploads.rememberFilesFactory
private function rememberFilesFactory($files, $prefix = '') { $result = []; foreach ($files as $key => $file) { $cacheKey = $prefix . (empty($prefix) ? '' : '.') . $key; if (is_string($file)){ if (! $this->cache->has('_remembered_files.'.$cacheKey)){ continue; } /** @noinspection Annotator */ $cached = $this->cache->get('_remembered_files.'.$cacheKey); if ($cached instanceof RememberedFile){ $result[$key] = $cached; } unset($cached); continue; } if (is_array($file)) { $result[$key] = $this->rememberFilesFactory($file, $cacheKey); } else { $storagePathName = $this->storagePath . DIRECTORY_SEPARATOR . $file->getFilename(); copy($file->getPathname(), $storagePathName); $rememberedFile = new RememberedFile($storagePathName, $file); $this->cache->put('_remembered_files.'.$cacheKey, $rememberedFile, $this->cacheTimeout); $result[$key] = $rememberedFile; } } return $result; }
php
private function rememberFilesFactory($files, $prefix = '') { $result = []; foreach ($files as $key => $file) { $cacheKey = $prefix . (empty($prefix) ? '' : '.') . $key; if (is_string($file)){ if (! $this->cache->has('_remembered_files.'.$cacheKey)){ continue; } /** @noinspection Annotator */ $cached = $this->cache->get('_remembered_files.'.$cacheKey); if ($cached instanceof RememberedFile){ $result[$key] = $cached; } unset($cached); continue; } if (is_array($file)) { $result[$key] = $this->rememberFilesFactory($file, $cacheKey); } else { $storagePathName = $this->storagePath . DIRECTORY_SEPARATOR . $file->getFilename(); copy($file->getPathname(), $storagePathName); $rememberedFile = new RememberedFile($storagePathName, $file); $this->cache->put('_remembered_files.'.$cacheKey, $rememberedFile, $this->cacheTimeout); $result[$key] = $rememberedFile; } } return $result; }
[ "private", "function", "rememberFilesFactory", "(", "$", "files", ",", "$", "prefix", "=", "''", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "files", "as", "$", "key", "=>", "$", "file", ")", "{", "$", "cacheKey", "=", "$", "prefix", ".", "(", "empty", "(", "$", "prefix", ")", "?", "''", ":", "'.'", ")", ".", "$", "key", ";", "if", "(", "is_string", "(", "$", "file", ")", ")", "{", "if", "(", "!", "$", "this", "->", "cache", "->", "has", "(", "'_remembered_files.'", ".", "$", "cacheKey", ")", ")", "{", "continue", ";", "}", "/** @noinspection Annotator */", "$", "cached", "=", "$", "this", "->", "cache", "->", "get", "(", "'_remembered_files.'", ".", "$", "cacheKey", ")", ";", "if", "(", "$", "cached", "instanceof", "RememberedFile", ")", "{", "$", "result", "[", "$", "key", "]", "=", "$", "cached", ";", "}", "unset", "(", "$", "cached", ")", ";", "continue", ";", "}", "if", "(", "is_array", "(", "$", "file", ")", ")", "{", "$", "result", "[", "$", "key", "]", "=", "$", "this", "->", "rememberFilesFactory", "(", "$", "file", ",", "$", "cacheKey", ")", ";", "}", "else", "{", "$", "storagePathName", "=", "$", "this", "->", "storagePath", ".", "DIRECTORY_SEPARATOR", ".", "$", "file", "->", "getFilename", "(", ")", ";", "copy", "(", "$", "file", "->", "getPathname", "(", ")", ",", "$", "storagePathName", ")", ";", "$", "rememberedFile", "=", "new", "RememberedFile", "(", "$", "storagePathName", ",", "$", "file", ")", ";", "$", "this", "->", "cache", "->", "put", "(", "'_remembered_files.'", ".", "$", "cacheKey", ",", "$", "rememberedFile", ",", "$", "this", "->", "cacheTimeout", ")", ";", "$", "result", "[", "$", "key", "]", "=", "$", "rememberedFile", ";", "}", "}", "return", "$", "result", ";", "}" ]
Recursive factory method to create RememberedFile from UploadedFile. @param array|UploadedFile[] $files @param string $prefix @return array|RememberedFile[]
[ "Recursive", "factory", "method", "to", "create", "RememberedFile", "from", "UploadedFile", "." ]
28d0667d2de74e5cd4f1980920df828cc5f99514
https://github.com/photogabble/laravel-remember-uploads/blob/28d0667d2de74e5cd4f1980920df828cc5f99514/src/Middleware/RememberFileUploads.php#L128-L158
17,650
periaptio/empress-generator
src/Syntax/RemoveForeignKeysFromTable.php
RemoveForeignKeysFromTable.getItem
protected function getItem($foreignKey) { $name = empty($foreignKey['name']) ? $this->createIndexName($foreignKey['field']) : $foreignKey['name']; return sprintf("\$table->dropForeign('%s');", $name); }
php
protected function getItem($foreignKey) { $name = empty($foreignKey['name']) ? $this->createIndexName($foreignKey['field']) : $foreignKey['name']; return sprintf("\$table->dropForeign('%s');", $name); }
[ "protected", "function", "getItem", "(", "$", "foreignKey", ")", "{", "$", "name", "=", "empty", "(", "$", "foreignKey", "[", "'name'", "]", ")", "?", "$", "this", "->", "createIndexName", "(", "$", "foreignKey", "[", "'field'", "]", ")", ":", "$", "foreignKey", "[", "'name'", "]", ";", "return", "sprintf", "(", "\"\\$table->dropForeign('%s');\"", ",", "$", "name", ")", ";", "}" ]
Return string for dropping a foreign key @param array $foreignKey @return string
[ "Return", "string", "for", "dropping", "a", "foreign", "key" ]
749fb4b12755819e9c97377ebfb446ee0822168a
https://github.com/periaptio/empress-generator/blob/749fb4b12755819e9c97377ebfb446ee0822168a/src/Syntax/RemoveForeignKeysFromTable.php#L16-L20
17,651
ChadSikorra/php-simple-enum
src/Enums/FlagEnumTrait.php
FlagEnumTrait.getNames
public function getNames() { $enums = []; foreach (static::toArray() as $name => $value) { if ($this->has($value)) { $enums[] = $name; } } return $enums; }
php
public function getNames() { $enums = []; foreach (static::toArray() as $name => $value) { if ($this->has($value)) { $enums[] = $name; } } return $enums; }
[ "public", "function", "getNames", "(", ")", "{", "$", "enums", "=", "[", "]", ";", "foreach", "(", "static", "::", "toArray", "(", ")", "as", "$", "name", "=>", "$", "value", ")", "{", "if", "(", "$", "this", "->", "has", "(", "$", "value", ")", ")", "{", "$", "enums", "[", "]", "=", "$", "name", ";", "}", "}", "return", "$", "enums", ";", "}" ]
Get an array of all the enum names this flag instance represents. @return array
[ "Get", "an", "array", "of", "all", "the", "enum", "names", "this", "flag", "instance", "represents", "." ]
781f87ae9f4cc75fb2edab6517c6471c0181e93b
https://github.com/ChadSikorra/php-simple-enum/blob/781f87ae9f4cc75fb2edab6517c6471c0181e93b/src/Enums/FlagEnumTrait.php#L104-L115
17,652
ChadSikorra/php-simple-enum
src/Enums/FlagEnumTrait.php
FlagEnumTrait.getValuesFromFlagOrEnum
protected function getValuesFromFlagOrEnum($flag) { $values = []; if ($flag instanceof static) { foreach ($flag->getNames() as $enum) { $values[] = static::getNameValue($enum); } } elseif (static::isValidName((string) $flag)) { $values[] = static::getNameValue((string) $flag); } elseif (is_numeric($flag)) { $values[] = $flag; } return $values; }
php
protected function getValuesFromFlagOrEnum($flag) { $values = []; if ($flag instanceof static) { foreach ($flag->getNames() as $enum) { $values[] = static::getNameValue($enum); } } elseif (static::isValidName((string) $flag)) { $values[] = static::getNameValue((string) $flag); } elseif (is_numeric($flag)) { $values[] = $flag; } return $values; }
[ "protected", "function", "getValuesFromFlagOrEnum", "(", "$", "flag", ")", "{", "$", "values", "=", "[", "]", ";", "if", "(", "$", "flag", "instanceof", "static", ")", "{", "foreach", "(", "$", "flag", "->", "getNames", "(", ")", "as", "$", "enum", ")", "{", "$", "values", "[", "]", "=", "static", "::", "getNameValue", "(", "$", "enum", ")", ";", "}", "}", "elseif", "(", "static", "::", "isValidName", "(", "(", "string", ")", "$", "flag", ")", ")", "{", "$", "values", "[", "]", "=", "static", "::", "getNameValue", "(", "(", "string", ")", "$", "flag", ")", ";", "}", "elseif", "(", "is_numeric", "(", "$", "flag", ")", ")", "{", "$", "values", "[", "]", "=", "$", "flag", ";", "}", "return", "$", "values", ";", "}" ]
Given an enum name, enum value, or flag enum instance, get the array of values it represents. @param int|string|FlagEnumTrait $flag @return array
[ "Given", "an", "enum", "name", "enum", "value", "or", "flag", "enum", "instance", "get", "the", "array", "of", "values", "it", "represents", "." ]
781f87ae9f4cc75fb2edab6517c6471c0181e93b
https://github.com/ChadSikorra/php-simple-enum/blob/781f87ae9f4cc75fb2edab6517c6471c0181e93b/src/Enums/FlagEnumTrait.php#L133-L148
17,653
datasift/php_webdriver
src/php/DataSift/WebDriver/WebDriverConfiguration.php
WebDriverConfiguration.getVersion
public function getVersion() { $composer = $this->loadJsonFileFromRoot("composer.json"); if (!isset($composer->version)){ throw new \Exception("composer.json does not contain a version"); } return $composer->version; }
php
public function getVersion() { $composer = $this->loadJsonFileFromRoot("composer.json"); if (!isset($composer->version)){ throw new \Exception("composer.json does not contain a version"); } return $composer->version; }
[ "public", "function", "getVersion", "(", ")", "{", "$", "composer", "=", "$", "this", "->", "loadJsonFileFromRoot", "(", "\"composer.json\"", ")", ";", "if", "(", "!", "isset", "(", "$", "composer", "->", "version", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"composer.json does not contain a version\"", ")", ";", "}", "return", "$", "composer", "->", "version", ";", "}" ]
Returns the project's version @return string The version of the project
[ "Returns", "the", "project", "s", "version" ]
efca991198616b53c8f40b59ad05306e2b10e7f0
https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/WebDriver/WebDriverConfiguration.php#L44-L53
17,654
datasift/php_webdriver
src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php
BrowserMobProxySession.getWebDriverProxyConfig
public function getWebDriverProxyConfig() { $this->requireOpenConnection(); $address = new HttpAddress($this->getUrl()); return array ( 'proxyType' => 'manual', 'httpProxy' => $address->hostname . ':' . $this->getPort(), 'sslProxy' => $address->hostname . ':' . $this->getPort() ); }
php
public function getWebDriverProxyConfig() { $this->requireOpenConnection(); $address = new HttpAddress($this->getUrl()); return array ( 'proxyType' => 'manual', 'httpProxy' => $address->hostname . ':' . $this->getPort(), 'sslProxy' => $address->hostname . ':' . $this->getPort() ); }
[ "public", "function", "getWebDriverProxyConfig", "(", ")", "{", "$", "this", "->", "requireOpenConnection", "(", ")", ";", "$", "address", "=", "new", "HttpAddress", "(", "$", "this", "->", "getUrl", "(", ")", ")", ";", "return", "array", "(", "'proxyType'", "=>", "'manual'", ",", "'httpProxy'", "=>", "$", "address", "->", "hostname", ".", "':'", ".", "$", "this", "->", "getPort", "(", ")", ",", "'sslProxy'", "=>", "$", "address", "->", "hostname", ".", "':'", ".", "$", "this", "->", "getPort", "(", ")", ")", ";", "}" ]
Returns the config information that needs to be given to webdriver to make it use browsermob-proxy @return array
[ "Returns", "the", "config", "information", "that", "needs", "to", "be", "given", "to", "webdriver", "to", "make", "it", "use", "browsermob", "-", "proxy" ]
efca991198616b53c8f40b59ad05306e2b10e7f0
https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php#L86-L97
17,655
datasift/php_webdriver
src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php
BrowserMobProxySession.setHeaders
public function setHeaders($headers) { $this->requireOpenConnection(); $response = $this->curl( 'POST', '/proxy/' . $this->port . '/headers', (object)$headers ); }
php
public function setHeaders($headers) { $this->requireOpenConnection(); $response = $this->curl( 'POST', '/proxy/' . $this->port . '/headers', (object)$headers ); }
[ "public", "function", "setHeaders", "(", "$", "headers", ")", "{", "$", "this", "->", "requireOpenConnection", "(", ")", ";", "$", "response", "=", "$", "this", "->", "curl", "(", "'POST'", ",", "'/proxy/'", ".", "$", "this", "->", "port", ".", "'/headers'", ",", "(", "object", ")", "$", "headers", ")", ";", "}" ]
inject a set of headers into all subsequent requests @param array(string => string) $headers a list of headers to inject, with the array key being the name of the header, and the array value being the value of the header @return void
[ "inject", "a", "set", "of", "headers", "into", "all", "subsequent", "requests" ]
efca991198616b53c8f40b59ad05306e2b10e7f0
https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php#L147-L156
17,656
datasift/php_webdriver
src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php
BrowserMobProxySession.removeHeader
public function removeHeader($name) { $this->requireOpenConnection(); $this->requireFeature('headerGetDelete'); $response = $this->curl( 'DELETE', '/proxy/' . $this->port . '/header/' . urlencode($name) ); }
php
public function removeHeader($name) { $this->requireOpenConnection(); $this->requireFeature('headerGetDelete'); $response = $this->curl( 'DELETE', '/proxy/' . $this->port . '/header/' . urlencode($name) ); }
[ "public", "function", "removeHeader", "(", "$", "name", ")", "{", "$", "this", "->", "requireOpenConnection", "(", ")", ";", "$", "this", "->", "requireFeature", "(", "'headerGetDelete'", ")", ";", "$", "response", "=", "$", "this", "->", "curl", "(", "'DELETE'", ",", "'/proxy/'", ".", "$", "this", "->", "port", ".", "'/header/'", ".", "urlencode", "(", "$", "name", ")", ")", ";", "}" ]
remove a header from the list of headers that browsermob-proxy injects for us @param string the header to remove @return void
[ "remove", "a", "header", "from", "the", "list", "of", "headers", "that", "browsermob", "-", "proxy", "injects", "for", "us" ]
efca991198616b53c8f40b59ad05306e2b10e7f0
https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php#L167-L175
17,657
datasift/php_webdriver
src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php
BrowserMobProxySession.removeAllHeaders
public function removeAllHeaders() { $this->requireOpenConnection(); $this->requireFeature('headerGetDelete'); $response = $this->curl( 'DELETE', '/proxy/' . $this->port . '/headers' ); }
php
public function removeAllHeaders() { $this->requireOpenConnection(); $this->requireFeature('headerGetDelete'); $response = $this->curl( 'DELETE', '/proxy/' . $this->port . '/headers' ); }
[ "public", "function", "removeAllHeaders", "(", ")", "{", "$", "this", "->", "requireOpenConnection", "(", ")", ";", "$", "this", "->", "requireFeature", "(", "'headerGetDelete'", ")", ";", "$", "response", "=", "$", "this", "->", "curl", "(", "'DELETE'", ",", "'/proxy/'", ".", "$", "this", "->", "port", ".", "'/headers'", ")", ";", "}" ]
remove all of the headers that browsermob-proxy injects for us @return void
[ "remove", "all", "of", "the", "headers", "that", "browsermob", "-", "proxy", "injects", "for", "us" ]
efca991198616b53c8f40b59ad05306e2b10e7f0
https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php#L182-L190
17,658
datasift/php_webdriver
src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php
BrowserMobProxySession.setHttpBasicAuth
public function setHttpBasicAuth($domain, $username, $password) { $this->requireOpenConnection(); $this->requireFeature('authBasic'); $response = $this->curl( 'PUT', '/proxy/' . $this->port . '/auth/basic/' . urlencode($domain), array( 'username' => $username, 'password' => $password ) ); }
php
public function setHttpBasicAuth($domain, $username, $password) { $this->requireOpenConnection(); $this->requireFeature('authBasic'); $response = $this->curl( 'PUT', '/proxy/' . $this->port . '/auth/basic/' . urlencode($domain), array( 'username' => $username, 'password' => $password ) ); }
[ "public", "function", "setHttpBasicAuth", "(", "$", "domain", ",", "$", "username", ",", "$", "password", ")", "{", "$", "this", "->", "requireOpenConnection", "(", ")", ";", "$", "this", "->", "requireFeature", "(", "'authBasic'", ")", ";", "$", "response", "=", "$", "this", "->", "curl", "(", "'PUT'", ",", "'/proxy/'", ".", "$", "this", "->", "port", ".", "'/auth/basic/'", ".", "urlencode", "(", "$", "domain", ")", ",", "array", "(", "'username'", "=>", "$", "username", ",", "'password'", "=>", "$", "password", ")", ")", ";", "}" ]
enable HTTP BASIC auth @param string $domain the DNS domain to send HTTP BASIC auth info to @param $username the username to send to the web server @param string $password the password to send to the web server
[ "enable", "HTTP", "BASIC", "auth" ]
efca991198616b53c8f40b59ad05306e2b10e7f0
https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php#L222-L234
17,659
datasift/php_webdriver
src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php
BrowserMobProxySession.close
public function close() { $this->requireOpenConnection(); $response = $this->curl( 'DELETE', '/proxy/' . $this->port ); $this->closed = true; }
php
public function close() { $this->requireOpenConnection(); $response = $this->curl( 'DELETE', '/proxy/' . $this->port ); $this->closed = true; }
[ "public", "function", "close", "(", ")", "{", "$", "this", "->", "requireOpenConnection", "(", ")", ";", "$", "response", "=", "$", "this", "->", "curl", "(", "'DELETE'", ",", "'/proxy/'", ".", "$", "this", "->", "port", ")", ";", "$", "this", "->", "closed", "=", "true", ";", "}" ]
delete the proxy, because we're done @return void
[ "delete", "the", "proxy", "because", "we", "re", "done" ]
efca991198616b53c8f40b59ad05306e2b10e7f0
https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/BrowserMobProxy/BrowserMobProxySession.php#L241-L251
17,660
flipboxstudio/orm-manager
src/Flipbox/OrmManager/Consoles/Command.php
Command.title
public function title($string, $backgorund='blue', $forgeground='white') { $string = $this->paintString(" {$string} ", $forgeground, $backgorund); echo $string ."\n\r"; }
php
public function title($string, $backgorund='blue', $forgeground='white') { $string = $this->paintString(" {$string} ", $forgeground, $backgorund); echo $string ."\n\r"; }
[ "public", "function", "title", "(", "$", "string", ",", "$", "backgorund", "=", "'blue'", ",", "$", "forgeground", "=", "'white'", ")", "{", "$", "string", "=", "$", "this", "->", "paintString", "(", "\" {$string} \"", ",", "$", "forgeground", ",", "$", "backgorund", ")", ";", "echo", "$", "string", ".", "\"\\n\\r\"", ";", "}" ]
Write title output. @param string $string @return void
[ "Write", "title", "output", "." ]
4288426517f53d05177b8729c4ba94c5beca9a98
https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Consoles/Command.php#L83-L88
17,661
webforge-labs/psc-cms
lib/Psc/CMS/Modules.php
Modules.create
protected function create($name) { $c = $this->avaibleModules[$name]['class']; $module = new $c($this->project, $this->inTests); $module->setName($name); $this->modules[$name] = $module; PSC::getEventManager()->dispatchEvent('Psc.ModuleCreated', NULL, $module); return $module; }
php
protected function create($name) { $c = $this->avaibleModules[$name]['class']; $module = new $c($this->project, $this->inTests); $module->setName($name); $this->modules[$name] = $module; PSC::getEventManager()->dispatchEvent('Psc.ModuleCreated', NULL, $module); return $module; }
[ "protected", "function", "create", "(", "$", "name", ")", "{", "$", "c", "=", "$", "this", "->", "avaibleModules", "[", "$", "name", "]", "[", "'class'", "]", ";", "$", "module", "=", "new", "$", "c", "(", "$", "this", "->", "project", ",", "$", "this", "->", "inTests", ")", ";", "$", "module", "->", "setName", "(", "$", "name", ")", ";", "$", "this", "->", "modules", "[", "$", "name", "]", "=", "$", "module", ";", "PSC", "::", "getEventManager", "(", ")", "->", "dispatchEvent", "(", "'Psc.ModuleCreated'", ",", "NULL", ",", "$", "module", ")", ";", "return", "$", "module", ";", "}" ]
Erstellt ein neues Modul wird nur einmal aufgerufen pro Request vorher wurde mit isModule ($name) bereits überprüft @return Psc\CMS\Module
[ "Erstellt", "ein", "neues", "Modul" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Modules.php#L50-L60
17,662
kherge-abandoned/php-wise
src/lib/Herrera/Wise/Loader/XmlFileLoader.php
XmlFileLoader.toArray
private function toArray(DOMElement $node) { $value = null; switch ($node->nodeName) { case 'array': $value = array(); if ($node->hasChildNodes()) { for ($i = 0; $i < $node->childNodes->length; $i++) { /** @var $child DOMElement */ $child = $node->childNodes->item($i); if ($child->hasAttribute('key')) { $value[$child->getAttribute('key')] = $this->toArray($child); } else { $value[] = $this->toArray($child); } } } break; case 'bool': $value = (bool) $node->textContent; break; case 'float': $value = (float) $node->textContent; break; case 'int': $value = (int) $node->textContent; break; case 'str': $value = $node->textContent; break; } return $value; }
php
private function toArray(DOMElement $node) { $value = null; switch ($node->nodeName) { case 'array': $value = array(); if ($node->hasChildNodes()) { for ($i = 0; $i < $node->childNodes->length; $i++) { /** @var $child DOMElement */ $child = $node->childNodes->item($i); if ($child->hasAttribute('key')) { $value[$child->getAttribute('key')] = $this->toArray($child); } else { $value[] = $this->toArray($child); } } } break; case 'bool': $value = (bool) $node->textContent; break; case 'float': $value = (float) $node->textContent; break; case 'int': $value = (int) $node->textContent; break; case 'str': $value = $node->textContent; break; } return $value; }
[ "private", "function", "toArray", "(", "DOMElement", "$", "node", ")", "{", "$", "value", "=", "null", ";", "switch", "(", "$", "node", "->", "nodeName", ")", "{", "case", "'array'", ":", "$", "value", "=", "array", "(", ")", ";", "if", "(", "$", "node", "->", "hasChildNodes", "(", ")", ")", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "node", "->", "childNodes", "->", "length", ";", "$", "i", "++", ")", "{", "/** @var $child DOMElement */", "$", "child", "=", "$", "node", "->", "childNodes", "->", "item", "(", "$", "i", ")", ";", "if", "(", "$", "child", "->", "hasAttribute", "(", "'key'", ")", ")", "{", "$", "value", "[", "$", "child", "->", "getAttribute", "(", "'key'", ")", "]", "=", "$", "this", "->", "toArray", "(", "$", "child", ")", ";", "}", "else", "{", "$", "value", "[", "]", "=", "$", "this", "->", "toArray", "(", "$", "child", ")", ";", "}", "}", "}", "break", ";", "case", "'bool'", ":", "$", "value", "=", "(", "bool", ")", "$", "node", "->", "textContent", ";", "break", ";", "case", "'float'", ":", "$", "value", "=", "(", "float", ")", "$", "node", "->", "textContent", ";", "break", ";", "case", "'int'", ":", "$", "value", "=", "(", "int", ")", "$", "node", "->", "textContent", ";", "break", ";", "case", "'str'", ":", "$", "value", "=", "$", "node", "->", "textContent", ";", "break", ";", "}", "return", "$", "value", ";", "}" ]
Converts a DOM elements to native PHP values. @param DOMElement $node The node. @return mixed The result.
[ "Converts", "a", "DOM", "elements", "to", "native", "PHP", "values", "." ]
7621e0be7dbb2a015d68197d290fe8469f539a4d
https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Loader/XmlFileLoader.php#L46-L82
17,663
2amigos/yiifoundation
widgets/InterChange.php
Interchange.renderImage
public function renderImage() { $rules = array(); foreach ($this->rules as $rule) { $rules[] = '[' . implode(", ", $rule) . ']'; } $this->htmlOptions['data-interchange'] = implode(", ", $rules); return \CHtml::tag('img', $this->htmlOptions); }
php
public function renderImage() { $rules = array(); foreach ($this->rules as $rule) { $rules[] = '[' . implode(", ", $rule) . ']'; } $this->htmlOptions['data-interchange'] = implode(", ", $rules); return \CHtml::tag('img', $this->htmlOptions); }
[ "public", "function", "renderImage", "(", ")", "{", "$", "rules", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "$", "rules", "[", "]", "=", "'['", ".", "implode", "(", "\", \"", ",", "$", "rule", ")", ".", "']'", ";", "}", "$", "this", "->", "htmlOptions", "[", "'data-interchange'", "]", "=", "implode", "(", "\", \"", ",", "$", "rules", ")", ";", "return", "\\", "CHtml", "::", "tag", "(", "'img'", ",", "$", "this", "->", "htmlOptions", ")", ";", "}" ]
Renders the interchange image @return string the resulting img tag
[ "Renders", "the", "interchange", "image" ]
49bed0d3ca1a9bac9299000e48a2661bdc8f9a29
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/InterChange.php#L63-L71
17,664
Chill-project/Main
Controller/UserController.php
UserController.createCreateForm
private function createCreateForm(User $entity) { $form = $this->createForm(new UserType(), $entity, array( 'action' => $this->generateUrl('admin_user_create'), 'method' => 'POST', 'is_creation' => true )); $form->add('submit', 'submit', array('label' => 'Create')); return $form; }
php
private function createCreateForm(User $entity) { $form = $this->createForm(new UserType(), $entity, array( 'action' => $this->generateUrl('admin_user_create'), 'method' => 'POST', 'is_creation' => true )); $form->add('submit', 'submit', array('label' => 'Create')); return $form; }
[ "private", "function", "createCreateForm", "(", "User", "$", "entity", ")", "{", "$", "form", "=", "$", "this", "->", "createForm", "(", "new", "UserType", "(", ")", ",", "$", "entity", ",", "array", "(", "'action'", "=>", "$", "this", "->", "generateUrl", "(", "'admin_user_create'", ")", ",", "'method'", "=>", "'POST'", ",", "'is_creation'", "=>", "true", ")", ")", ";", "$", "form", "->", "add", "(", "'submit'", ",", "'submit'", ",", "array", "(", "'label'", "=>", "'Create'", ")", ")", ";", "return", "$", "form", ";", "}" ]
Creates a form to create a User entity. @param User $entity The entity @return \Symfony\Component\Form\Form The form
[ "Creates", "a", "form", "to", "create", "a", "User", "entity", "." ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/UserController.php#L72-L83
17,665
Chill-project/Main
Controller/UserController.php
UserController.editPasswordAction
public function editPasswordAction($id) { $em = $this->getDoctrine()->getManager(); $user = $em->getRepository('ChillMainBundle:User')->find($id); if (!$user) { throw $this->createNotFoundException('Unable to find User entity.'); } $editForm = $this->createEditPasswordForm($user); return $this->render('ChillMainBundle:User:edit_password.html.twig', array( 'entity' => $user, 'edit_form' => $editForm->createView() )); }
php
public function editPasswordAction($id) { $em = $this->getDoctrine()->getManager(); $user = $em->getRepository('ChillMainBundle:User')->find($id); if (!$user) { throw $this->createNotFoundException('Unable to find User entity.'); } $editForm = $this->createEditPasswordForm($user); return $this->render('ChillMainBundle:User:edit_password.html.twig', array( 'entity' => $user, 'edit_form' => $editForm->createView() )); }
[ "public", "function", "editPasswordAction", "(", "$", "id", ")", "{", "$", "em", "=", "$", "this", "->", "getDoctrine", "(", ")", "->", "getManager", "(", ")", ";", "$", "user", "=", "$", "em", "->", "getRepository", "(", "'ChillMainBundle:User'", ")", "->", "find", "(", "$", "id", ")", ";", "if", "(", "!", "$", "user", ")", "{", "throw", "$", "this", "->", "createNotFoundException", "(", "'Unable to find User entity.'", ")", ";", "}", "$", "editForm", "=", "$", "this", "->", "createEditPasswordForm", "(", "$", "user", ")", ";", "return", "$", "this", "->", "render", "(", "'ChillMainBundle:User:edit_password.html.twig'", ",", "array", "(", "'entity'", "=>", "$", "user", ",", "'edit_form'", "=>", "$", "editForm", "->", "createView", "(", ")", ")", ")", ";", "}" ]
Displays a form to edit the user password.
[ "Displays", "a", "form", "to", "edit", "the", "user", "password", "." ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/UserController.php#L152-L168
17,666
Chill-project/Main
Controller/UserController.php
UserController.updatePasswordAction
public function updatePasswordAction(Request $request, $id) { $em = $this->getDoctrine()->getManager(); $user = $em->getRepository('ChillMainBundle:User')->find($id); if (!$user) { throw $this->createNotFoundException('Unable to find User entity.'); } $editForm = $this->createEditPasswordForm($user); $editForm->handleRequest($request); if ($editForm->isValid()) { $password = $editForm->getData()->getPassword(); // logging for debug !! WARNING print the new password !! $this->get('logger')->debug('update password for an user', array('method' => __METHOD__, 'password' => $password, 'user' => $user->getUsername())); // logging for prod $this->get('logger')->info('update password for an user', array('method' => __METHOD__, 'user' => $user->getUsername())); $user->setPassword($this->get('security.password_encoder') ->encodePassword($user, $password)); $em->flush(); $this->addFlash('success', $this->get('translator')->trans('Password successfully updated!')); return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id))); } return $this->render('ChillMainBundle:User:edit_password.html.twig', array( 'entity' => $user, 'edit_form' => $editForm->createView(), )); }
php
public function updatePasswordAction(Request $request, $id) { $em = $this->getDoctrine()->getManager(); $user = $em->getRepository('ChillMainBundle:User')->find($id); if (!$user) { throw $this->createNotFoundException('Unable to find User entity.'); } $editForm = $this->createEditPasswordForm($user); $editForm->handleRequest($request); if ($editForm->isValid()) { $password = $editForm->getData()->getPassword(); // logging for debug !! WARNING print the new password !! $this->get('logger')->debug('update password for an user', array('method' => __METHOD__, 'password' => $password, 'user' => $user->getUsername())); // logging for prod $this->get('logger')->info('update password for an user', array('method' => __METHOD__, 'user' => $user->getUsername())); $user->setPassword($this->get('security.password_encoder') ->encodePassword($user, $password)); $em->flush(); $this->addFlash('success', $this->get('translator')->trans('Password successfully updated!')); return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id))); } return $this->render('ChillMainBundle:User:edit_password.html.twig', array( 'entity' => $user, 'edit_form' => $editForm->createView(), )); }
[ "public", "function", "updatePasswordAction", "(", "Request", "$", "request", ",", "$", "id", ")", "{", "$", "em", "=", "$", "this", "->", "getDoctrine", "(", ")", "->", "getManager", "(", ")", ";", "$", "user", "=", "$", "em", "->", "getRepository", "(", "'ChillMainBundle:User'", ")", "->", "find", "(", "$", "id", ")", ";", "if", "(", "!", "$", "user", ")", "{", "throw", "$", "this", "->", "createNotFoundException", "(", "'Unable to find User entity.'", ")", ";", "}", "$", "editForm", "=", "$", "this", "->", "createEditPasswordForm", "(", "$", "user", ")", ";", "$", "editForm", "->", "handleRequest", "(", "$", "request", ")", ";", "if", "(", "$", "editForm", "->", "isValid", "(", ")", ")", "{", "$", "password", "=", "$", "editForm", "->", "getData", "(", ")", "->", "getPassword", "(", ")", ";", "// logging for debug !! WARNING print the new password !!", "$", "this", "->", "get", "(", "'logger'", ")", "->", "debug", "(", "'update password for an user'", ",", "array", "(", "'method'", "=>", "__METHOD__", ",", "'password'", "=>", "$", "password", ",", "'user'", "=>", "$", "user", "->", "getUsername", "(", ")", ")", ")", ";", "// logging for prod", "$", "this", "->", "get", "(", "'logger'", ")", "->", "info", "(", "'update password for an user'", ",", "array", "(", "'method'", "=>", "__METHOD__", ",", "'user'", "=>", "$", "user", "->", "getUsername", "(", ")", ")", ")", ";", "$", "user", "->", "setPassword", "(", "$", "this", "->", "get", "(", "'security.password_encoder'", ")", "->", "encodePassword", "(", "$", "user", ",", "$", "password", ")", ")", ";", "$", "em", "->", "flush", "(", ")", ";", "$", "this", "->", "addFlash", "(", "'success'", ",", "$", "this", "->", "get", "(", "'translator'", ")", "->", "trans", "(", "'Password successfully updated!'", ")", ")", ";", "return", "$", "this", "->", "redirect", "(", "$", "this", "->", "generateUrl", "(", "'admin_user_edit'", ",", "array", "(", "'id'", "=>", "$", "id", ")", ")", ")", ";", "}", "return", "$", "this", "->", "render", "(", "'ChillMainBundle:User:edit_password.html.twig'", ",", "array", "(", "'entity'", "=>", "$", "user", ",", "'edit_form'", "=>", "$", "editForm", "->", "createView", "(", ")", ",", ")", ")", ";", "}" ]
Edits the user password
[ "Edits", "the", "user", "password" ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/UserController.php#L343-L381
17,667
Chill-project/Main
Controller/UserController.php
UserController.createDeleteLinkGroupCenterForm
private function createDeleteLinkGroupCenterForm(User $user, GroupCenter $groupCenter) { return $this->createFormBuilder() ->setAction($this->generateUrl('admin_user_delete_group_center', array('uid' => $user->getId(), 'gcid' => $groupCenter->getId()))) ->setMethod('DELETE') ->add('submit', 'submit', array('label' => 'Delete')) ->getForm() ; }
php
private function createDeleteLinkGroupCenterForm(User $user, GroupCenter $groupCenter) { return $this->createFormBuilder() ->setAction($this->generateUrl('admin_user_delete_group_center', array('uid' => $user->getId(), 'gcid' => $groupCenter->getId()))) ->setMethod('DELETE') ->add('submit', 'submit', array('label' => 'Delete')) ->getForm() ; }
[ "private", "function", "createDeleteLinkGroupCenterForm", "(", "User", "$", "user", ",", "GroupCenter", "$", "groupCenter", ")", "{", "return", "$", "this", "->", "createFormBuilder", "(", ")", "->", "setAction", "(", "$", "this", "->", "generateUrl", "(", "'admin_user_delete_group_center'", ",", "array", "(", "'uid'", "=>", "$", "user", "->", "getId", "(", ")", ",", "'gcid'", "=>", "$", "groupCenter", "->", "getId", "(", ")", ")", ")", ")", "->", "setMethod", "(", "'DELETE'", ")", "->", "add", "(", "'submit'", ",", "'submit'", ",", "array", "(", "'label'", "=>", "'Delete'", ")", ")", "->", "getForm", "(", ")", ";", "}" ]
Creates a form to delete a link to a GroupCenter @param mixed $permissionsGroup The entity id @return \Symfony\Component\Form\Form The form
[ "Creates", "a", "form", "to", "delete", "a", "link", "to", "a", "GroupCenter" ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/UserController.php#L391-L400
17,668
Chill-project/Main
Controller/UserController.php
UserController.createAddLinkGroupCenterForm
private function createAddLinkGroupCenterForm(User $user) { return $this->createFormBuilder() ->setAction($this->generateUrl('admin_user_add_group_center', array('uid' => $user->getId()))) ->setMethod('POST') ->add(self::FORM_GROUP_CENTER_COMPOSED, new ComposedGroupCenterType()) ->add('submit', 'submit', array('label' => 'Add a new groupCenter')) ->getForm() ; }
php
private function createAddLinkGroupCenterForm(User $user) { return $this->createFormBuilder() ->setAction($this->generateUrl('admin_user_add_group_center', array('uid' => $user->getId()))) ->setMethod('POST') ->add(self::FORM_GROUP_CENTER_COMPOSED, new ComposedGroupCenterType()) ->add('submit', 'submit', array('label' => 'Add a new groupCenter')) ->getForm() ; }
[ "private", "function", "createAddLinkGroupCenterForm", "(", "User", "$", "user", ")", "{", "return", "$", "this", "->", "createFormBuilder", "(", ")", "->", "setAction", "(", "$", "this", "->", "generateUrl", "(", "'admin_user_add_group_center'", ",", "array", "(", "'uid'", "=>", "$", "user", "->", "getId", "(", ")", ")", ")", ")", "->", "setMethod", "(", "'POST'", ")", "->", "add", "(", "self", "::", "FORM_GROUP_CENTER_COMPOSED", ",", "new", "ComposedGroupCenterType", "(", ")", ")", "->", "add", "(", "'submit'", ",", "'submit'", ",", "array", "(", "'label'", "=>", "'Add a new groupCenter'", ")", ")", "->", "getForm", "(", ")", ";", "}" ]
create a form to add a link to a groupcenter @param User $user @return \Symfony\Component\Form\Form
[ "create", "a", "form", "to", "add", "a", "link", "to", "a", "groupcenter" ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/UserController.php#L408-L418
17,669
FuriosoJack/LaraException
src/Core/Manager.php
Manager.getCallBack
public function getCallBack($request, \Exception $exception) { foreach ($this->exceptionsCallbacks as $callback){ if(is_callable($callback)){ $data = call_user_func($callback,$request,$exception); if(!is_null($data)){ return $data; } } } }
php
public function getCallBack($request, \Exception $exception) { foreach ($this->exceptionsCallbacks as $callback){ if(is_callable($callback)){ $data = call_user_func($callback,$request,$exception); if(!is_null($data)){ return $data; } } } }
[ "public", "function", "getCallBack", "(", "$", "request", ",", "\\", "Exception", "$", "exception", ")", "{", "foreach", "(", "$", "this", "->", "exceptionsCallbacks", "as", "$", "callback", ")", "{", "if", "(", "is_callable", "(", "$", "callback", ")", ")", "{", "$", "data", "=", "call_user_func", "(", "$", "callback", ",", "$", "request", ",", "$", "exception", ")", ";", "if", "(", "!", "is_null", "(", "$", "data", ")", ")", "{", "return", "$", "data", ";", "}", "}", "}", "}" ]
Obtiene el callback de excepcion que se mostrara Entonces Se obtiene el pimer callback que cumpla con que retorne algo @param $request @param \Exception $exception @return mixed
[ "Obtiene", "el", "callback", "de", "excepcion", "que", "se", "mostrara", "Entonces", "Se", "obtiene", "el", "pimer", "callback", "que", "cumpla", "con", "que", "retorne", "algo" ]
b30ec2ed3331d99fca4d0ae47c8710a522bd0c19
https://github.com/FuriosoJack/LaraException/blob/b30ec2ed3331d99fca4d0ae47c8710a522bd0c19/src/Core/Manager.php#L57-L68
17,670
qcubed/orm
src/Query/Builder.php
Builder.setOrderByClause
public function setOrderByClause(Clause\OrderBy $objOrderByClause) { if ($this->objOrderByClause) { throw new Caller('You can only have one OrderBy clause in a query.'); } $this->objOrderByClause = $objOrderByClause; }
php
public function setOrderByClause(Clause\OrderBy $objOrderByClause) { if ($this->objOrderByClause) { throw new Caller('You can only have one OrderBy clause in a query.'); } $this->objOrderByClause = $objOrderByClause; }
[ "public", "function", "setOrderByClause", "(", "Clause", "\\", "OrderBy", "$", "objOrderByClause", ")", "{", "if", "(", "$", "this", "->", "objOrderByClause", ")", "{", "throw", "new", "Caller", "(", "'You can only have one OrderBy clause in a query.'", ")", ";", "}", "$", "this", "->", "objOrderByClause", "=", "$", "objOrderByClause", ";", "}" ]
Sets the one order by clause allowed in a query. Stores it for delayed processing. @param Clause\OrderBy $objOrderByClause @throws Caller
[ "Sets", "the", "one", "order", "by", "clause", "allowed", "in", "a", "query", ".", "Stores", "it", "for", "delayed", "processing", "." ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/Builder.php#L455-L461
17,671
freearhey/sparql
src/GraphBuilder.php
GraphBuilder.service
public function service( $service, $subject, $predicate = null, $object = null ) { $graphBuilder = $this->getGraphBuilder( $subject, $predicate, $object ); $this->services[$service] = $graphBuilder->getSPARQL(); return $this; }
php
public function service( $service, $subject, $predicate = null, $object = null ) { $graphBuilder = $this->getGraphBuilder( $subject, $predicate, $object ); $this->services[$service] = $graphBuilder->getSPARQL(); return $this; }
[ "public", "function", "service", "(", "$", "service", ",", "$", "subject", ",", "$", "predicate", "=", "null", ",", "$", "object", "=", "null", ")", "{", "$", "graphBuilder", "=", "$", "this", "->", "getGraphBuilder", "(", "$", "subject", ",", "$", "predicate", ",", "$", "object", ")", ";", "$", "this", "->", "services", "[", "$", "service", "]", "=", "$", "graphBuilder", "->", "getSPARQL", "(", ")", ";", "return", "$", "this", ";", "}" ]
Adds the given graph or triple as an services condition. @param string|GraphBuilder $subject @param string|null $predicate @param string|null $object @return self @throws InvalidArgumentException
[ "Adds", "the", "given", "graph", "or", "triple", "as", "an", "services", "condition", "." ]
622a8ea661dc5939122b0e8b430a6a94b3bc49c7
https://github.com/freearhey/sparql/blob/622a8ea661dc5939122b0e8b430a6a94b3bc49c7/src/GraphBuilder.php#L211-L215
17,672
CakeCMS/Core
src/Toolbar/ToolbarHelper.php
ToolbarHelper.add
public static function add($title = null, $url = ['action' => 'add'], $icon = 'plus', array $options = []) { $toolbar = Toolbar::getInstance(self::$_toolbar); $options += [ 'icon' => $icon, 'button' => 'green lighten-2' ]; $toolbar->appendButton('Core.link', $title, $url, $options); }
php
public static function add($title = null, $url = ['action' => 'add'], $icon = 'plus', array $options = []) { $toolbar = Toolbar::getInstance(self::$_toolbar); $options += [ 'icon' => $icon, 'button' => 'green lighten-2' ]; $toolbar->appendButton('Core.link', $title, $url, $options); }
[ "public", "static", "function", "add", "(", "$", "title", "=", "null", ",", "$", "url", "=", "[", "'action'", "=>", "'add'", "]", ",", "$", "icon", "=", "'plus'", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "toolbar", "=", "Toolbar", "::", "getInstance", "(", "self", "::", "$", "_toolbar", ")", ";", "$", "options", "+=", "[", "'icon'", "=>", "$", "icon", ",", "'button'", "=>", "'green lighten-2'", "]", ";", "$", "toolbar", "->", "appendButton", "(", "'Core.link'", ",", "$", "title", ",", "$", "url", ",", "$", "options", ")", ";", "}" ]
Create add link. @param string|null $title @param array|string $url @param string $icon @param array $options @return void
[ "Create", "add", "link", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Toolbar/ToolbarHelper.php#L48-L57
17,673
CakeCMS/Core
src/Toolbar/ToolbarHelper.php
ToolbarHelper.apply
public static function apply($title = null) { $toolbar = Toolbar::getInstance(self::$_toolbar); $title = (empty($title)) ? __d('core', 'Apply') : $title; $toolbar->appendButton('Core.action', $title, self::ACTION_APPLY, [ 'class' => 'jsFormButton', 'icon' => 'check-square-o', 'button' => 'green lighten-2', ]); }
php
public static function apply($title = null) { $toolbar = Toolbar::getInstance(self::$_toolbar); $title = (empty($title)) ? __d('core', 'Apply') : $title; $toolbar->appendButton('Core.action', $title, self::ACTION_APPLY, [ 'class' => 'jsFormButton', 'icon' => 'check-square-o', 'button' => 'green lighten-2', ]); }
[ "public", "static", "function", "apply", "(", "$", "title", "=", "null", ")", "{", "$", "toolbar", "=", "Toolbar", "::", "getInstance", "(", "self", "::", "$", "_toolbar", ")", ";", "$", "title", "=", "(", "empty", "(", "$", "title", ")", ")", "?", "__d", "(", "'core'", ",", "'Apply'", ")", ":", "$", "title", ";", "$", "toolbar", "->", "appendButton", "(", "'Core.action'", ",", "$", "title", ",", "self", "::", "ACTION_APPLY", ",", "[", "'class'", "=>", "'jsFormButton'", ",", "'icon'", "=>", "'check-square-o'", ",", "'button'", "=>", "'green lighten-2'", ",", "]", ")", ";", "}" ]
Apply form button. @param null|string $title @return void
[ "Apply", "form", "button", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Toolbar/ToolbarHelper.php#L65-L75
17,674
CakeCMS/Core
src/Toolbar/ToolbarHelper.php
ToolbarHelper.cancel
public static function cancel($title = null, $url = null, array $options = []) { $toolbar = Toolbar::getInstance(self::$_toolbar); $options += [ 'icon' => 'close', 'iconClass' => 'ckTextRed', 'button' => 'grey lighten-3' ]; if (empty($url)) { $url = ['action' => 'index']; } $title = (empty($title)) ? __d('core', 'Cancel') : $title; $toolbar->appendButton('Core.link', $title, $url, $options); }
php
public static function cancel($title = null, $url = null, array $options = []) { $toolbar = Toolbar::getInstance(self::$_toolbar); $options += [ 'icon' => 'close', 'iconClass' => 'ckTextRed', 'button' => 'grey lighten-3' ]; if (empty($url)) { $url = ['action' => 'index']; } $title = (empty($title)) ? __d('core', 'Cancel') : $title; $toolbar->appendButton('Core.link', $title, $url, $options); }
[ "public", "static", "function", "cancel", "(", "$", "title", "=", "null", ",", "$", "url", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "toolbar", "=", "Toolbar", "::", "getInstance", "(", "self", "::", "$", "_toolbar", ")", ";", "$", "options", "+=", "[", "'icon'", "=>", "'close'", ",", "'iconClass'", "=>", "'ckTextRed'", ",", "'button'", "=>", "'grey lighten-3'", "]", ";", "if", "(", "empty", "(", "$", "url", ")", ")", "{", "$", "url", "=", "[", "'action'", "=>", "'index'", "]", ";", "}", "$", "title", "=", "(", "empty", "(", "$", "title", ")", ")", "?", "__d", "(", "'core'", ",", "'Cancel'", ")", ":", "$", "title", ";", "$", "toolbar", "->", "appendButton", "(", "'Core.link'", ",", "$", "title", ",", "$", "url", ",", "$", "options", ")", ";", "}" ]
Cancel form button. @param string|null $title @param null|string|array $url @param array $options @return void
[ "Cancel", "form", "button", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Toolbar/ToolbarHelper.php#L85-L101
17,675
CakeCMS/Core
src/Toolbar/ToolbarHelper.php
ToolbarHelper.delete
public static function delete($title = null) { $toolbar = Toolbar::getInstance(self::$_toolbar); $title = (empty($title)) ? __d('core', 'Delete') : $title; $toolbar->appendButton('Core.action', $title, self::ACTION_DELETE, []); }
php
public static function delete($title = null) { $toolbar = Toolbar::getInstance(self::$_toolbar); $title = (empty($title)) ? __d('core', 'Delete') : $title; $toolbar->appendButton('Core.action', $title, self::ACTION_DELETE, []); }
[ "public", "static", "function", "delete", "(", "$", "title", "=", "null", ")", "{", "$", "toolbar", "=", "Toolbar", "::", "getInstance", "(", "self", "::", "$", "_toolbar", ")", ";", "$", "title", "=", "(", "empty", "(", "$", "title", ")", ")", "?", "__d", "(", "'core'", ",", "'Delete'", ")", ":", "$", "title", ";", "$", "toolbar", "->", "appendButton", "(", "'Core.action'", ",", "$", "title", ",", "self", "::", "ACTION_DELETE", ",", "[", "]", ")", ";", "}" ]
Delete for process form. @param string|null $title @return void
[ "Delete", "for", "process", "form", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Toolbar/ToolbarHelper.php#L109-L115
17,676
CakeCMS/Core
src/Toolbar/ToolbarHelper.php
ToolbarHelper.link
public static function link($title, $url, array $options = []) { $toolbar = Toolbar::getInstance(self::$_toolbar); $options += [ 'icon' => 'link', 'button' => 'grey lighten-3' ]; $toolbar->appendButton('Core.link', $title, $url, $options); }
php
public static function link($title, $url, array $options = []) { $toolbar = Toolbar::getInstance(self::$_toolbar); $options += [ 'icon' => 'link', 'button' => 'grey lighten-3' ]; $toolbar->appendButton('Core.link', $title, $url, $options); }
[ "public", "static", "function", "link", "(", "$", "title", ",", "$", "url", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "toolbar", "=", "Toolbar", "::", "getInstance", "(", "self", "::", "$", "_toolbar", ")", ";", "$", "options", "+=", "[", "'icon'", "=>", "'link'", ",", "'button'", "=>", "'grey lighten-3'", "]", ";", "$", "toolbar", "->", "appendButton", "(", "'Core.link'", ",", "$", "title", ",", "$", "url", ",", "$", "options", ")", ";", "}" ]
Create link output. @param string $title @param string|array $url @param array $options
[ "Create", "link", "output", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Toolbar/ToolbarHelper.php#L124-L133
17,677
CakeCMS/Core
src/Toolbar/ToolbarHelper.php
ToolbarHelper.save
public static function save($title = null) { $toolbar = Toolbar::getInstance(self::$_toolbar); $title = (empty($title)) ? __d('core', 'Save') : $title; $toolbar->appendButton('Core.action', $title, self::ACTION_SAVE, [ 'icon' => 'check', 'class' => 'jsFormButton', 'iconClass' => 'ckTextGreen', 'button' => 'grey lighten-3', ]); }
php
public static function save($title = null) { $toolbar = Toolbar::getInstance(self::$_toolbar); $title = (empty($title)) ? __d('core', 'Save') : $title; $toolbar->appendButton('Core.action', $title, self::ACTION_SAVE, [ 'icon' => 'check', 'class' => 'jsFormButton', 'iconClass' => 'ckTextGreen', 'button' => 'grey lighten-3', ]); }
[ "public", "static", "function", "save", "(", "$", "title", "=", "null", ")", "{", "$", "toolbar", "=", "Toolbar", "::", "getInstance", "(", "self", "::", "$", "_toolbar", ")", ";", "$", "title", "=", "(", "empty", "(", "$", "title", ")", ")", "?", "__d", "(", "'core'", ",", "'Save'", ")", ":", "$", "title", ";", "$", "toolbar", "->", "appendButton", "(", "'Core.action'", ",", "$", "title", ",", "self", "::", "ACTION_SAVE", ",", "[", "'icon'", "=>", "'check'", ",", "'class'", "=>", "'jsFormButton'", ",", "'iconClass'", "=>", "'ckTextGreen'", ",", "'button'", "=>", "'grey lighten-3'", ",", "]", ")", ";", "}" ]
Save form button. @param null|string $title @return void
[ "Save", "form", "button", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Toolbar/ToolbarHelper.php#L141-L152
17,678
ripaclub/zf2-sphinxsearch-tool
src/Controller/Traits/ConfigTrait.php
ConfigTrait.getConfig
protected function getConfig($file = null) { // Config $appConfig = $this->getServiceLocator()->get('Config'); if (!isset($appConfig['sphinxsearch'])) { throw new \InvalidArgumentException('Config not found with name: "sphinxsearch"'); } else { $config = new Config($appConfig['sphinxsearch'], true); // defaults if (!is_null($file)) { $fileConfig = Factory::fromFile($file, true); if (!isset($fileConfig['sphinxsearch'])) { throw new \InvalidArgumentException('Config not found with name: "sphinxsearch"'); } $config->merge($fileConfig['sphinxsearch']); } } return $config; }
php
protected function getConfig($file = null) { // Config $appConfig = $this->getServiceLocator()->get('Config'); if (!isset($appConfig['sphinxsearch'])) { throw new \InvalidArgumentException('Config not found with name: "sphinxsearch"'); } else { $config = new Config($appConfig['sphinxsearch'], true); // defaults if (!is_null($file)) { $fileConfig = Factory::fromFile($file, true); if (!isset($fileConfig['sphinxsearch'])) { throw new \InvalidArgumentException('Config not found with name: "sphinxsearch"'); } $config->merge($fileConfig['sphinxsearch']); } } return $config; }
[ "protected", "function", "getConfig", "(", "$", "file", "=", "null", ")", "{", "// Config", "$", "appConfig", "=", "$", "this", "->", "getServiceLocator", "(", ")", "->", "get", "(", "'Config'", ")", ";", "if", "(", "!", "isset", "(", "$", "appConfig", "[", "'sphinxsearch'", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Config not found with name: \"sphinxsearch\"'", ")", ";", "}", "else", "{", "$", "config", "=", "new", "Config", "(", "$", "appConfig", "[", "'sphinxsearch'", "]", ",", "true", ")", ";", "// defaults", "if", "(", "!", "is_null", "(", "$", "file", ")", ")", "{", "$", "fileConfig", "=", "Factory", "::", "fromFile", "(", "$", "file", ",", "true", ")", ";", "if", "(", "!", "isset", "(", "$", "fileConfig", "[", "'sphinxsearch'", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Config not found with name: \"sphinxsearch\"'", ")", ";", "}", "$", "config", "->", "merge", "(", "$", "fileConfig", "[", "'sphinxsearch'", "]", ")", ";", "}", "}", "return", "$", "config", ";", "}" ]
Retrieve the config of sphinxsearch node @param string|null $file @return Config
[ "Retrieve", "the", "config", "of", "sphinxsearch", "node" ]
4cb51341ccf1db9942e3e578855a579afd608d69
https://github.com/ripaclub/zf2-sphinxsearch-tool/blob/4cb51341ccf1db9942e3e578855a579afd608d69/src/Controller/Traits/ConfigTrait.php#L27-L46
17,679
steeffeen/FancyManiaLinks
FML/Stylesheet/SkyGradientKey.php
SkyGradientKey.render
public function render(\DOMDocument $domDocument) { $domElement = $domDocument->createElement("key"); $domElement->setAttribute("x", $this->x); $domElement->setAttribute("color", $this->color); return $domElement; }
php
public function render(\DOMDocument $domDocument) { $domElement = $domDocument->createElement("key"); $domElement->setAttribute("x", $this->x); $domElement->setAttribute("color", $this->color); return $domElement; }
[ "public", "function", "render", "(", "\\", "DOMDocument", "$", "domDocument", ")", "{", "$", "domElement", "=", "$", "domDocument", "->", "createElement", "(", "\"key\"", ")", ";", "$", "domElement", "->", "setAttribute", "(", "\"x\"", ",", "$", "this", "->", "x", ")", ";", "$", "domElement", "->", "setAttribute", "(", "\"color\"", ",", "$", "this", "->", "color", ")", ";", "return", "$", "domElement", ";", "}" ]
Render the SkyGradientKey @param \DOMDocument $domDocument DOMDocument for which the Sky Gradient Key should be rendered @return \DOMElement
[ "Render", "the", "SkyGradientKey" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/SkyGradientKey.php#L109-L115
17,680
steeffeen/FancyManiaLinks
FML/Controls/Graph.php
Graph.createSettings
protected function createSettings() { $this->graphSettings = new GraphSettings($this); $this->addScriptFeature($this->graphSettings); return $this->graphSettings; }
php
protected function createSettings() { $this->graphSettings = new GraphSettings($this); $this->addScriptFeature($this->graphSettings); return $this->graphSettings; }
[ "protected", "function", "createSettings", "(", ")", "{", "$", "this", "->", "graphSettings", "=", "new", "GraphSettings", "(", "$", "this", ")", ";", "$", "this", "->", "addScriptFeature", "(", "$", "this", "->", "graphSettings", ")", ";", "return", "$", "this", "->", "graphSettings", ";", "}" ]
Create new graph settings @return GraphSettings
[ "Create", "new", "graph", "settings" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Controls/Graph.php#L48-L53
17,681
iocaste/microservice-foundation
src/Data/Models/Parameter/Parameter.php
Parameter.choices
public function choices(): HasMany { return $this->hasMany(\Iocaste\Microservice\Foundation\Data\Models\Parameter\Choice::class); }
php
public function choices(): HasMany { return $this->hasMany(\Iocaste\Microservice\Foundation\Data\Models\Parameter\Choice::class); }
[ "public", "function", "choices", "(", ")", ":", "HasMany", "{", "return", "$", "this", "->", "hasMany", "(", "\\", "Iocaste", "\\", "Microservice", "\\", "Foundation", "\\", "Data", "\\", "Models", "\\", "Parameter", "\\", "Choice", "::", "class", ")", ";", "}" ]
One-to-Many Relationship One Parameter has Many Choices. @return \Illuminate\Database\Eloquent\Relations\HasMany
[ "One", "-", "to", "-", "Many", "Relationship", "One", "Parameter", "has", "Many", "Choices", "." ]
274a154de4299e8a57314bab972e09f6d8cdae9e
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Data/Models/Parameter/Parameter.php#L71-L74
17,682
ClanCats/Core
src/classes/CCCookie.php
CCCookie.get
public static function get( $key, $default = null ) { if ( !isset( CCServer::$_instance->COOKIE[$key] ) ) { return $default; } return CCServer::$_instance->COOKIE[$key]; }
php
public static function get( $key, $default = null ) { if ( !isset( CCServer::$_instance->COOKIE[$key] ) ) { return $default; } return CCServer::$_instance->COOKIE[$key]; }
[ "public", "static", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "CCServer", "::", "$", "_instance", "->", "COOKIE", "[", "$", "key", "]", ")", ")", "{", "return", "$", "default", ";", "}", "return", "CCServer", "::", "$", "_instance", "->", "COOKIE", "[", "$", "key", "]", ";", "}" ]
get a cookie @param string $key @return mixed
[ "get", "a", "cookie" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCCookie.php#L78-L85
17,683
ClanCats/Core
src/classes/CCCookie.php
CCCookie.once
public static function once( $key ) { if ( !is_null( static::get( $key ) ) ) { $cookie = static::get( $key ); static::delete( $key ); return $cookie; } }
php
public static function once( $key ) { if ( !is_null( static::get( $key ) ) ) { $cookie = static::get( $key ); static::delete( $key ); return $cookie; } }
[ "public", "static", "function", "once", "(", "$", "key", ")", "{", "if", "(", "!", "is_null", "(", "static", "::", "get", "(", "$", "key", ")", ")", ")", "{", "$", "cookie", "=", "static", "::", "get", "(", "$", "key", ")", ";", "static", "::", "delete", "(", "$", "key", ")", ";", "return", "$", "cookie", ";", "}", "}" ]
eat a cookie, means get it once @param string $key @return mixed
[ "eat", "a", "cookie", "means", "get", "it", "once" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCCookie.php#L93-L101
17,684
PortaText/php-sdk
src/PortaText/Command/Factory.php
Factory.get
public function get($command) { $className = ucfirst($command); $className = "PortaText\\Command\\Api\\$className"; if (!class_exists($className)) { throw new \InvalidArgumentException( "Command $command does not exist" ); } return new $className(); }
php
public function get($command) { $className = ucfirst($command); $className = "PortaText\\Command\\Api\\$className"; if (!class_exists($className)) { throw new \InvalidArgumentException( "Command $command does not exist" ); } return new $className(); }
[ "public", "function", "get", "(", "$", "command", ")", "{", "$", "className", "=", "ucfirst", "(", "$", "command", ")", ";", "$", "className", "=", "\"PortaText\\\\Command\\\\Api\\\\$className\"", ";", "if", "(", "!", "class_exists", "(", "$", "className", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Command $command does not exist\"", ")", ";", "}", "return", "new", "$", "className", "(", ")", ";", "}" ]
Returns a command instance based on the command name requested. @param string $command The name of the command. @return PortaText\Command\ICommand @throws InvalidArgumentException
[ "Returns", "a", "command", "instance", "based", "on", "the", "command", "name", "requested", "." ]
dbe04ef043db5b251953f9de57aa4d0f1785dfcc
https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Factory.php#L24-L34
17,685
joseph-walker/vector
src/Lib/Strings.php
Strings.__chomp
protected static function __chomp(string $toChomp, string $string) : string { /** @noinspection PhpParamsInspection */ $chomp = Lambda::compose(self::lchomp($toChomp), self::rchomp($toChomp)); return $chomp($string); }
php
protected static function __chomp(string $toChomp, string $string) : string { /** @noinspection PhpParamsInspection */ $chomp = Lambda::compose(self::lchomp($toChomp), self::rchomp($toChomp)); return $chomp($string); }
[ "protected", "static", "function", "__chomp", "(", "string", "$", "toChomp", ",", "string", "$", "string", ")", ":", "string", "{", "/** @noinspection PhpParamsInspection */", "$", "chomp", "=", "Lambda", "::", "compose", "(", "self", "::", "lchomp", "(", "$", "toChomp", ")", ",", "self", "::", "rchomp", "(", "$", "toChomp", ")", ")", ";", "return", "$", "chomp", "(", "$", "string", ")", ";", "}" ]
Two-Sided Chomp Removes the specified substring from both ends of the target string. Unlike PHP's trim function, the substring to chomp is not a character mask -- rather it is a full substring. This function is case sensitive. @example Strings::chomp('a', 'abccba'); // 'bccb' Strings::chomp('ab', 'abccba'); // 'abccba' Strings::chomp('A', 'abccba'); // 'abccba' @type String -> String @param String $toChomp string to chomp @param String $string string to be chomped @return string
[ "Two", "-", "Sided", "Chomp" ]
e349aa2e9e0535b1993f9fffc0476e7fd8e113fc
https://github.com/joseph-walker/vector/blob/e349aa2e9e0535b1993f9fffc0476e7fd8e113fc/src/Lib/Strings.php#L230-L236
17,686
aedart/laravel-helpers
src/Traits/Filesystem/StorageFactoryTrait.php
StorageFactoryTrait.getStorageFactory
public function getStorageFactory(): ?Factory { if (!$this->hasStorageFactory()) { $this->setStorageFactory($this->getDefaultStorageFactory()); } return $this->storageFactory; }
php
public function getStorageFactory(): ?Factory { if (!$this->hasStorageFactory()) { $this->setStorageFactory($this->getDefaultStorageFactory()); } return $this->storageFactory; }
[ "public", "function", "getStorageFactory", "(", ")", ":", "?", "Factory", "{", "if", "(", "!", "$", "this", "->", "hasStorageFactory", "(", ")", ")", "{", "$", "this", "->", "setStorageFactory", "(", "$", "this", "->", "getDefaultStorageFactory", "(", ")", ")", ";", "}", "return", "$", "this", "->", "storageFactory", ";", "}" ]
Get storage factory If no storage factory has been set, this method will set and return a default storage factory, if any such value is available @see getDefaultStorageFactory() @return Factory|null storage factory or null if none storage factory has been set
[ "Get", "storage", "factory" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Filesystem/StorageFactoryTrait.php#L53-L59
17,687
xavieryang007/xcron-expression
src/Cron/FieldFactory.php
FieldFactory.getField
public function getField($position) { if (!isset($this->fields[$position])) { switch ($position) { case 0: $this->fields[$position] = new SecondsField(); break; case 1: $this->fields[$position] = new MinutesField(); break; case 2: $this->fields[$position] = new HoursField(); break; case 3: $this->fields[$position] = new DayOfMonthField(); break; case 4: $this->fields[$position] = new MonthField(); break; case 5: $this->fields[$position] = new DayOfWeekField(); break; default: throw new InvalidArgumentException( $position . ' is not a valid position' ); } } return $this->fields[$position]; }
php
public function getField($position) { if (!isset($this->fields[$position])) { switch ($position) { case 0: $this->fields[$position] = new SecondsField(); break; case 1: $this->fields[$position] = new MinutesField(); break; case 2: $this->fields[$position] = new HoursField(); break; case 3: $this->fields[$position] = new DayOfMonthField(); break; case 4: $this->fields[$position] = new MonthField(); break; case 5: $this->fields[$position] = new DayOfWeekField(); break; default: throw new InvalidArgumentException( $position . ' is not a valid position' ); } } return $this->fields[$position]; }
[ "public", "function", "getField", "(", "$", "position", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "fields", "[", "$", "position", "]", ")", ")", "{", "switch", "(", "$", "position", ")", "{", "case", "0", ":", "$", "this", "->", "fields", "[", "$", "position", "]", "=", "new", "SecondsField", "(", ")", ";", "break", ";", "case", "1", ":", "$", "this", "->", "fields", "[", "$", "position", "]", "=", "new", "MinutesField", "(", ")", ";", "break", ";", "case", "2", ":", "$", "this", "->", "fields", "[", "$", "position", "]", "=", "new", "HoursField", "(", ")", ";", "break", ";", "case", "3", ":", "$", "this", "->", "fields", "[", "$", "position", "]", "=", "new", "DayOfMonthField", "(", ")", ";", "break", ";", "case", "4", ":", "$", "this", "->", "fields", "[", "$", "position", "]", "=", "new", "MonthField", "(", ")", ";", "break", ";", "case", "5", ":", "$", "this", "->", "fields", "[", "$", "position", "]", "=", "new", "DayOfWeekField", "(", ")", ";", "break", ";", "default", ":", "throw", "new", "InvalidArgumentException", "(", "$", "position", ".", "' is not a valid position'", ")", ";", "}", "}", "return", "$", "this", "->", "fields", "[", "$", "position", "]", ";", "}" ]
Get an instance of a field object for a cron expression position @param int $position CRON expression position value to retrieve @return FieldInterface @throws InvalidArgumentException if a position is not valid
[ "Get", "an", "instance", "of", "a", "field", "object", "for", "a", "cron", "expression", "position" ]
a7fa8108ee8ad636625425a9795aae8ba4fee1b3
https://github.com/xavieryang007/xcron-expression/blob/a7fa8108ee8ad636625425a9795aae8ba4fee1b3/src/Cron/FieldFactory.php#L26-L55
17,688
jfusion/org.jfusion.framework
src/Plugin/Platform.php
Platform.hasFile
final public function hasFile($file) { $helloReflection = new \ReflectionClass($this); $dir = dirname($helloReflection->getFilename()); if(file_exists($dir . '/' . $file)) { return $dir . '/' . $file; } return false; }
php
final public function hasFile($file) { $helloReflection = new \ReflectionClass($this); $dir = dirname($helloReflection->getFilename()); if(file_exists($dir . '/' . $file)) { return $dir . '/' . $file; } return false; }
[ "final", "public", "function", "hasFile", "(", "$", "file", ")", "{", "$", "helloReflection", "=", "new", "\\", "ReflectionClass", "(", "$", "this", ")", ";", "$", "dir", "=", "dirname", "(", "$", "helloReflection", "->", "getFilename", "(", ")", ")", ";", "if", "(", "file_exists", "(", "$", "dir", ".", "'/'", ".", "$", "file", ")", ")", "{", "return", "$", "dir", ".", "'/'", ".", "$", "file", ";", "}", "return", "false", ";", "}" ]
framework has file? @param $file @return boolean|string
[ "framework", "has", "file?" ]
65771963f23ccabcf1f867eb17c9452299cfe683
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Plugin/Platform.php#L55-L64
17,689
4devs/ElfinderPhpConnector
Driver/LocalDriver.php
LocalDriver.dim
public function dim(Response $response, $target) { $img = $this->getImageManager()->make($target); $response->setDim($img->getWidth().'x'.$img->getHeight()); }
php
public function dim(Response $response, $target) { $img = $this->getImageManager()->make($target); $response->setDim($img->getWidth().'x'.$img->getHeight()); }
[ "public", "function", "dim", "(", "Response", "$", "response", ",", "$", "target", ")", "{", "$", "img", "=", "$", "this", "->", "getImageManager", "(", ")", "->", "make", "(", "$", "target", ")", ";", "$", "response", "->", "setDim", "(", "$", "img", "->", "getWidth", "(", ")", ".", "'x'", ".", "$", "img", "->", "getHeight", "(", ")", ")", ";", "}" ]
return image dimensions. @param Response $response @param string $target
[ "return", "image", "dimensions", "." ]
510e295dcafeaa0f796986ad87b3ed5f6b0d9338
https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L406-L410
17,690
4devs/ElfinderPhpConnector
Driver/LocalDriver.php
LocalDriver.setAdditionalImages
public function setAdditionalImages(array $additionalImages) { $resolver = new OptionsResolver(); $this->configureAdditionalImage($resolver); $this->additionalImages = $additionalImages; foreach ($additionalImages as $additionalImage) { $this->addAdditionalImage($additionalImage, $resolver); } return $this; }
php
public function setAdditionalImages(array $additionalImages) { $resolver = new OptionsResolver(); $this->configureAdditionalImage($resolver); $this->additionalImages = $additionalImages; foreach ($additionalImages as $additionalImage) { $this->addAdditionalImage($additionalImage, $resolver); } return $this; }
[ "public", "function", "setAdditionalImages", "(", "array", "$", "additionalImages", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "this", "->", "configureAdditionalImage", "(", "$", "resolver", ")", ";", "$", "this", "->", "additionalImages", "=", "$", "additionalImages", ";", "foreach", "(", "$", "additionalImages", "as", "$", "additionalImage", ")", "{", "$", "this", "->", "addAdditionalImage", "(", "$", "additionalImage", ",", "$", "resolver", ")", ";", "}", "return", "$", "this", ";", "}" ]
set Additional Images. @param array $additionalImages @return $this
[ "set", "Additional", "Images", "." ]
510e295dcafeaa0f796986ad87b3ed5f6b0d9338
https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L419-L429
17,691
4devs/ElfinderPhpConnector
Driver/LocalDriver.php
LocalDriver.addAdditionalImage
protected function addAdditionalImage(array $additionalImage, OptionsResolver $resolver) { $image = $resolver->resolve($additionalImage); $this->additionalImages[$image['prefix']] = $image; return $this; }
php
protected function addAdditionalImage(array $additionalImage, OptionsResolver $resolver) { $image = $resolver->resolve($additionalImage); $this->additionalImages[$image['prefix']] = $image; return $this; }
[ "protected", "function", "addAdditionalImage", "(", "array", "$", "additionalImage", ",", "OptionsResolver", "$", "resolver", ")", "{", "$", "image", "=", "$", "resolver", "->", "resolve", "(", "$", "additionalImage", ")", ";", "$", "this", "->", "additionalImages", "[", "$", "image", "[", "'prefix'", "]", "]", "=", "$", "image", ";", "return", "$", "this", ";", "}" ]
add Additional Image. @param array $additionalImage @param OptionsResolver $resolver @return $this
[ "add", "Additional", "Image", "." ]
510e295dcafeaa0f796986ad87b3ed5f6b0d9338
https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L439-L445
17,692
4devs/ElfinderPhpConnector
Driver/LocalDriver.php
LocalDriver.configureAdditionalImage
protected function configureAdditionalImage(OptionsResolver $resolver) { $resolver ->setRequired(['prefix', 'width', 'height']) ->setOptional(['mode']) ->setDefaults(['mode' => 'fit']) ->addAllowedTypes( [ 'prefix' => 'string', 'mode' => 'string', 'width' => 'integer', 'height' => 'integer', ] ) ->addAllowedValues(['mode' => ['crop', 'resize', 'fit']]); return $this; }
php
protected function configureAdditionalImage(OptionsResolver $resolver) { $resolver ->setRequired(['prefix', 'width', 'height']) ->setOptional(['mode']) ->setDefaults(['mode' => 'fit']) ->addAllowedTypes( [ 'prefix' => 'string', 'mode' => 'string', 'width' => 'integer', 'height' => 'integer', ] ) ->addAllowedValues(['mode' => ['crop', 'resize', 'fit']]); return $this; }
[ "protected", "function", "configureAdditionalImage", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "resolver", "->", "setRequired", "(", "[", "'prefix'", ",", "'width'", ",", "'height'", "]", ")", "->", "setOptional", "(", "[", "'mode'", "]", ")", "->", "setDefaults", "(", "[", "'mode'", "=>", "'fit'", "]", ")", "->", "addAllowedTypes", "(", "[", "'prefix'", "=>", "'string'", ",", "'mode'", "=>", "'string'", ",", "'width'", "=>", "'integer'", ",", "'height'", "=>", "'integer'", ",", "]", ")", "->", "addAllowedValues", "(", "[", "'mode'", "=>", "[", "'crop'", ",", "'resize'", ",", "'fit'", "]", "]", ")", ";", "return", "$", "this", ";", "}" ]
configure Additional Image. @param OptionsResolver $resolver @return $this
[ "configure", "Additional", "Image", "." ]
510e295dcafeaa0f796986ad87b3ed5f6b0d9338
https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L454-L471
17,693
4devs/ElfinderPhpConnector
Driver/LocalDriver.php
LocalDriver.copyDir
private function copyDir(Response $response, $target, $dst, $newFolder = '') { $folder = trim(strrchr($target, DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR); $newFolder = $newFolder ?: $dst.DIRECTORY_SEPARATOR.$folder; if (file_exists($newFolder)) { throw new ExistsException(sprintf('folder "%s" exists', $newFolder)); } mkdir($newFolder); $response->addAdded($this->getFileInfo($newFolder)); foreach (glob($target.'/*') as $name) { if (is_dir($name)) { $this->copyDir($response, $name, $newFolder); } else { $filename = $newFolder.DIRECTORY_SEPARATOR.$this->basename($name); copy($name, $filename); $response->addAdded($this->getFileInfo($filename)); } } }
php
private function copyDir(Response $response, $target, $dst, $newFolder = '') { $folder = trim(strrchr($target, DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR); $newFolder = $newFolder ?: $dst.DIRECTORY_SEPARATOR.$folder; if (file_exists($newFolder)) { throw new ExistsException(sprintf('folder "%s" exists', $newFolder)); } mkdir($newFolder); $response->addAdded($this->getFileInfo($newFolder)); foreach (glob($target.'/*') as $name) { if (is_dir($name)) { $this->copyDir($response, $name, $newFolder); } else { $filename = $newFolder.DIRECTORY_SEPARATOR.$this->basename($name); copy($name, $filename); $response->addAdded($this->getFileInfo($filename)); } } }
[ "private", "function", "copyDir", "(", "Response", "$", "response", ",", "$", "target", ",", "$", "dst", ",", "$", "newFolder", "=", "''", ")", "{", "$", "folder", "=", "trim", "(", "strrchr", "(", "$", "target", ",", "DIRECTORY_SEPARATOR", ")", ",", "DIRECTORY_SEPARATOR", ")", ";", "$", "newFolder", "=", "$", "newFolder", "?", ":", "$", "dst", ".", "DIRECTORY_SEPARATOR", ".", "$", "folder", ";", "if", "(", "file_exists", "(", "$", "newFolder", ")", ")", "{", "throw", "new", "ExistsException", "(", "sprintf", "(", "'folder \"%s\" exists'", ",", "$", "newFolder", ")", ")", ";", "}", "mkdir", "(", "$", "newFolder", ")", ";", "$", "response", "->", "addAdded", "(", "$", "this", "->", "getFileInfo", "(", "$", "newFolder", ")", ")", ";", "foreach", "(", "glob", "(", "$", "target", ".", "'/*'", ")", "as", "$", "name", ")", "{", "if", "(", "is_dir", "(", "$", "name", ")", ")", "{", "$", "this", "->", "copyDir", "(", "$", "response", ",", "$", "name", ",", "$", "newFolder", ")", ";", "}", "else", "{", "$", "filename", "=", "$", "newFolder", ".", "DIRECTORY_SEPARATOR", ".", "$", "this", "->", "basename", "(", "$", "name", ")", ";", "copy", "(", "$", "name", ",", "$", "filename", ")", ";", "$", "response", "->", "addAdded", "(", "$", "this", "->", "getFileInfo", "(", "$", "filename", ")", ")", ";", "}", "}", "}" ]
copy dir and all inside. @param Response $response @param string $target @param string $dst @param string $newFolder
[ "copy", "dir", "and", "all", "inside", "." ]
510e295dcafeaa0f796986ad87b3ed5f6b0d9338
https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L481-L499
17,694
4devs/ElfinderPhpConnector
Driver/LocalDriver.php
LocalDriver.isShowFile
private function isShowFile($name, $showHidden = false) { $response = true; if ($name == '.' || $name == '..' || (!$showHidden && strpos($name, '.') === 0)) { $response = false; } return $response; }
php
private function isShowFile($name, $showHidden = false) { $response = true; if ($name == '.' || $name == '..' || (!$showHidden && strpos($name, '.') === 0)) { $response = false; } return $response; }
[ "private", "function", "isShowFile", "(", "$", "name", ",", "$", "showHidden", "=", "false", ")", "{", "$", "response", "=", "true", ";", "if", "(", "$", "name", "==", "'.'", "||", "$", "name", "==", "'..'", "||", "(", "!", "$", "showHidden", "&&", "strpos", "(", "$", "name", ",", "'.'", ")", "===", "0", ")", ")", "{", "$", "response", "=", "false", ";", "}", "return", "$", "response", ";", "}" ]
is Show File. @param string $name @return bool
[ "is", "Show", "File", "." ]
510e295dcafeaa0f796986ad87b3ed5f6b0d9338
https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L508-L516
17,695
4devs/ElfinderPhpConnector
Driver/LocalDriver.php
LocalDriver.getFileInfo
private function getFileInfo($file) { if (!file_exists($file)) { throw new NotFoundException(sprintf('file "%s" not found', $file)); } $fileStat = stat($file); $directory = dirname($file) == '.' ? '' : dirname($file); $fileInfo = new FileInfo($this->basename($file), $this->getDriverId(), $fileStat['mtime'], $directory); $fileInfo->setSize($fileStat['size']); $fileInfo->setWrite(is_writable($file)); $fileInfo->setMime($this->getMimeType($file)); $fileInfo->setLocked($this->driverOptions['locked']); $this->setDirs($fileInfo, $file); $tmb = $this->getThumb($file); if (!file_exists($tmb) && in_array($fileInfo->getMime(), ['image/jpeg', 'image/png', 'image/gif'])) { $fileInfo->setTmb(1); } elseif (file_exists($tmb)) { $fileInfo->setTmb(DIRECTORY_SEPARATOR.$tmb); } return $fileInfo; }
php
private function getFileInfo($file) { if (!file_exists($file)) { throw new NotFoundException(sprintf('file "%s" not found', $file)); } $fileStat = stat($file); $directory = dirname($file) == '.' ? '' : dirname($file); $fileInfo = new FileInfo($this->basename($file), $this->getDriverId(), $fileStat['mtime'], $directory); $fileInfo->setSize($fileStat['size']); $fileInfo->setWrite(is_writable($file)); $fileInfo->setMime($this->getMimeType($file)); $fileInfo->setLocked($this->driverOptions['locked']); $this->setDirs($fileInfo, $file); $tmb = $this->getThumb($file); if (!file_exists($tmb) && in_array($fileInfo->getMime(), ['image/jpeg', 'image/png', 'image/gif'])) { $fileInfo->setTmb(1); } elseif (file_exists($tmb)) { $fileInfo->setTmb(DIRECTORY_SEPARATOR.$tmb); } return $fileInfo; }
[ "private", "function", "getFileInfo", "(", "$", "file", ")", "{", "if", "(", "!", "file_exists", "(", "$", "file", ")", ")", "{", "throw", "new", "NotFoundException", "(", "sprintf", "(", "'file \"%s\" not found'", ",", "$", "file", ")", ")", ";", "}", "$", "fileStat", "=", "stat", "(", "$", "file", ")", ";", "$", "directory", "=", "dirname", "(", "$", "file", ")", "==", "'.'", "?", "''", ":", "dirname", "(", "$", "file", ")", ";", "$", "fileInfo", "=", "new", "FileInfo", "(", "$", "this", "->", "basename", "(", "$", "file", ")", ",", "$", "this", "->", "getDriverId", "(", ")", ",", "$", "fileStat", "[", "'mtime'", "]", ",", "$", "directory", ")", ";", "$", "fileInfo", "->", "setSize", "(", "$", "fileStat", "[", "'size'", "]", ")", ";", "$", "fileInfo", "->", "setWrite", "(", "is_writable", "(", "$", "file", ")", ")", ";", "$", "fileInfo", "->", "setMime", "(", "$", "this", "->", "getMimeType", "(", "$", "file", ")", ")", ";", "$", "fileInfo", "->", "setLocked", "(", "$", "this", "->", "driverOptions", "[", "'locked'", "]", ")", ";", "$", "this", "->", "setDirs", "(", "$", "fileInfo", ",", "$", "file", ")", ";", "$", "tmb", "=", "$", "this", "->", "getThumb", "(", "$", "file", ")", ";", "if", "(", "!", "file_exists", "(", "$", "tmb", ")", "&&", "in_array", "(", "$", "fileInfo", "->", "getMime", "(", ")", ",", "[", "'image/jpeg'", ",", "'image/png'", ",", "'image/gif'", "]", ")", ")", "{", "$", "fileInfo", "->", "setTmb", "(", "1", ")", ";", "}", "elseif", "(", "file_exists", "(", "$", "tmb", ")", ")", "{", "$", "fileInfo", "->", "setTmb", "(", "DIRECTORY_SEPARATOR", ".", "$", "tmb", ")", ";", "}", "return", "$", "fileInfo", ";", "}" ]
get file info by full path file name. @param string $file @return FileInfo
[ "get", "file", "info", "by", "full", "path", "file", "name", "." ]
510e295dcafeaa0f796986ad87b3ed5f6b0d9338
https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L525-L546
17,696
4devs/ElfinderPhpConnector
Driver/LocalDriver.php
LocalDriver.getMimeType
private function getMimeType($file) { $type = FileInfo::DIRECTORY_MIME_TYPE; if (is_file($file)) { if (class_exists('finfo')) { $finfo = new \finfo(FILEINFO_MIME); $type = $finfo->file($file); } else { $type = MimeType::getTypeByExt(pathinfo($file, PATHINFO_EXTENSION)); } } $type = strstr($type, ';', true) ?: $type; return isset(MimeType::$internalType[$type]) ? MimeType::$internalType[$type] : $type; }
php
private function getMimeType($file) { $type = FileInfo::DIRECTORY_MIME_TYPE; if (is_file($file)) { if (class_exists('finfo')) { $finfo = new \finfo(FILEINFO_MIME); $type = $finfo->file($file); } else { $type = MimeType::getTypeByExt(pathinfo($file, PATHINFO_EXTENSION)); } } $type = strstr($type, ';', true) ?: $type; return isset(MimeType::$internalType[$type]) ? MimeType::$internalType[$type] : $type; }
[ "private", "function", "getMimeType", "(", "$", "file", ")", "{", "$", "type", "=", "FileInfo", "::", "DIRECTORY_MIME_TYPE", ";", "if", "(", "is_file", "(", "$", "file", ")", ")", "{", "if", "(", "class_exists", "(", "'finfo'", ")", ")", "{", "$", "finfo", "=", "new", "\\", "finfo", "(", "FILEINFO_MIME", ")", ";", "$", "type", "=", "$", "finfo", "->", "file", "(", "$", "file", ")", ";", "}", "else", "{", "$", "type", "=", "MimeType", "::", "getTypeByExt", "(", "pathinfo", "(", "$", "file", ",", "PATHINFO_EXTENSION", ")", ")", ";", "}", "}", "$", "type", "=", "strstr", "(", "$", "type", ",", "';'", ",", "true", ")", "?", ":", "$", "type", ";", "return", "isset", "(", "MimeType", "::", "$", "internalType", "[", "$", "type", "]", ")", "?", "MimeType", "::", "$", "internalType", "[", "$", "type", "]", ":", "$", "type", ";", "}" ]
get Mime Type by File. @param string $file @return string
[ "get", "Mime", "Type", "by", "File", "." ]
510e295dcafeaa0f796986ad87b3ed5f6b0d9338
https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L555-L569
17,697
4devs/ElfinderPhpConnector
Driver/LocalDriver.php
LocalDriver.scanDir
private function scanDir($dir, $onlyDir = 0) { $files = array(); foreach (glob($dir.'/*', $onlyDir) as $name) { if ($this->isShowFile($name, $this->driverOptions['showHidden'])) { $file = $this->getFileInfo($name); $this->setDirs($file, $name); $files[] = $file; } } return $files; }
php
private function scanDir($dir, $onlyDir = 0) { $files = array(); foreach (glob($dir.'/*', $onlyDir) as $name) { if ($this->isShowFile($name, $this->driverOptions['showHidden'])) { $file = $this->getFileInfo($name); $this->setDirs($file, $name); $files[] = $file; } } return $files; }
[ "private", "function", "scanDir", "(", "$", "dir", ",", "$", "onlyDir", "=", "0", ")", "{", "$", "files", "=", "array", "(", ")", ";", "foreach", "(", "glob", "(", "$", "dir", ".", "'/*'", ",", "$", "onlyDir", ")", "as", "$", "name", ")", "{", "if", "(", "$", "this", "->", "isShowFile", "(", "$", "name", ",", "$", "this", "->", "driverOptions", "[", "'showHidden'", "]", ")", ")", "{", "$", "file", "=", "$", "this", "->", "getFileInfo", "(", "$", "name", ")", ";", "$", "this", "->", "setDirs", "(", "$", "file", ",", "$", "name", ")", ";", "$", "files", "[", "]", "=", "$", "file", ";", "}", "}", "return", "$", "files", ";", "}" ]
get Files by dir name. @param string $dir @param int $onlyDir @return FileInfo[]
[ "get", "Files", "by", "dir", "name", "." ]
510e295dcafeaa0f796986ad87b3ed5f6b0d9338
https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L579-L591
17,698
SAREhub/PHP_Commons
src/SAREhub/Commons/Misc/PeriodicTimer.php
PeriodicTimer.update
public function update($now) { if ($now >= ($this->lastCallTime + $this->interval)) { $this->lastCallTime = $now; $this->callNow(); } }
php
public function update($now) { if ($now >= ($this->lastCallTime + $this->interval)) { $this->lastCallTime = $now; $this->callNow(); } }
[ "public", "function", "update", "(", "$", "now", ")", "{", "if", "(", "$", "now", ">=", "(", "$", "this", "->", "lastCallTime", "+", "$", "this", "->", "interval", ")", ")", "{", "$", "this", "->", "lastCallTime", "=", "$", "now", ";", "$", "this", "->", "callNow", "(", ")", ";", "}", "}" ]
Updates that timer if is after next call its calls callback. @param int $now
[ "Updates", "that", "timer", "if", "is", "after", "next", "call", "its", "calls", "callback", "." ]
4e1769ab6411a584112df1151dcc90e6b82fe2bb
https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Misc/PeriodicTimer.php#L52-L58
17,699
digitalkaoz/versioneye-php
src/Api/Products.php
Products.search
public function search($query, $language = null, $group = null) { $url = sprintf('products/search/%s?%s', $query, http_build_query([ 'lang' => $language, 'g' => $group, 'page' => 1, ])); return $this->request($url); }
php
public function search($query, $language = null, $group = null) { $url = sprintf('products/search/%s?%s', $query, http_build_query([ 'lang' => $language, 'g' => $group, 'page' => 1, ])); return $this->request($url); }
[ "public", "function", "search", "(", "$", "query", ",", "$", "language", "=", "null", ",", "$", "group", "=", "null", ")", "{", "$", "url", "=", "sprintf", "(", "'products/search/%s?%s'", ",", "$", "query", ",", "http_build_query", "(", "[", "'lang'", "=>", "$", "language", ",", "'g'", "=>", "$", "group", ",", "'page'", "=>", "1", ",", "]", ")", ")", ";", "return", "$", "this", "->", "request", "(", "$", "url", ")", ";", "}" ]
search packages. @param string $query @param string $language @param string $group @return array
[ "search", "packages", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L23-L32