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
partition
stringclasses
1 value
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Repositories/FiscalYear/EloquentFiscalYear.php
EloquentFiscalYear.byYearAndByOrganization
public function byYearAndByOrganization($year, $organiztionId) { return $this->FiscalYear->where('year', '=', $year)->where('organization_id', '=', $organiztionId)->get()->first(); }
php
public function byYearAndByOrganization($year, $organiztionId) { return $this->FiscalYear->where('year', '=', $year)->where('organization_id', '=', $organiztionId)->get()->first(); }
[ "public", "function", "byYearAndByOrganization", "(", "$", "year", ",", "$", "organiztionId", ")", "{", "return", "$", "this", "->", "FiscalYear", "->", "where", "(", "'year'", ",", "'='", ",", "$", "year", ")", "->", "where", "(", "'organization_id'", ","...
Retrieve fiscal year by year and by organization @param int $id Organization id @return Mgallegos\DecimaAccounting\FiscalYear
[ "Retrieve", "fiscal", "year", "by", "year", "and", "by", "organization" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Repositories/FiscalYear/EloquentFiscalYear.php#L82-L85
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Repositories/FiscalYear/EloquentFiscalYear.php
EloquentFiscalYear.update
public function update(array $data, $FiscalYear = null) { if(empty($FiscalYear)) { $FiscalYear = $this->byId($data['id']); } foreach ($data as $key => $value) { $FiscalYear->$key = $value; } return $FiscalYear->save(); }
php
public function update(array $data, $FiscalYear = null) { if(empty($FiscalYear)) { $FiscalYear = $this->byId($data['id']); } foreach ($data as $key => $value) { $FiscalYear->$key = $value; } return $FiscalYear->save(); }
[ "public", "function", "update", "(", "array", "$", "data", ",", "$", "FiscalYear", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "FiscalYear", ")", ")", "{", "$", "FiscalYear", "=", "$", "this", "->", "byId", "(", "$", "data", "[", "'id'", ...
Update an existing fiscal year @param array $data An array as follows: array('year'=>$year, 'start_date'=>$startDate, 'end_date'=>$endDate, 'is_closed'=>$isClosed, 'organization_id'=>$organizationId ); @param Mgallegos\DecimaAccounting\FiscalYear $FiscalYear @return boolean
[ "Update", "an", "existing", "fiscal", "year" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Repositories/FiscalYear/EloquentFiscalYear.php#L128-L141
train
vube/php-filesystem
src/Vube/FileSystem/FileDiffer.php
FileDiffer.isDiff
public function isDiff($first, $second) { if(! file_exists($first)) throw new NoSuchFileException($first); $second = $this->oFileNameResolver->resolve($first, $second); // If the second file doesn't exist, they're definitely different if(! file_exists($second)) return true; // If the file sizes are different, definitely the file contents are different if(filesize($first) !== filesize($second)) return true; // File sizes are the same, open the files and look for differences if(! ($fh1 = fopen($first, 'rb'))) throw new FileOpenException($first); if(! ($fh2 = fopen($second, 'rb'))) throw new FileOpenException($second); while(! feof($fh1) && ! feof($fh2)) { $data1 = fread($fh1, static::READ_SIZE); if(false === $data1) throw new FileReadException($first); $data2 = fread($fh2, static::READ_SIZE); if(false === $data2) throw new FileReadException($second); if($data1 !== $data2) return true; } return false; }
php
public function isDiff($first, $second) { if(! file_exists($first)) throw new NoSuchFileException($first); $second = $this->oFileNameResolver->resolve($first, $second); // If the second file doesn't exist, they're definitely different if(! file_exists($second)) return true; // If the file sizes are different, definitely the file contents are different if(filesize($first) !== filesize($second)) return true; // File sizes are the same, open the files and look for differences if(! ($fh1 = fopen($first, 'rb'))) throw new FileOpenException($first); if(! ($fh2 = fopen($second, 'rb'))) throw new FileOpenException($second); while(! feof($fh1) && ! feof($fh2)) { $data1 = fread($fh1, static::READ_SIZE); if(false === $data1) throw new FileReadException($first); $data2 = fread($fh2, static::READ_SIZE); if(false === $data2) throw new FileReadException($second); if($data1 !== $data2) return true; } return false; }
[ "public", "function", "isDiff", "(", "$", "first", ",", "$", "second", ")", "{", "if", "(", "!", "file_exists", "(", "$", "first", ")", ")", "throw", "new", "NoSuchFileException", "(", "$", "first", ")", ";", "$", "second", "=", "$", "this", "->", ...
Are these two files different? @param string $first First file to compare; this file MUST exist. @param string $second Second file or directory to compare. <p> If a directory, the basename($first) filename is compared in the $second directory, and the directory MUST exist. </p> <p> If the $second file does not exist, it is considered to be different. </p> @return bool FALSE if both files exist and are identical in contents, else TRUE. @throws NoSuchFileException If $first does not exist @throws FileOpenException If either file cannot be opened @throws FileReadException If either file cannot be fully read
[ "Are", "these", "two", "files", "different?" ]
147513e8c3809a1d9d947d2753780c0671cc3194
https://github.com/vube/php-filesystem/blob/147513e8c3809a1d9d947d2753780c0671cc3194/src/Vube/FileSystem/FileDiffer.php#L64-L102
train
anklimsk/cakephp-theme
Controller/Component/MoveComponent.php
MoveComponent.moveItem
public function moveItem($direct = null, $id = null, $delta = 1) { $isJson = $this->_controller->RequestHandler->prefers('json'); if ($isJson) { Configure::write('debug', 0); } $result = $this->_model->moveItem($direct, $id, $delta); if (!$isJson) { if (!$result) { $this->_controller->Flash->error(__d('view_extension', 'Error move record %d %s', $id, __d('view_extension_direct', $direct))); } return $this->_controller->redirect($this->_controller->request->referer(true)); } else { $data = compact('result', 'direct', 'delta'); $this->_controller->set(compact('data')); $this->_controller->set('_serialize', 'data'); } }
php
public function moveItem($direct = null, $id = null, $delta = 1) { $isJson = $this->_controller->RequestHandler->prefers('json'); if ($isJson) { Configure::write('debug', 0); } $result = $this->_model->moveItem($direct, $id, $delta); if (!$isJson) { if (!$result) { $this->_controller->Flash->error(__d('view_extension', 'Error move record %d %s', $id, __d('view_extension_direct', $direct))); } return $this->_controller->redirect($this->_controller->request->referer(true)); } else { $data = compact('result', 'direct', 'delta'); $this->_controller->set(compact('data')); $this->_controller->set('_serialize', 'data'); } }
[ "public", "function", "moveItem", "(", "$", "direct", "=", "null", ",", "$", "id", "=", "null", ",", "$", "delta", "=", "1", ")", "{", "$", "isJson", "=", "$", "this", "->", "_controller", "->", "RequestHandler", "->", "prefers", "(", "'json'", ")", ...
Action `moveItem`. Used to move item to new position. @param string $direct Direction for moving: `up`, `down`, `top`, `bottom` @param int $id ID of record for moving @param int $delta Delta for moving @return void
[ "Action", "moveItem", ".", "Used", "to", "move", "item", "to", "new", "position", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/MoveComponent.php#L93-L110
train
anklimsk/cakephp-theme
Controller/Component/MoveComponent.php
MoveComponent.dropItem
public function dropItem() { Configure::write('debug', 0); if (!$this->_controller->request->is('ajax') || !$this->_controller->request->is('post') || !$this->_controller->RequestHandler->prefers('json')) { throw new BadRequestException(); } $id = $this->_controller->request->data('target'); $newParentId = $this->_controller->request->data('parent'); $oldParentId = $this->_controller->request->data('parentStart'); $dropData = $this->_controller->request->data('tree'); $dropData = json_decode($dropData, true); $result = $this->_model->moveDrop($id, $newParentId, $oldParentId, $dropData); $data = compact('result'); $this->_controller->set(compact('data')); $this->_controller->set('_serialize', 'data'); }
php
public function dropItem() { Configure::write('debug', 0); if (!$this->_controller->request->is('ajax') || !$this->_controller->request->is('post') || !$this->_controller->RequestHandler->prefers('json')) { throw new BadRequestException(); } $id = $this->_controller->request->data('target'); $newParentId = $this->_controller->request->data('parent'); $oldParentId = $this->_controller->request->data('parentStart'); $dropData = $this->_controller->request->data('tree'); $dropData = json_decode($dropData, true); $result = $this->_model->moveDrop($id, $newParentId, $oldParentId, $dropData); $data = compact('result'); $this->_controller->set(compact('data')); $this->_controller->set('_serialize', 'data'); }
[ "public", "function", "dropItem", "(", ")", "{", "Configure", "::", "write", "(", "'debug'", ",", "0", ")", ";", "if", "(", "!", "$", "this", "->", "_controller", "->", "request", "->", "is", "(", "'ajax'", ")", "||", "!", "$", "this", "->", "_cont...
Action `dropItem`. Used to drag and drop item. POST Data: - `target` The ID of the item to moving to new position; - `parent` New parent ID of item; - `parentStart` Old parent ID of item; - `tree` Array of ID subtree for item. @throws BadRequestException if request is not AJAX, POST or JSON. @return void
[ "Action", "dropItem", ".", "Used", "to", "drag", "and", "drop", "item", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/MoveComponent.php#L124-L140
train
rokka-io/rokka-client-php-cli
src/RokkaApiHelper.php
RokkaApiHelper.organizationExists
public function organizationExists(User $client, $organizationName) { try { $org = $client->getOrganization($organizationName); return $org->getName() == $organizationName; } catch (ClientException $e) { if (404 === $e->getCode()) { return false; } throw $e; } }
php
public function organizationExists(User $client, $organizationName) { try { $org = $client->getOrganization($organizationName); return $org->getName() == $organizationName; } catch (ClientException $e) { if (404 === $e->getCode()) { return false; } throw $e; } }
[ "public", "function", "organizationExists", "(", "User", "$", "client", ",", "$", "organizationName", ")", "{", "try", "{", "$", "org", "=", "$", "client", "->", "getOrganization", "(", "$", "organizationName", ")", ";", "return", "$", "org", "->", "getNam...
Checks if the specified organization is visible to the current user. @param User $client @param string $organizationName @return bool
[ "Checks", "if", "the", "specified", "organization", "is", "visible", "to", "the", "current", "user", "." ]
ef22af122af65579a8607a0df976a9ce5248dbbb
https://github.com/rokka-io/rokka-client-php-cli/blob/ef22af122af65579a8607a0df976a9ce5248dbbb/src/RokkaApiHelper.php#L55-L68
train
rokka-io/rokka-client-php-cli
src/RokkaApiHelper.php
RokkaApiHelper.stackExists
public function stackExists(Image $client, $stackName, $organizationName = '') { try { $stack = $client->getStack($stackName, $organizationName); return $stack->getName() == $stackName; } catch (ClientException $e) { if (404 === $e->getCode()) { return false; } throw $e; } }
php
public function stackExists(Image $client, $stackName, $organizationName = '') { try { $stack = $client->getStack($stackName, $organizationName); return $stack->getName() == $stackName; } catch (ClientException $e) { if (404 === $e->getCode()) { return false; } throw $e; } }
[ "public", "function", "stackExists", "(", "Image", "$", "client", ",", "$", "stackName", ",", "$", "organizationName", "=", "''", ")", "{", "try", "{", "$", "stack", "=", "$", "client", "->", "getStack", "(", "$", "stackName", ",", "$", "organizationName...
Checks if the specified stack exists in the organization. @param $stackName @param $organizationName @param Image $client @return bool
[ "Checks", "if", "the", "specified", "stack", "exists", "in", "the", "organization", "." ]
ef22af122af65579a8607a0df976a9ce5248dbbb
https://github.com/rokka-io/rokka-client-php-cli/blob/ef22af122af65579a8607a0df976a9ce5248dbbb/src/RokkaApiHelper.php#L79-L92
train
rokka-io/rokka-client-php-cli
src/RokkaApiHelper.php
RokkaApiHelper.imageExists
public function imageExists(Image $client, $hash, $organizationName = '') { try { $sourceImage = $client->getSourceImage($hash, $organizationName); return $sourceImage instanceof SourceImage && $sourceImage->hash === $hash; } catch (ClientException $e) { if (404 === $e->getCode()) { return false; } throw $e; } }
php
public function imageExists(Image $client, $hash, $organizationName = '') { try { $sourceImage = $client->getSourceImage($hash, $organizationName); return $sourceImage instanceof SourceImage && $sourceImage->hash === $hash; } catch (ClientException $e) { if (404 === $e->getCode()) { return false; } throw $e; } }
[ "public", "function", "imageExists", "(", "Image", "$", "client", ",", "$", "hash", ",", "$", "organizationName", "=", "''", ")", "{", "try", "{", "$", "sourceImage", "=", "$", "client", "->", "getSourceImage", "(", "$", "hash", ",", "$", "organizationNa...
Checks if the specified image exists in the organization. @param Image $client @param string $hash @param string $organizationName @return bool
[ "Checks", "if", "the", "specified", "image", "exists", "in", "the", "organization", "." ]
ef22af122af65579a8607a0df976a9ce5248dbbb
https://github.com/rokka-io/rokka-client-php-cli/blob/ef22af122af65579a8607a0df976a9ce5248dbbb/src/RokkaApiHelper.php#L115-L128
train
rokka-io/rokka-client-php-cli
src/RokkaApiHelper.php
RokkaApiHelper.getSourceImageContents
public function getSourceImageContents(Image $client, $hash, $organizationName, $stackName = null, $format = 'jpg') { if (!$stackName) { return $client->getSourceImageContents($hash, $organizationName); } $uri = $client->getSourceImageUri($hash, $stackName, $format, null, $organizationName); $resp = (new Client())->get($uri); return $resp->getBody()->getContents(); }
php
public function getSourceImageContents(Image $client, $hash, $organizationName, $stackName = null, $format = 'jpg') { if (!$stackName) { return $client->getSourceImageContents($hash, $organizationName); } $uri = $client->getSourceImageUri($hash, $stackName, $format, null, $organizationName); $resp = (new Client())->get($uri); return $resp->getBody()->getContents(); }
[ "public", "function", "getSourceImageContents", "(", "Image", "$", "client", ",", "$", "hash", ",", "$", "organizationName", ",", "$", "stackName", "=", "null", ",", "$", "format", "=", "'jpg'", ")", "{", "if", "(", "!", "$", "stackName", ")", "{", "re...
Download an image. @param Image $client @param string $hash @param string $organizationName @param string $stackName Optional, if not specified the unmodified source is downloaded @param string $format Defaults to jpg @return string The binary data for the image
[ "Download", "an", "image", "." ]
ef22af122af65579a8607a0df976a9ce5248dbbb
https://github.com/rokka-io/rokka-client-php-cli/blob/ef22af122af65579a8607a0df976a9ce5248dbbb/src/RokkaApiHelper.php#L141-L150
train
BenGorUser/UserBundle
src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/ChangeUserPasswordCommandBuilder.php
ChangeUserPasswordCommandBuilder.handlerArguments
protected function handlerArguments($user) { return [ $this->container->getDefinition( 'bengor.user.infrastructure.persistence.' . $user . '_repository' ), $this->container->getDefinition( 'bengor.user.infrastructure.security.symfony.' . $user . '_password_encoder' ), ]; }
php
protected function handlerArguments($user) { return [ $this->container->getDefinition( 'bengor.user.infrastructure.persistence.' . $user . '_repository' ), $this->container->getDefinition( 'bengor.user.infrastructure.security.symfony.' . $user . '_password_encoder' ), ]; }
[ "protected", "function", "handlerArguments", "(", "$", "user", ")", "{", "return", "[", "$", "this", "->", "container", "->", "getDefinition", "(", "'bengor.user.infrastructure.persistence.'", ".", "$", "user", ".", "'_repository'", ")", ",", "$", "this", "->", ...
Gets the handler arguments to inject in the constructor. @param string $user The user name @return array
[ "Gets", "the", "handler", "arguments", "to", "inject", "in", "the", "constructor", "." ]
a6d0173496c269a6c80e1319d42eaed4b3bbbd4a
https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/ChangeUserPasswordCommandBuilder.php#L102-L112
train
BenGorUser/UserBundle
src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/ChangeUserPasswordCommandBuilder.php
ChangeUserPasswordCommandBuilder.byRequestRememberPasswordSpecification
private function byRequestRememberPasswordSpecification($user) { (new RequestRememberPasswordCommandBuilder($this->container, $this->persistence))->build($user); return [ 'command' => ByRequestRememberPasswordChangeUserPasswordCommand::class, 'handler' => ByRequestRememberPasswordChangeUserPasswordHandler::class, ]; }
php
private function byRequestRememberPasswordSpecification($user) { (new RequestRememberPasswordCommandBuilder($this->container, $this->persistence))->build($user); return [ 'command' => ByRequestRememberPasswordChangeUserPasswordCommand::class, 'handler' => ByRequestRememberPasswordChangeUserPasswordHandler::class, ]; }
[ "private", "function", "byRequestRememberPasswordSpecification", "(", "$", "user", ")", "{", "(", "new", "RequestRememberPasswordCommandBuilder", "(", "$", "this", "->", "container", ",", "$", "this", "->", "persistence", ")", ")", "->", "build", "(", "$", "user...
Gets the "by request remember password" specification. @param string $user The user name @return array
[ "Gets", "the", "by", "request", "remember", "password", "specification", "." ]
a6d0173496c269a6c80e1319d42eaed4b3bbbd4a
https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/ChangeUserPasswordCommandBuilder.php#L136-L144
train
hostnet/form-handler-component
src/FormHandler/HandlerTypeAdapter.php
HandlerTypeAdapter.syncData
public function syncData($controller_data) { if (is_object($controller_data)) { $handler_data = $this->legacy_handler->getData(); $refl_class = new \ReflectionClass(get_class($handler_data)); $filter = \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED | \ReflectionProperty::IS_PRIVATE; foreach ($refl_class->getProperties($filter) as $property) { $property->setAccessible(true); $property->setValue($handler_data, $property->getValue($controller_data)); $property->setAccessible(false); } } return $this->legacy_handler->getData(); }
php
public function syncData($controller_data) { if (is_object($controller_data)) { $handler_data = $this->legacy_handler->getData(); $refl_class = new \ReflectionClass(get_class($handler_data)); $filter = \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED | \ReflectionProperty::IS_PRIVATE; foreach ($refl_class->getProperties($filter) as $property) { $property->setAccessible(true); $property->setValue($handler_data, $property->getValue($controller_data)); $property->setAccessible(false); } } return $this->legacy_handler->getData(); }
[ "public", "function", "syncData", "(", "$", "controller_data", ")", "{", "if", "(", "is_object", "(", "$", "controller_data", ")", ")", "{", "$", "handler_data", "=", "$", "this", "->", "legacy_handler", "->", "getData", "(", ")", ";", "$", "refl_class", ...
Sync the data from the controller data to the handler data. @param mixed $controller_data @return mixed
[ "Sync", "the", "data", "from", "the", "controller", "data", "to", "the", "handler", "data", "." ]
87cbc8444ec20a0c66bc8e05e79a102fb7cf4b0d
https://github.com/hostnet/form-handler-component/blob/87cbc8444ec20a0c66bc8e05e79a102fb7cf4b0d/src/FormHandler/HandlerTypeAdapter.php#L60-L78
train
laravie/predis-async
src/Connection/AbstractConnection.php
AbstractConnection.getProcessCallback
protected function getProcessCallback() { return function ($state, $response) { list($command, $callback) = $this->commands->dequeue(); switch ($command->getId()) { case 'SUBSCRIBE': case 'PSUBSCRIBE': $wrapper = $this->getStreamingWrapperCreator(); $callback = $wrapper($this, $callback); $state->setStreamingContext(State::PUBSUB, $callback); break; case 'MONITOR': $wrapper = $this->getStreamingWrapperCreator(); $callback = $wrapper($this, $callback); $state->setStreamingContext(State::MONITOR, $callback); break; case 'MULTI': $state->setState(State::MULTIEXEC); goto process; case 'EXEC': case 'DISCARD': $state->setState(State::CONNECTED); goto process; default: process: \call_user_func($callback, $response, $this, $command); break; } }; }
php
protected function getProcessCallback() { return function ($state, $response) { list($command, $callback) = $this->commands->dequeue(); switch ($command->getId()) { case 'SUBSCRIBE': case 'PSUBSCRIBE': $wrapper = $this->getStreamingWrapperCreator(); $callback = $wrapper($this, $callback); $state->setStreamingContext(State::PUBSUB, $callback); break; case 'MONITOR': $wrapper = $this->getStreamingWrapperCreator(); $callback = $wrapper($this, $callback); $state->setStreamingContext(State::MONITOR, $callback); break; case 'MULTI': $state->setState(State::MULTIEXEC); goto process; case 'EXEC': case 'DISCARD': $state->setState(State::CONNECTED); goto process; default: process: \call_user_func($callback, $response, $this, $command); break; } }; }
[ "protected", "function", "getProcessCallback", "(", ")", "{", "return", "function", "(", "$", "state", ",", "$", "response", ")", "{", "list", "(", "$", "command", ",", "$", "callback", ")", "=", "$", "this", "->", "commands", "->", "dequeue", "(", ")"...
Returns the callback used to handle commands and firing the appropriate callbacks depending on the state of the connection. @return mixed
[ "Returns", "the", "callback", "used", "to", "handle", "commands", "and", "firing", "the", "appropriate", "callbacks", "depending", "on", "the", "state", "of", "the", "connection", "." ]
dd98b10e752b1ed339c9c6e798b33c8810ecda2a
https://github.com/laravie/predis-async/blob/dd98b10e752b1ed339c9c6e798b33c8810ecda2a/src/Connection/AbstractConnection.php#L73-L107
train
laravie/predis-async
src/Connection/AbstractConnection.php
AbstractConnection.getStreamingWrapperCreator
protected function getStreamingWrapperCreator() { return function ($connection, $callback) { return function ($state, $response) use ($connection, $callback) { \call_user_func($callback, $response, $connection, null); }; }; }
php
protected function getStreamingWrapperCreator() { return function ($connection, $callback) { return function ($state, $response) use ($connection, $callback) { \call_user_func($callback, $response, $connection, null); }; }; }
[ "protected", "function", "getStreamingWrapperCreator", "(", ")", "{", "return", "function", "(", "$", "connection", ",", "$", "callback", ")", "{", "return", "function", "(", "$", "state", ",", "$", "response", ")", "use", "(", "$", "connection", ",", "$",...
Returns a wrapper to the user-provided callback used to handle response chunks streamed by replies to commands such as MONITOR, SUBSCRIBE, etc. @return mixed
[ "Returns", "a", "wrapper", "to", "the", "user", "-", "provided", "callback", "used", "to", "handle", "response", "chunks", "streamed", "by", "replies", "to", "commands", "such", "as", "MONITOR", "SUBSCRIBE", "etc", "." ]
dd98b10e752b1ed339c9c6e798b33c8810ecda2a
https://github.com/laravie/predis-async/blob/dd98b10e752b1ed339c9c6e798b33c8810ecda2a/src/Connection/AbstractConnection.php#L115-L122
train
laravie/predis-async
src/Connection/AbstractConnection.php
AbstractConnection.createResource
protected function createResource(callable $callback) { $parameters = $this->parameters; $flags = STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT; if ($parameters->scheme === 'unix') { $uri = "unix://$parameters->path"; } else { $uri = "$parameters->scheme://$parameters->host:$parameters->port"; } if (!$stream = @stream_socket_client($uri, $errno, $errstr, 0, $flags)) { $this->onError(new ConnectionException($this, \trim($errstr), $errno)); return; } \stream_set_blocking($stream, 0); $this->state->setState(State::CONNECTING); $this->loop->addWriteStream($stream, function ($stream) use ($callback) { if ($this->onConnect()) { \call_user_func($callback, $this); $this->write(); } }); $this->timeout = $this->armTimeoutMonitor( $parameters->timeout ?: 5, $this->errorCallback ?: function () { } ); return $stream; }
php
protected function createResource(callable $callback) { $parameters = $this->parameters; $flags = STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT; if ($parameters->scheme === 'unix') { $uri = "unix://$parameters->path"; } else { $uri = "$parameters->scheme://$parameters->host:$parameters->port"; } if (!$stream = @stream_socket_client($uri, $errno, $errstr, 0, $flags)) { $this->onError(new ConnectionException($this, \trim($errstr), $errno)); return; } \stream_set_blocking($stream, 0); $this->state->setState(State::CONNECTING); $this->loop->addWriteStream($stream, function ($stream) use ($callback) { if ($this->onConnect()) { \call_user_func($callback, $this); $this->write(); } }); $this->timeout = $this->armTimeoutMonitor( $parameters->timeout ?: 5, $this->errorCallback ?: function () { } ); return $stream; }
[ "protected", "function", "createResource", "(", "callable", "$", "callback", ")", "{", "$", "parameters", "=", "$", "this", "->", "parameters", ";", "$", "flags", "=", "STREAM_CLIENT_CONNECT", "|", "STREAM_CLIENT_ASYNC_CONNECT", ";", "if", "(", "$", "parameters"...
Creates the underlying resource used to communicate with Redis. @return mixed
[ "Creates", "the", "underlying", "resource", "used", "to", "communicate", "with", "Redis", "." ]
dd98b10e752b1ed339c9c6e798b33c8810ecda2a
https://github.com/laravie/predis-async/blob/dd98b10e752b1ed339c9c6e798b33c8810ecda2a/src/Connection/AbstractConnection.php#L129-L162
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Helpers/ChatNotification.php
ChatNotification.sendMessage
public function sendMessage($messageId, $to = null, $parameters = []) { $message = $messageId; if (is_string($to)) { $player = $this->playerStorage->getPlayerInfo($to); $message = $this->translations->getTranslation($messageId, $parameters, strtolower($player->getLanguage())); } if (is_array($to)) { $to = implode(",", $to); $message = $this->translations->getTranslations($messageId, $parameters); } if ($to instanceof Group) { $to = implode(",", $to->getLogins()); $message = $this->translations->getTranslations($messageId, $parameters); } if ($to === null || $to instanceof Group) { $message = $this->translations->getTranslations($messageId, $parameters); $this->console->writeln(end($message)['Text']); } try { $this->factory->getConnection()->chatSendServerMessage($message, $to); } catch (UnknownPlayerException $e) { $this->logger->info("can't send chat message: $message", ["to" => $to, "exception" => $e]); // Nothing to do, it happens. } catch (InvalidArgumentException $ex) { // Nothing to do } }
php
public function sendMessage($messageId, $to = null, $parameters = []) { $message = $messageId; if (is_string($to)) { $player = $this->playerStorage->getPlayerInfo($to); $message = $this->translations->getTranslation($messageId, $parameters, strtolower($player->getLanguage())); } if (is_array($to)) { $to = implode(",", $to); $message = $this->translations->getTranslations($messageId, $parameters); } if ($to instanceof Group) { $to = implode(",", $to->getLogins()); $message = $this->translations->getTranslations($messageId, $parameters); } if ($to === null || $to instanceof Group) { $message = $this->translations->getTranslations($messageId, $parameters); $this->console->writeln(end($message)['Text']); } try { $this->factory->getConnection()->chatSendServerMessage($message, $to); } catch (UnknownPlayerException $e) { $this->logger->info("can't send chat message: $message", ["to" => $to, "exception" => $e]); // Nothing to do, it happens. } catch (InvalidArgumentException $ex) { // Nothing to do } }
[ "public", "function", "sendMessage", "(", "$", "messageId", ",", "$", "to", "=", "null", ",", "$", "parameters", "=", "[", "]", ")", "{", "$", "message", "=", "$", "messageId", ";", "if", "(", "is_string", "(", "$", "to", ")", ")", "{", "$", "pla...
Send message. @param string $messageId @param string|string[]|Group|null $to @param string[] $parameters
[ "Send", "message", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/ChatNotification.php#L69-L101
train
narrowspark/mimetypes
src/MimeTypeFileInfoGuesser.php
MimeTypeFileInfoGuesser.guess
public static function guess(string $filename): ?string { if (! \is_file($filename)) { throw new FileNotFoundException($filename); } if (! \is_readable($filename)) { throw new AccessDeniedException($filename); } if (self::$magicFile !== null) { $finfo = \finfo_open(\FILEINFO_MIME_TYPE, self::$magicFile); } else { $finfo = \finfo_open(\FILEINFO_MIME_TYPE); } $type = \finfo_file($finfo, $filename); \finfo_close($finfo); return $type ?? null; }
php
public static function guess(string $filename): ?string { if (! \is_file($filename)) { throw new FileNotFoundException($filename); } if (! \is_readable($filename)) { throw new AccessDeniedException($filename); } if (self::$magicFile !== null) { $finfo = \finfo_open(\FILEINFO_MIME_TYPE, self::$magicFile); } else { $finfo = \finfo_open(\FILEINFO_MIME_TYPE); } $type = \finfo_file($finfo, $filename); \finfo_close($finfo); return $type ?? null; }
[ "public", "static", "function", "guess", "(", "string", "$", "filename", ")", ":", "?", "string", "{", "if", "(", "!", "\\", "is_file", "(", "$", "filename", ")", ")", "{", "throw", "new", "FileNotFoundException", "(", "$", "filename", ")", ";", "}", ...
Guesses the mime type using the PECL extension FileInfo. @param string $filename The path to the file @throws \Narrowspark\MimeType\Exception\FileNotFoundException If the file does not exist @throws \Narrowspark\MimeType\Exception\AccessDeniedException If the file could not be read @return null|string @see http://www.php.net/manual/en/function.finfo-open.php
[ "Guesses", "the", "mime", "type", "using", "the", "PECL", "extension", "FileInfo", "." ]
3ce9277e7e93edb04b269bc3e37181e2e51ce0ac
https://github.com/narrowspark/mimetypes/blob/3ce9277e7e93edb04b269bc3e37181e2e51ce0ac/src/MimeTypeFileInfoGuesser.php#L57-L78
train
ansas/php-component
src/Slim/Handler/CookieHandler.php
CookieHandler.remove
public function remove($name) { $name = $this->getFullName($name); // Delete existing response cookie if (isset($this->responseCookies[$name])) { unset($this->responseCookies[$name]); } // Set response cookie if request cookie was set if (null !== $this->get($name)) { // Note: timestamp '1' = '1970-01-01 00:00:00 UTC' $this->set($name, 'deleted', '1'); } return $this; }
php
public function remove($name) { $name = $this->getFullName($name); // Delete existing response cookie if (isset($this->responseCookies[$name])) { unset($this->responseCookies[$name]); } // Set response cookie if request cookie was set if (null !== $this->get($name)) { // Note: timestamp '1' = '1970-01-01 00:00:00 UTC' $this->set($name, 'deleted', '1'); } return $this; }
[ "public", "function", "remove", "(", "$", "name", ")", "{", "$", "name", "=", "$", "this", "->", "getFullName", "(", "$", "name", ")", ";", "// Delete existing response cookie", "if", "(", "isset", "(", "$", "this", "->", "responseCookies", "[", "$", "na...
Remove response cookie. @param string $name Cookie name @return $this
[ "Remove", "response", "cookie", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Slim/Handler/CookieHandler.php#L104-L120
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Helpers/Data/ArrayFilter.php
ArrayFilter.checkValue
protected function checkValue($value, $condition) { list($filterType, $valueToCheck) = $condition; switch ($filterType) { case self::FILTER_TYPE_EQ: return $valueToCheck == $value; case self::FILTER_TYPE_NEQ: return $valueToCheck != $value; case self::FILTER_TYPE_LIKE: return strpos($value, $valueToCheck) !== false; default : throw new InvalidFilterTypeException("Filter type '$filterType' is unknown'"); } }
php
protected function checkValue($value, $condition) { list($filterType, $valueToCheck) = $condition; switch ($filterType) { case self::FILTER_TYPE_EQ: return $valueToCheck == $value; case self::FILTER_TYPE_NEQ: return $valueToCheck != $value; case self::FILTER_TYPE_LIKE: return strpos($value, $valueToCheck) !== false; default : throw new InvalidFilterTypeException("Filter type '$filterType' is unknown'"); } }
[ "protected", "function", "checkValue", "(", "$", "value", ",", "$", "condition", ")", "{", "list", "(", "$", "filterType", ",", "$", "valueToCheck", ")", "=", "$", "condition", ";", "switch", "(", "$", "filterType", ")", "{", "case", "self", "::", "FIL...
Check if value respects condition. @param string $value @param $condition @return boolean|null @throws InvalidFilterTypeException
[ "Check", "if", "value", "respects", "condition", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Data/ArrayFilter.php#L61-L77
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Helpers/Countries.php
Countries.getCodeFromCountry
public function getCodeFromCountry($country) { $output = 'OTH'; if (array_key_exists($country, $this->countriesMapping)) { $output = $this->countriesMapping[$country]; } return $output; }
php
public function getCodeFromCountry($country) { $output = 'OTH'; if (array_key_exists($country, $this->countriesMapping)) { $output = $this->countriesMapping[$country]; } return $output; }
[ "public", "function", "getCodeFromCountry", "(", "$", "country", ")", "{", "$", "output", "=", "'OTH'", ";", "if", "(", "array_key_exists", "(", "$", "country", ",", "$", "this", "->", "countriesMapping", ")", ")", "{", "$", "output", "=", "$", "this", ...
Get 3-letter country code from full country name @param $country @return mixed|string
[ "Get", "3", "-", "letter", "country", "code", "from", "full", "country", "name" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Countries.php#L62-L70
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Helpers/Countries.php
Countries.getCountryFromCode
public function getCountryFromCode($code) { $code = strtoupper($code); $output = "Other"; if (in_array($code, $this->countriesMapping)) { foreach ($this->countriesMapping as $country => $short) { if ($code == $short) { $output = $country; break; } } } return $output; }
php
public function getCountryFromCode($code) { $code = strtoupper($code); $output = "Other"; if (in_array($code, $this->countriesMapping)) { foreach ($this->countriesMapping as $country => $short) { if ($code == $short) { $output = $country; break; } } } return $output; }
[ "public", "function", "getCountryFromCode", "(", "$", "code", ")", "{", "$", "code", "=", "strtoupper", "(", "$", "code", ")", ";", "$", "output", "=", "\"Other\"", ";", "if", "(", "in_array", "(", "$", "code", ",", "$", "this", "->", "countriesMapping...
Get full country name from 3-letter country code @param string $code @return string
[ "Get", "full", "country", "name", "from", "3", "-", "letter", "country", "code" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Countries.php#L78-L92
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Helpers/Countries.php
Countries.getIsoAlpha2FromName
public function getIsoAlpha2FromName($name) { // First try and fetch from alpha3 code. try { return $this->iso->alpha3($this->getCodeFromCountry($name))['alpha2']; } catch (OutOfBoundsException $e) { // Nothing code continues. } // Couldn't getch alpha3 from code try from country name. try { return $this->iso->name($name)['alpha2']; } catch (OutOfBoundsException $e) { $this->logger->warning("Can't get valid alpha2 code for country '$name'"); } return "OT"; }
php
public function getIsoAlpha2FromName($name) { // First try and fetch from alpha3 code. try { return $this->iso->alpha3($this->getCodeFromCountry($name))['alpha2']; } catch (OutOfBoundsException $e) { // Nothing code continues. } // Couldn't getch alpha3 from code try from country name. try { return $this->iso->name($name)['alpha2']; } catch (OutOfBoundsException $e) { $this->logger->warning("Can't get valid alpha2 code for country '$name'"); } return "OT"; }
[ "public", "function", "getIsoAlpha2FromName", "(", "$", "name", ")", "{", "// First try and fetch from alpha3 code.", "try", "{", "return", "$", "this", "->", "iso", "->", "alpha3", "(", "$", "this", "->", "getCodeFromCountry", "(", "$", "name", ")", ")", "[",...
Get iso2 code from Maniaplanet Country name @param $name @return string
[ "Get", "iso2", "code", "from", "Maniaplanet", "Country", "name" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Countries.php#L117-L134
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/DataProviders/AbstractDataProvider.php
AbstractDataProvider.dispatch
protected function dispatch($method, $params) { foreach ($this->plugins as $plugin) { $plugin->$method(...$params); } }
php
protected function dispatch($method, $params) { foreach ($this->plugins as $plugin) { $plugin->$method(...$params); } }
[ "protected", "function", "dispatch", "(", "$", "method", ",", "$", "params", ")", "{", "foreach", "(", "$", "this", "->", "plugins", "as", "$", "plugin", ")", "{", "$", "plugin", "->", "$", "method", "(", "...", "$", "params", ")", ";", "}", "}" ]
Dispatch method call to all plugins. @param string $method method to call. @param array $params
[ "Dispatch", "method", "call", "to", "all", "plugins", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/DataProviders/AbstractDataProvider.php#L51-L56
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Repositories/CostCenter/EloquentCostCenter.php
EloquentCostCenter.byOrganizationAndByKey
public function byOrganizationAndByKey($organizationId, $key) { return $this->CostCenter->where('organization_id', '=', $organizationId)->where('key', '=', $key)->get(); }
php
public function byOrganizationAndByKey($organizationId, $key) { return $this->CostCenter->where('organization_id', '=', $organizationId)->where('key', '=', $key)->get(); }
[ "public", "function", "byOrganizationAndByKey", "(", "$", "organizationId", ",", "$", "key", ")", "{", "return", "$", "this", "->", "CostCenter", "->", "where", "(", "'organization_id'", ",", "'='", ",", "$", "organizationId", ")", "->", "where", "(", "'key'...
Retrieve cost centers by organization and by key @param int $organizationId @param string $key @return Illuminate\Database\Eloquent\Collection
[ "Retrieve", "cost", "centers", "by", "organization", "and", "by", "key" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Repositories/CostCenter/EloquentCostCenter.php#L97-L100
train
honeybee/trellis
src/Runtime/Validator/Rule/Type/ReferenceRule.php
ReferenceRule.execute
protected function execute($value, EntityInterface $entity = null) { $success = true; $collection = null; if ($value instanceof EntityList) { $collection = $value; } elseif (null === $value) { $collection = new EntityList(); } elseif (is_array($value)) { $collection = $this->createEntityList($value); } else { $this->throwError('invalid_type'); $success = false; } if ($success) { $this->setSanitizedValue($collection); } return $success; }
php
protected function execute($value, EntityInterface $entity = null) { $success = true; $collection = null; if ($value instanceof EntityList) { $collection = $value; } elseif (null === $value) { $collection = new EntityList(); } elseif (is_array($value)) { $collection = $this->createEntityList($value); } else { $this->throwError('invalid_type'); $success = false; } if ($success) { $this->setSanitizedValue($collection); } return $success; }
[ "protected", "function", "execute", "(", "$", "value", ",", "EntityInterface", "$", "entity", "=", "null", ")", "{", "$", "success", "=", "true", ";", "$", "collection", "=", "null", ";", "if", "(", "$", "value", "instanceof", "EntityList", ")", "{", "...
Valdiates and sanitizes a given value respective to the reference-valueholder's expectations. @param mixed $value The types 'array' and 'EntityList' are accepted. @return boolean
[ "Valdiates", "and", "sanitizes", "a", "given", "value", "respective", "to", "the", "reference", "-", "valueholder", "s", "expectations", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Validator/Rule/Type/ReferenceRule.php#L29-L50
train
ansas/php-component
src/Component/Locale/Localization.php
Localization.addMap
public function addMap($locale, $map) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale); $this->maps[$locale] = $map; return $this; }
php
public function addMap($locale, $map) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale); $this->maps[$locale] = $map; return $this; }
[ "public", "function", "addMap", "(", "$", "locale", ",", "$", "map", ")", "{", "// Get sanitized locale", "$", "locale", "=", "Locale", "::", "sanitizeLocale", "(", "$", "locale", ")", ";", "$", "this", "->", "maps", "[", "$", "locale", "]", "=", "$", ...
Add map for a virtual locale. @param string $locale @param array $map @return $this
[ "Add", "map", "for", "a", "virtual", "locale", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Localization.php#L59-L67
train
ansas/php-component
src/Component/Locale/Localization.php
Localization.addMaps
public function addMaps(array $maps) { foreach ($maps as $locale => $map) { $this->addMap($locale, $map); } return $this; }
php
public function addMaps(array $maps) { foreach ($maps as $locale => $map) { $this->addMap($locale, $map); } return $this; }
[ "public", "function", "addMaps", "(", "array", "$", "maps", ")", "{", "foreach", "(", "$", "maps", "as", "$", "locale", "=>", "$", "map", ")", "{", "$", "this", "->", "addMap", "(", "$", "locale", ",", "$", "map", ")", ";", "}", "return", "$", ...
Add maps for virtual locales. @param array[] $maps @return $this
[ "Add", "maps", "for", "virtual", "locales", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Localization.php#L76-L83
train
ansas/php-component
src/Component/Locale/Localization.php
Localization.findAvailableLocales
public function findAvailableLocales() { // Check for needed data $path = $this->getPath(); $domain = $this->getDomain(); if (!$path || !$domain) { throw new Exception("Values for 'path' and 'domain' must be set."); } // Build regular expressions for finding domains and locales $regexLocale = Locale::REGEX_LOCALE; $regexDefault = "/^{$regexLocale}\/LC_MESSAGES\/{$domain}\.mo$/ui"; $regexVirtual = "/^(?<virtualLocale>C)\/LC_MESSAGES\/(?<virtualDomain>{$domain}[^a-z]{$regexLocale})\.mo$/ui"; $glob = "{$path}/*/LC_MESSAGES/{$domain}*.mo"; foreach (glob($glob) as $parse) { // Strip path prefix to fit regex $parse = str_replace($path . '/', '', $parse); // Check for default or virtual localized files if (preg_match($regexDefault, $parse, $found) || preg_match($regexVirtual, $parse, $found)) { $this->addLocale($found['locale']); if (!empty($found['virtualLocale'])) { $map = [ 'domain' => $found['virtualDomain'], 'locale' => $found['virtualLocale'], ]; $this->addMap($found['locale'], $map); } } } return $this; }
php
public function findAvailableLocales() { // Check for needed data $path = $this->getPath(); $domain = $this->getDomain(); if (!$path || !$domain) { throw new Exception("Values for 'path' and 'domain' must be set."); } // Build regular expressions for finding domains and locales $regexLocale = Locale::REGEX_LOCALE; $regexDefault = "/^{$regexLocale}\/LC_MESSAGES\/{$domain}\.mo$/ui"; $regexVirtual = "/^(?<virtualLocale>C)\/LC_MESSAGES\/(?<virtualDomain>{$domain}[^a-z]{$regexLocale})\.mo$/ui"; $glob = "{$path}/*/LC_MESSAGES/{$domain}*.mo"; foreach (glob($glob) as $parse) { // Strip path prefix to fit regex $parse = str_replace($path . '/', '', $parse); // Check for default or virtual localized files if (preg_match($regexDefault, $parse, $found) || preg_match($regexVirtual, $parse, $found)) { $this->addLocale($found['locale']); if (!empty($found['virtualLocale'])) { $map = [ 'domain' => $found['virtualDomain'], 'locale' => $found['virtualLocale'], ]; $this->addMap($found['locale'], $map); } } } return $this; }
[ "public", "function", "findAvailableLocales", "(", ")", "{", "// Check for needed data", "$", "path", "=", "$", "this", "->", "getPath", "(", ")", ";", "$", "domain", "=", "$", "this", "->", "getDomain", "(", ")", ";", "if", "(", "!", "$", "path", "||"...
Dynamically find all available locales. This class supports "virtual locales" because often not all locales are installed on the server. If you want to use <code>gettext()</code> the used locale MUST be installed. This class uses the workaround via default internal locale "C" and determining the locale via filename. The mapping is done automatically. All locales must be stored in a "locale" folder (specified via <code>setPath()</code> in this structure: - <code><pathToLocale>/<locale>/LC_MESSAGES/<domain>.mo</code> or - <code><pathToLocale>/C/LC_MESSAGES/<domain>.<locale>.mo</code> Examples: - <code>de_DE/LC_MESSAGES/default.mo</code> or - <code>C/LC_MESSAGES/app.en_GB.mo</code> @throws Exception
[ "Dynamically", "find", "all", "available", "locales", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Localization.php#L102-L135
train
ansas/php-component
src/Component/Locale/Localization.php
Localization.getDomain
public function getDomain($realDomain = false) { if ($realDomain) { return $this->getMap($this->getActive(), 'domain') ?: $this->domain; } return $this->domain; }
php
public function getDomain($realDomain = false) { if ($realDomain) { return $this->getMap($this->getActive(), 'domain') ?: $this->domain; } return $this->domain; }
[ "public", "function", "getDomain", "(", "$", "realDomain", "=", "false", ")", "{", "if", "(", "$", "realDomain", ")", "{", "return", "$", "this", "->", "getMap", "(", "$", "this", "->", "getActive", "(", ")", ",", "'domain'", ")", "?", ":", "$", "t...
Get locale domain. @param bool $realDomain [optional] Get mapped value (if exists) @return string
[ "Get", "locale", "domain", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Localization.php#L154-L161
train
ansas/php-component
src/Component/Locale/Localization.php
Localization.getMap
public function getMap($locale, $key = null) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale); if ($key) { return isset($this->maps[$locale][$key]) ? $this->maps[$locale][$key] : null; } return isset($this->maps[$locale]) ? $this->maps[$locale] : null; }
php
public function getMap($locale, $key = null) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale); if ($key) { return isset($this->maps[$locale][$key]) ? $this->maps[$locale][$key] : null; } return isset($this->maps[$locale]) ? $this->maps[$locale] : null; }
[ "public", "function", "getMap", "(", "$", "locale", ",", "$", "key", "=", "null", ")", "{", "// Get sanitized locale", "$", "locale", "=", "Locale", "::", "sanitizeLocale", "(", "$", "locale", ")", ";", "if", "(", "$", "key", ")", "{", "return", "isset...
Get map for specified name. @param string|Locale $locale @param string $key @return array|null
[ "Get", "map", "for", "specified", "name", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Localization.php#L193-L203
train
video-games-records/CoreBundle
Repository/PlayerChartRepository.php
PlayerChartRepository.getRankingForUpdate
public function getRankingForUpdate(Chart $chart) { $queryBuilder = $this->createQueryBuilder('pc'); $queryBuilder ->innerJoin('pc.player', 'p') ->addSelect('p') ->innerJoin('pc.status', 'status') ->addSelect('status') ->where('pc.chart = :chart') ->setParameter('chart', $chart) ->andWhere('status.boolRanking = 1'); foreach ($chart->getLibs() as $lib) { $key = 'value_' . $lib->getIdLibChart(); $alias = 'pcl_' . $lib->getIdLibChart(); $subQueryBuilder = $this->getEntityManager()->createQueryBuilder() ->select(sprintf('%s.value', $alias)) ->from('VideoGamesRecordsCoreBundle:PlayerChartLib', $alias) ->where(sprintf('%s.libChart = :%s', $alias, $key)) ->andWhere(sprintf('%s.player = pc.player', $alias)) ->setParameter($key, $lib); $queryBuilder ->addSelect(sprintf('(%s) as %s', $subQueryBuilder->getQuery()->getDQL(), $key)) ->addOrderBy($key, $lib->getType()->getOrderBy()) ->setParameter($key, $lib); } return $queryBuilder->getQuery()->getResult(); }
php
public function getRankingForUpdate(Chart $chart) { $queryBuilder = $this->createQueryBuilder('pc'); $queryBuilder ->innerJoin('pc.player', 'p') ->addSelect('p') ->innerJoin('pc.status', 'status') ->addSelect('status') ->where('pc.chart = :chart') ->setParameter('chart', $chart) ->andWhere('status.boolRanking = 1'); foreach ($chart->getLibs() as $lib) { $key = 'value_' . $lib->getIdLibChart(); $alias = 'pcl_' . $lib->getIdLibChart(); $subQueryBuilder = $this->getEntityManager()->createQueryBuilder() ->select(sprintf('%s.value', $alias)) ->from('VideoGamesRecordsCoreBundle:PlayerChartLib', $alias) ->where(sprintf('%s.libChart = :%s', $alias, $key)) ->andWhere(sprintf('%s.player = pc.player', $alias)) ->setParameter($key, $lib); $queryBuilder ->addSelect(sprintf('(%s) as %s', $subQueryBuilder->getQuery()->getDQL(), $key)) ->addOrderBy($key, $lib->getType()->getOrderBy()) ->setParameter($key, $lib); } return $queryBuilder->getQuery()->getResult(); }
[ "public", "function", "getRankingForUpdate", "(", "Chart", "$", "chart", ")", "{", "$", "queryBuilder", "=", "$", "this", "->", "createQueryBuilder", "(", "'pc'", ")", ";", "$", "queryBuilder", "->", "innerJoin", "(", "'pc.player'", ",", "'p'", ")", "->", ...
Provides every playerChart for update purpose. @param \VideoGamesRecords\CoreBundle\Entity\Chart $chart @return array
[ "Provides", "every", "playerChart", "for", "update", "purpose", "." ]
64fc8fbc8217f4593b26223168463bfbe8f3fd61
https://github.com/video-games-records/CoreBundle/blob/64fc8fbc8217f4593b26223168463bfbe8f3fd61/Repository/PlayerChartRepository.php#L119-L147
train
video-games-records/CoreBundle
Repository/PlayerChartRepository.php
PlayerChartRepository.getRanking
public function getRanking(Chart $chart, $player = null, $limit = null) { $queryBuilder = $this->getRankingBaseQuery($chart); $queryBuilder ->andWhere('status.boolRanking = 1'); if (null !== $limit && null !== $player) { $queryBuilder ->andWhere( $queryBuilder->expr()->orX('pc.rank <= :maxRank', 'pc.player = :player') ) ->setParameter('maxRank', $limit) ->setParameter('player', $player); } elseif (null !== $limit) { $queryBuilder ->andWhere('pc.rank <= :maxRank') ->setParameter('maxRank', $limit); } return $queryBuilder->getQuery()->getResult(); }
php
public function getRanking(Chart $chart, $player = null, $limit = null) { $queryBuilder = $this->getRankingBaseQuery($chart); $queryBuilder ->andWhere('status.boolRanking = 1'); if (null !== $limit && null !== $player) { $queryBuilder ->andWhere( $queryBuilder->expr()->orX('pc.rank <= :maxRank', 'pc.player = :player') ) ->setParameter('maxRank', $limit) ->setParameter('player', $player); } elseif (null !== $limit) { $queryBuilder ->andWhere('pc.rank <= :maxRank') ->setParameter('maxRank', $limit); } return $queryBuilder->getQuery()->getResult(); }
[ "public", "function", "getRanking", "(", "Chart", "$", "chart", ",", "$", "player", "=", "null", ",", "$", "limit", "=", "null", ")", "{", "$", "queryBuilder", "=", "$", "this", "->", "getRankingBaseQuery", "(", "$", "chart", ")", ";", "$", "queryBuild...
Provides valid ranking. @param \VideoGamesRecords\CoreBundle\Entity\Chart $chart @param \VideoGamesRecords\CoreBundle\Entity\Player $player @param int|null $limit @return array @todo => If idPlayer, search for the rank and display a range of -5 and +5
[ "Provides", "valid", "ranking", "." ]
64fc8fbc8217f4593b26223168463bfbe8f3fd61
https://github.com/video-games-records/CoreBundle/blob/64fc8fbc8217f4593b26223168463bfbe8f3fd61/Repository/PlayerChartRepository.php#L160-L180
train
video-games-records/CoreBundle
Repository/PlayerChartRepository.php
PlayerChartRepository.getDisableRanking
public function getDisableRanking(Chart $chart) { $queryBuilder = $this->getRankingBaseQuery($chart); $queryBuilder ->andWhere('status.boolRanking = 0'); return $queryBuilder->getQuery()->getResult(); }
php
public function getDisableRanking(Chart $chart) { $queryBuilder = $this->getRankingBaseQuery($chart); $queryBuilder ->andWhere('status.boolRanking = 0'); return $queryBuilder->getQuery()->getResult(); }
[ "public", "function", "getDisableRanking", "(", "Chart", "$", "chart", ")", "{", "$", "queryBuilder", "=", "$", "this", "->", "getRankingBaseQuery", "(", "$", "chart", ")", ";", "$", "queryBuilder", "->", "andWhere", "(", "'status.boolRanking = 0'", ")", ";", ...
Provides disabled list. @param \VideoGamesRecords\CoreBundle\Entity\Chart $chart @return array
[ "Provides", "disabled", "list", "." ]
64fc8fbc8217f4593b26223168463bfbe8f3fd61
https://github.com/video-games-records/CoreBundle/blob/64fc8fbc8217f4593b26223168463bfbe8f3fd61/Repository/PlayerChartRepository.php#L225-L232
train
VitexSoftware/FlexiPeeHP-Bricks
src/FlexiPeeHP/ui/OrderListingItem.php
OrderListingItem.dueLabel
static function dueLabel($date) { $days = \FlexiPeeHP\FakturaVydana::overdueDays($date); if ($days < 0) { $type = 'success'; $msg = sprintf(_(' %s days to due'), new \Ease\TWB\Badge(abs($days))); } else { $msg = sprintf(_(' %s days after due'), new \Ease\TWB\Badge(abs($days))); if ($days > 14) { $type = 'danger'; } else { $type = 'warning'; } } return new \Ease\TWB\Label($type, $msg); }
php
static function dueLabel($date) { $days = \FlexiPeeHP\FakturaVydana::overdueDays($date); if ($days < 0) { $type = 'success'; $msg = sprintf(_(' %s days to due'), new \Ease\TWB\Badge(abs($days))); } else { $msg = sprintf(_(' %s days after due'), new \Ease\TWB\Badge(abs($days))); if ($days > 14) { $type = 'danger'; } else { $type = 'warning'; } } return new \Ease\TWB\Label($type, $msg); }
[ "static", "function", "dueLabel", "(", "$", "date", ")", "{", "$", "days", "=", "\\", "FlexiPeeHP", "\\", "FakturaVydana", "::", "overdueDays", "(", "$", "date", ")", ";", "if", "(", "$", "days", "<", "0", ")", "{", "$", "type", "=", "'success'", "...
Ovedude label with days @param string $date @return \Ease\TWB\Label
[ "Ovedude", "label", "with", "days" ]
e6d6d9b6cb6ceffe31b35e0f8f396f614473047b
https://github.com/VitexSoftware/FlexiPeeHP-Bricks/blob/e6d6d9b6cb6ceffe31b35e0f8f396f614473047b/src/FlexiPeeHP/ui/OrderListingItem.php#L108-L125
train
anklimsk/cakephp-theme
View/Helper/ActionScriptHelper.php
ActionScriptHelper._createFileVersion
protected function _createFileVersion($timestamp = null) { if (!is_int($timestamp)) { $timestamp = time(); } $result = dechex($timestamp); return $result; }
php
protected function _createFileVersion($timestamp = null) { if (!is_int($timestamp)) { $timestamp = time(); } $result = dechex($timestamp); return $result; }
[ "protected", "function", "_createFileVersion", "(", "$", "timestamp", "=", "null", ")", "{", "if", "(", "!", "is_int", "(", "$", "timestamp", ")", ")", "{", "$", "timestamp", "=", "time", "(", ")", ";", "}", "$", "result", "=", "dechex", "(", "$", ...
Return version from timestamp. @param string|int $timestamp Time stamp of modifications file. @return string Version of file in hex.
[ "Return", "version", "from", "timestamp", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ActionScriptHelper.php#L52-L60
train
anklimsk/cakephp-theme
View/Helper/ActionScriptHelper.php
ActionScriptHelper._prepareFilePath
protected function _prepareFilePath($path = null) { if (empty($path)) { return false; } if (DIRECTORY_SEPARATOR !== '\\') { return $path; } $path = str_replace('\\', '/', $path); return $path; }
php
protected function _prepareFilePath($path = null) { if (empty($path)) { return false; } if (DIRECTORY_SEPARATOR !== '\\') { return $path; } $path = str_replace('\\', '/', $path); return $path; }
[ "protected", "function", "_prepareFilePath", "(", "$", "path", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "return", "false", ";", "}", "if", "(", "DIRECTORY_SEPARATOR", "!==", "'\\\\'", ")", "{", "return", "$", "path", ...
Replacing directory separator for Windows from backslash to slash. @param string $path Path to replacing. @return string|bool Return String of path, or False on failure.
[ "Replacing", "directory", "separator", "for", "Windows", "from", "backslash", "to", "slash", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ActionScriptHelper.php#L68-L80
train
anklimsk/cakephp-theme
View/Helper/ActionScriptHelper.php
ActionScriptHelper._getIncludeFilePath
protected function _getIncludeFilePath($specificFullPath = null, $specificPath = null, $specificFileName = null) { if (empty($specificFullPath) || empty($specificPath) || empty($specificFileName)) { return false; } $oFile = new File($specificFullPath . $specificFileName); if (!$oFile->exists()) { return false; } $includeFilePath = $this->_prepareFilePath($specificPath . $specificFileName); $lastChange = $oFile->lastChange(); $version = $this->_createFileVersion($lastChange); $result = $includeFilePath . '?v=' . $version; return $result; }
php
protected function _getIncludeFilePath($specificFullPath = null, $specificPath = null, $specificFileName = null) { if (empty($specificFullPath) || empty($specificPath) || empty($specificFileName)) { return false; } $oFile = new File($specificFullPath . $specificFileName); if (!$oFile->exists()) { return false; } $includeFilePath = $this->_prepareFilePath($specificPath . $specificFileName); $lastChange = $oFile->lastChange(); $version = $this->_createFileVersion($lastChange); $result = $includeFilePath . '?v=' . $version; return $result; }
[ "protected", "function", "_getIncludeFilePath", "(", "$", "specificFullPath", "=", "null", ",", "$", "specificPath", "=", "null", ",", "$", "specificFileName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "specificFullPath", ")", "||", "empty", "(", ...
Return specific file for action View @param string $specificFullPath Full path to specific folder. @param string $specificPath Path to specific folder begin from /web_root/css/ or /web_root/js/. @param string $specificFileName File name of specific file. @return string|bool Return String of path to specific file, or False on failure.
[ "Return", "specific", "file", "for", "action", "View" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ActionScriptHelper.php#L91-L108
train
anklimsk/cakephp-theme
View/Helper/ActionScriptHelper.php
ActionScriptHelper.css
public function css($options = [], $params = [], $includeOnlyParam = false, $useUserRolePrefix = false) { $css = $this->getFilesForAction('css', $params, $includeOnlyParam, $useUserRolePrefix); if (empty($css)) { return null; } return $this->Html->css($css, $options); }
php
public function css($options = [], $params = [], $includeOnlyParam = false, $useUserRolePrefix = false) { $css = $this->getFilesForAction('css', $params, $includeOnlyParam, $useUserRolePrefix); if (empty($css)) { return null; } return $this->Html->css($css, $options); }
[ "public", "function", "css", "(", "$", "options", "=", "[", "]", ",", "$", "params", "=", "[", "]", ",", "$", "includeOnlyParam", "=", "false", ",", "$", "useUserRolePrefix", "=", "false", ")", "{", "$", "css", "=", "$", "this", "->", "getFilesForAct...
Creates a link element for specific files for action View CSS stylesheets. @param array $options Array of options and HTML arguments. @param array|string $params List of sub folders in `specific` folder for retrieve list of specific files. @param bool $includeOnlyParam If True, to include in the result only those files that are listed in the parameter $params. If false to include in the result all of the specific files found in the parameter $params. @param bool $useUserRolePrefix If False, use only action name without route prefix. @return string CSS `<link />` or `<style />` tag, depending on the type of link. See HtmlHelper::css(); @see ActionScriptHelper::getFilesForAction() Return list of specific files for action View @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::css
[ "Creates", "a", "link", "element", "for", "specific", "files", "for", "action", "View", "CSS", "stylesheets", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ActionScriptHelper.php#L277-L284
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Triggers/NewOrganizationTrigger.php
NewOrganizationTrigger.run
public function run($id, $databaseConnectionName, &$userAppsRecommendations) { $this->Setting->changeDatabaseConnection($databaseConnectionName); $this->Setting->create(array('organization_id' => $id)); array_push($userAppsRecommendations, array('appName' => $this->Lang->get('decima-accounting::menu.initialAccountingSetup'), 'appAction' => $this->Lang->get('decima-accounting::initial-accounting-setup.action'))); }
php
public function run($id, $databaseConnectionName, &$userAppsRecommendations) { $this->Setting->changeDatabaseConnection($databaseConnectionName); $this->Setting->create(array('organization_id' => $id)); array_push($userAppsRecommendations, array('appName' => $this->Lang->get('decima-accounting::menu.initialAccountingSetup'), 'appAction' => $this->Lang->get('decima-accounting::initial-accounting-setup.action'))); }
[ "public", "function", "run", "(", "$", "id", ",", "$", "databaseConnectionName", ",", "&", "$", "userAppsRecommendations", ")", "{", "$", "this", "->", "Setting", "->", "changeDatabaseConnection", "(", "$", "databaseConnectionName", ")", ";", "$", "this", "->"...
This method will be executed after an organization has been created. @param integer $id Organization id @param string $databaseConnectionName Database connection name of the organization @param array $userAppsRecommendations An array as follows: array('appName'=>$appName, 'appAction'=>$appAction) @return void
[ "This", "method", "will", "be", "executed", "after", "an", "organization", "has", "been", "created", "." ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Triggers/NewOrganizationTrigger.php#L67-L73
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper.create
public function create($model = null, $options = []) { $form = parent::create($model, $options); if (!isset($options['url']) || ($options['url'] !== false)) { return $form; } // Ignore options `url` => false $result = mb_ereg_replace('action=\"[^\"]*\"', '', $form); return $result; }
php
public function create($model = null, $options = []) { $form = parent::create($model, $options); if (!isset($options['url']) || ($options['url'] !== false)) { return $form; } // Ignore options `url` => false $result = mb_ereg_replace('action=\"[^\"]*\"', '', $form); return $result; }
[ "public", "function", "create", "(", "$", "model", "=", "null", ",", "$", "options", "=", "[", "]", ")", "{", "$", "form", "=", "parent", "::", "create", "(", "$", "model", ",", "$", "options", ")", ";", "if", "(", "!", "isset", "(", "$", "opti...
Returns an HTML FORM element. Fix Ignore options `url` => false @param mixed|null $model The model name for which the form is being defined. Should include the plugin name for plugin models. e.g. `ContactManager.Contact`. If an array is passed and $options argument is empty, the array will be used as options. If `false` no model is used. @param array $options An array of html attributes and options. @return string A formatted opening FORM tag. @link https://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#options-for-create
[ "Returns", "an", "HTML", "FORM", "element", ".", "Fix", "Ignore", "options", "url", "=", ">", "false" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L83-L93
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper._initLabel
protected function _initLabel($options) { if (isset($options['label']) && is_array($options['label'])) { $options['label'] = [ 'text' => $options['label'] ]; } return parent::_initLabel($options); }
php
protected function _initLabel($options) { if (isset($options['label']) && is_array($options['label'])) { $options['label'] = [ 'text' => $options['label'] ]; } return parent::_initLabel($options); }
[ "protected", "function", "_initLabel", "(", "$", "options", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'label'", "]", ")", "&&", "is_array", "(", "$", "options", "[", "'label'", "]", ")", ")", "{", "$", "options", "[", "'label'", "]", ...
If label is a array, transform it to proper label options array with the text option @param array $options An array of HTML attributes. @return array An array of HTML attributes
[ "If", "label", "is", "a", "array", "transform", "it", "to", "proper", "label", "options", "array", "with", "the", "text", "option" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L258-L266
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper.getLabelTextFromField
public function getLabelTextFromField($fieldName = null) { $text = ''; if (empty($fieldName)) { return $text; } if (strpos($fieldName, '.') !== false) { $fieldElements = explode('.', $fieldName); $text = array_pop($fieldElements); } else { $text = $fieldName; } if (substr($text, -3) === '_id') { $text = substr($text, 0, -3); } $text = Inflector::humanize(Inflector::underscore($text)); return $text; }
php
public function getLabelTextFromField($fieldName = null) { $text = ''; if (empty($fieldName)) { return $text; } if (strpos($fieldName, '.') !== false) { $fieldElements = explode('.', $fieldName); $text = array_pop($fieldElements); } else { $text = $fieldName; } if (substr($text, -3) === '_id') { $text = substr($text, 0, -3); } $text = Inflector::humanize(Inflector::underscore($text)); return $text; }
[ "public", "function", "getLabelTextFromField", "(", "$", "fieldName", "=", "null", ")", "{", "$", "text", "=", "''", ";", "if", "(", "empty", "(", "$", "fieldName", ")", ")", "{", "return", "$", "text", ";", "}", "if", "(", "strpos", "(", "$", "fie...
Returns text for label from field name. @param string $fieldName Field name @return string Text for label
[ "Returns", "text", "for", "label", "from", "field", "name", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L314-L332
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper._prepareExtraOptions
protected function _prepareExtraOptions(array &$options, $listExtraOptions = [], $optionPrefix = 'data-') { if (empty($options) || empty($listExtraOptions)) { return; } if (!is_array($listExtraOptions)) { $listExtraOptions = [$listExtraOptions]; } $extraOptions = array_intersect_key($options, array_flip($listExtraOptions)); if (empty($extraOptions)) { return; } foreach ($extraOptions as $extraOptionName => $extraOptionValue) { if (is_bool($extraOptionValue)) { if ($extraOptionValue) { $extraOptionValue = 'true'; } else { $extraOptionValue = 'false'; } } $options[$optionPrefix . $extraOptionName] = $extraOptionValue; unset($options[$extraOptionName]); } }
php
protected function _prepareExtraOptions(array &$options, $listExtraOptions = [], $optionPrefix = 'data-') { if (empty($options) || empty($listExtraOptions)) { return; } if (!is_array($listExtraOptions)) { $listExtraOptions = [$listExtraOptions]; } $extraOptions = array_intersect_key($options, array_flip($listExtraOptions)); if (empty($extraOptions)) { return; } foreach ($extraOptions as $extraOptionName => $extraOptionValue) { if (is_bool($extraOptionValue)) { if ($extraOptionValue) { $extraOptionValue = 'true'; } else { $extraOptionValue = 'false'; } } $options[$optionPrefix . $extraOptionName] = $extraOptionValue; unset($options[$extraOptionName]); } }
[ "protected", "function", "_prepareExtraOptions", "(", "array", "&", "$", "options", ",", "$", "listExtraOptions", "=", "[", "]", ",", "$", "optionPrefix", "=", "'data-'", ")", "{", "if", "(", "empty", "(", "$", "options", ")", "||", "empty", "(", "$", ...
Prepare extra option for form input. @param array &$options List of options for prepare @param string|array $listExtraOptions List of extra options. @param string $optionPrefix Prefix for extra options. @return void
[ "Prepare", "extra", "option", "for", "form", "input", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L342-L366
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper._inputMaskAlias
protected function _inputMaskAlias($fieldName, $options = [], $alias = '') { if (!is_array($options)) { $options = []; } $defaultOptions = [ 'label' => false, ]; $options += $defaultOptions; $options['data-inputmask-alias'] = $alias; return $this->text($fieldName, $options); }
php
protected function _inputMaskAlias($fieldName, $options = [], $alias = '') { if (!is_array($options)) { $options = []; } $defaultOptions = [ 'label' => false, ]; $options += $defaultOptions; $options['data-inputmask-alias'] = $alias; return $this->text($fieldName, $options); }
[ "protected", "function", "_inputMaskAlias", "(", "$", "fieldName", ",", "$", "options", "=", "[", "]", ",", "$", "alias", "=", "''", ")", "{", "if", "(", "!", "is_array", "(", "$", "options", ")", ")", "{", "$", "options", "=", "[", "]", ";", "}"...
Creates input with input mask alias. @param string $fieldName Name of a field, like this "Modelname.fieldname" @param array $options Array of HTML attributes. @param string $alias Input mask alias. @return string An HTML text input element. @see {@link https://github.com/RobinHerbots/jquery.inputmask} jQuery.Inputmask
[ "Creates", "input", "with", "input", "mask", "alias", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L412-L423
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper.spin
public function spin($fieldName, $options = []) { if (!is_array($options)) { $options = []; } $defaultOptions = $this->_getOptionsForElem('spin.defaultOpt'); $options = $defaultOptions + $options; $listExtraOptions = $this->_getOptionsForElem('spin.extraOpt'); $this->_prepareExtraOptions($options, $listExtraOptions, 'data-spin-'); $numbers = ''; $decimals = ''; if (isset($options['data-spin-max']) && !empty($options['data-spin-max'])) { $numbers = mb_strlen($options['data-spin-max']); } if (isset($options['data-spin-decimals']) && !empty($options['data-spin-decimals'])) { $decimals = (int)$options['data-spin-decimals']; } $options['data-inputmask-mask'] = '9{1,' . $numbers . '}'; if (!empty($decimals)) { $options['data-inputmask-mask'] .= '.9{' . $decimals . '}'; } return $this->text($fieldName, $options); }
php
public function spin($fieldName, $options = []) { if (!is_array($options)) { $options = []; } $defaultOptions = $this->_getOptionsForElem('spin.defaultOpt'); $options = $defaultOptions + $options; $listExtraOptions = $this->_getOptionsForElem('spin.extraOpt'); $this->_prepareExtraOptions($options, $listExtraOptions, 'data-spin-'); $numbers = ''; $decimals = ''; if (isset($options['data-spin-max']) && !empty($options['data-spin-max'])) { $numbers = mb_strlen($options['data-spin-max']); } if (isset($options['data-spin-decimals']) && !empty($options['data-spin-decimals'])) { $decimals = (int)$options['data-spin-decimals']; } $options['data-inputmask-mask'] = '9{1,' . $numbers . '}'; if (!empty($decimals)) { $options['data-inputmask-mask'] .= '.9{' . $decimals . '}'; } return $this->text($fieldName, $options); }
[ "public", "function", "spin", "(", "$", "fieldName", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "options", ")", ")", "{", "$", "options", "=", "[", "]", ";", "}", "$", "defaultOptions", "=", "$", "this", ...
Creates a touch spin input widget. ### Options: - `min` - Minimum value; - `max` - Maximum value; - `step` - Incremental/decremental step on up/down change; - `decimals` - Number of decimal points; - `maxboostedstep` - Maximum step when boosted; - `verticalbuttons` - Enables the traditional up/down buttons; - `prefix` - Text before the input; - `prefix_extraclass` - Extra class(es) for prefix; - `postfix` - Text after the input; - `postfix_extraclass` - Extra class(es) for postfix. @param string $fieldName Name of a field, like this "Modelname.fieldname" @param array $options Array of HTML attributes. @return string An HTML text input element. @see {@link http://www.virtuosoft.eu/code/bootstrap-touchspin} TouchSpin
[ "Creates", "a", "touch", "spin", "input", "widget", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L604-L627
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper.flag
public function flag($fieldName, $options = []) { if (!empty($fieldName)) { $this->setEntity($fieldName); } $this->unlockField($this->field()); if (!is_array($options)) { $options = []; } $defaultOptions = $this->_getOptionsForElem('flag.defaultOpt'); $options = $defaultOptions + $options; $divClass = 'form-group'; $label = ''; $list = []; $options = $this->_optionsOptions($options); if (isset($options['label'])) { $label = $this->label($fieldName, $options['label'], ['class' => 'control-label']); } if (isset($options['options'])) { $list = $options['options']; } $listExtraOptions = $this->_getOptionsForElem('flag.extraOpt'); $this->_prepareExtraOptions($options, $listExtraOptions); $errors = FormHelper::error($fieldName, null, ['class' => 'help-block']); if (!empty($errors)) { $divClass .= ' has-error error'; } $divOptions = [ 'id' => $this->domId($fieldName), 'data-input-name' => $this->_name(null, $fieldName), 'data-selected-country' => $this->value($fieldName), ]; $divOptionsDefault = $this->_getOptionsForElem('flag.divOpt'); if (!empty($list)) { $divOptions['data-countries'] = json_encode($list); } foreach ($listExtraOptions as $extraOptionName) { if (isset($options['data-' . $extraOptionName])) { $divClass['data-' . $extraOptionName] = $options['data-' . $extraOptionName]; } } $result = $this->Html->div($divClass, $label . $this->Html->div(null, '', $divOptions + $divOptionsDefault) . $errors); return $result; }
php
public function flag($fieldName, $options = []) { if (!empty($fieldName)) { $this->setEntity($fieldName); } $this->unlockField($this->field()); if (!is_array($options)) { $options = []; } $defaultOptions = $this->_getOptionsForElem('flag.defaultOpt'); $options = $defaultOptions + $options; $divClass = 'form-group'; $label = ''; $list = []; $options = $this->_optionsOptions($options); if (isset($options['label'])) { $label = $this->label($fieldName, $options['label'], ['class' => 'control-label']); } if (isset($options['options'])) { $list = $options['options']; } $listExtraOptions = $this->_getOptionsForElem('flag.extraOpt'); $this->_prepareExtraOptions($options, $listExtraOptions); $errors = FormHelper::error($fieldName, null, ['class' => 'help-block']); if (!empty($errors)) { $divClass .= ' has-error error'; } $divOptions = [ 'id' => $this->domId($fieldName), 'data-input-name' => $this->_name(null, $fieldName), 'data-selected-country' => $this->value($fieldName), ]; $divOptionsDefault = $this->_getOptionsForElem('flag.divOpt'); if (!empty($list)) { $divOptions['data-countries'] = json_encode($list); } foreach ($listExtraOptions as $extraOptionName) { if (isset($options['data-' . $extraOptionName])) { $divClass['data-' . $extraOptionName] = $options['data-' . $extraOptionName]; } } $result = $this->Html->div($divClass, $label . $this->Html->div(null, '', $divOptions + $divOptionsDefault) . $errors); return $result; }
[ "public", "function", "flag", "(", "$", "fieldName", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "fieldName", ")", ")", "{", "$", "this", "->", "setEntity", "(", "$", "fieldName", ")", ";", "}", "$", "this", ...
Creates a flagstrap input widget. ### Options: - `options` - array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the SELECT element. @param string $fieldName Name of a field, like this "Modelname.fieldname" @param array $options Array of HTML attributes. @return string An HTML text input element. @see {@link https://github.com/blazeworx/flagstrap} Flagstrap
[ "Creates", "a", "flagstrap", "input", "widget", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L642-L687
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper.autocomplete
public function autocomplete($fieldName, $options = []) { if (!is_array($options)) { $options = []; } $defaultOptions = $this->_getOptionsForElem('autocomplete.defaultOpt'); $options = $defaultOptions + $options; $listExtraOptions = $this->_getOptionsForElem('autocomplete.extraOpt'); $this->_prepareExtraOptions($options, $listExtraOptions, 'data-autocomplete-'); if (!isset($options['data-autocomplete-url']) && !isset($options['data-autocomplete-local'])) { $options['data-autocomplete-url'] = $this->url( $this->ViewExtension->addUserPrefixUrl([ 'controller' => 'filter', 'action' => 'autocomplete', 'plugin' => 'cake_theme', 'ext' => 'json', 'prefix' => false ]) ); } if (isset($options['data-autocomplete-local']) && !empty($options['data-autocomplete-local'])) { if (!is_array($options['data-autocomplete-local'])) { $options['data-autocomplete-local'] = [$options['data-autocomplete-local']]; } $options['data-autocomplete-local'] = json_encode($options['data-autocomplete-local']); } return $this->text($fieldName, $options); }
php
public function autocomplete($fieldName, $options = []) { if (!is_array($options)) { $options = []; } $defaultOptions = $this->_getOptionsForElem('autocomplete.defaultOpt'); $options = $defaultOptions + $options; $listExtraOptions = $this->_getOptionsForElem('autocomplete.extraOpt'); $this->_prepareExtraOptions($options, $listExtraOptions, 'data-autocomplete-'); if (!isset($options['data-autocomplete-url']) && !isset($options['data-autocomplete-local'])) { $options['data-autocomplete-url'] = $this->url( $this->ViewExtension->addUserPrefixUrl([ 'controller' => 'filter', 'action' => 'autocomplete', 'plugin' => 'cake_theme', 'ext' => 'json', 'prefix' => false ]) ); } if (isset($options['data-autocomplete-local']) && !empty($options['data-autocomplete-local'])) { if (!is_array($options['data-autocomplete-local'])) { $options['data-autocomplete-local'] = [$options['data-autocomplete-local']]; } $options['data-autocomplete-local'] = json_encode($options['data-autocomplete-local']); } return $this->text($fieldName, $options); }
[ "public", "function", "autocomplete", "(", "$", "fieldName", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "options", ")", ")", "{", "$", "options", "=", "[", "]", ";", "}", "$", "defaultOptions", "=", "$", "...
Creates text input with autocomplete. ### Options: - `type` - Type for autocomplete suggestions, e.g. Model.Field; - `plugin` - Plugin name for autocomplete field; - `url` - URL for autocomplete; - `local` - Local data for autocomplete; - `min-length` - minimal length of query string. @param string $fieldName Name of a field, like this "Modelname.fieldname" @param array $options Array of HTML attributes. @return string An HTML text input element. @see {@link https://github.com/bassjobsen/Bootstrap-3-Typeahead} Bootstrap 3 Typeahead
[ "Creates", "text", "input", "with", "autocomplete", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L705-L733
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper.createUploadForm
public function createUploadForm($model = null, $options = []) { if (empty($options) || !is_array($options)) { $options = []; } $optionsDefault = $this->_getOptionsForElem('createUploadForm'); $options = $this->ViewExtension->getFormOptions($optionsDefault + $options); $result = $this->create($model, $options); return $result; }
php
public function createUploadForm($model = null, $options = []) { if (empty($options) || !is_array($options)) { $options = []; } $optionsDefault = $this->_getOptionsForElem('createUploadForm'); $options = $this->ViewExtension->getFormOptions($optionsDefault + $options); $result = $this->create($model, $options); return $result; }
[ "public", "function", "createUploadForm", "(", "$", "model", "=", "null", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "options", ")", "||", "!", "is_array", "(", "$", "options", ")", ")", "{", "$", "options", "=", ...
Returns an HTML FORM element for upload file. ### Options: - `type` Form method defaults to POST - `action` The controller action the form submits to, (optional). Deprecated since 2.8, use `url`. - `url` The URL the form submits to. Can be a string or a URL array. If you use 'url' you should leave 'action' undefined. - `default` Allows for the creation of AJAX forms. Set this to false to prevent the default event handler. Will create an onsubmit attribute if it doesn't not exist. If it does, default action suppression will be appended. - `onsubmit` Used in conjunction with 'default' to create AJAX forms. - `inputDefaults` set the default $options for FormHelper::input(). Any options that would be set when using FormHelper::input() can be set here. Options set with `inputDefaults` can be overridden when calling input() - `encoding` Set the accept-charset encoding for the form. Defaults to `Configure::read('App.encoding')` @param mixed|null $model The model name for which the form is being defined. Should include the plugin name for plugin models. e.g. `ContactManager.Contact`. If an array is passed and $options argument is empty, the array will be used as options. If `false` no model is used. @param array $options An array of html attributes and options. @return string A formatted opening FORM tag. @link https://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#options-for-create
[ "Returns", "an", "HTML", "FORM", "element", "for", "upload", "file", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L761-L770
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper.upload
public function upload($url = null, $maxfilesize = 0, $acceptfiletypes = null, $redirecturl = null, $btnTitle = null, $btnClass = null) { if (empty($url)) { return null; } if (empty($btnTitle)) { $btnTitle = $this->ViewExtension->iconTag('fas fa-file-upload') . '&nbsp;' . $this->_getOptionsForElem('upload.btnTitle'); } if (empty($btnClass)) { $btnClass = 'btn-success'; } $inputId = uniqid('input_'); $progressId = uniqid('progress_'); $filesId = uniqid('files_'); $inputOptions = [ 'id' => $inputId, 'data-progress-id' => $progressId, 'data-files-id' => $filesId, 'data-fileupload-url' => $url, 'data-fileupload-maxfilesize' => $maxfilesize, 'data-fileupload-acceptfiletypes' => $acceptfiletypes, 'data-fileupload-redirecturl' => $redirecturl ]; $optionsDefault = $this->_getOptionsForElem('upload.inputOpt'); $result = $this->Html->tag( 'span', $btnTitle . $this->input(null, $inputOptions + $optionsDefault), ['class' => 'fileinput-button btn ' . $btnClass] ) . $this->Html->tag('br') . $this->Html->tag('br') . $this->Html->div('progress', $this->Html->div('progress-bar progress-bar-success', ''), ['id' => $progressId]) . $this->Html->tag('hr') . $this->Html->div('files', '', ['id' => $filesId]) . $this->Html->tag('br'); return $result; }
php
public function upload($url = null, $maxfilesize = 0, $acceptfiletypes = null, $redirecturl = null, $btnTitle = null, $btnClass = null) { if (empty($url)) { return null; } if (empty($btnTitle)) { $btnTitle = $this->ViewExtension->iconTag('fas fa-file-upload') . '&nbsp;' . $this->_getOptionsForElem('upload.btnTitle'); } if (empty($btnClass)) { $btnClass = 'btn-success'; } $inputId = uniqid('input_'); $progressId = uniqid('progress_'); $filesId = uniqid('files_'); $inputOptions = [ 'id' => $inputId, 'data-progress-id' => $progressId, 'data-files-id' => $filesId, 'data-fileupload-url' => $url, 'data-fileupload-maxfilesize' => $maxfilesize, 'data-fileupload-acceptfiletypes' => $acceptfiletypes, 'data-fileupload-redirecturl' => $redirecturl ]; $optionsDefault = $this->_getOptionsForElem('upload.inputOpt'); $result = $this->Html->tag( 'span', $btnTitle . $this->input(null, $inputOptions + $optionsDefault), ['class' => 'fileinput-button btn ' . $btnClass] ) . $this->Html->tag('br') . $this->Html->tag('br') . $this->Html->div('progress', $this->Html->div('progress-bar progress-bar-success', ''), ['id' => $progressId]) . $this->Html->tag('hr') . $this->Html->div('files', '', ['id' => $filesId]) . $this->Html->tag('br'); return $result; }
[ "public", "function", "upload", "(", "$", "url", "=", "null", ",", "$", "maxfilesize", "=", "0", ",", "$", "acceptfiletypes", "=", "null", ",", "$", "redirecturl", "=", "null", ",", "$", "btnTitle", "=", "null", ",", "$", "btnClass", "=", "null", ")"...
Creates a upload input widget. @param string $url URL for upload @param int $maxfilesize Maximum file size for upload, bytes. @param string $acceptfiletypes PCRE for checking uploaded file, e.g.: (\.|\/)(jpe?g)$. @param string $redirecturl URL for redirect on successful upload. @param string $btnTitle Title of upload button. @param string $btnClass Class of upload button. @return string An HTML text input element. @see {@link https://blueimp.github.io/jQuery-File-Upload} File Upload
[ "Creates", "a", "upload", "input", "widget", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L785-L822
train
anklimsk/cakephp-theme
View/Helper/ExtBs3FormHelper.php
ExtBs3FormHelper.hiddenFields
public function hiddenFields($hiddenFields = null) { if (empty($hiddenFields)) { return null; } if (!is_array($hiddenFields)) { $hiddenFields = [$hiddenFields]; } $result = ''; $options = ['type' => 'hidden']; foreach ($hiddenFields as $hiddenField) { $result .= $this->input($hiddenField, $options); if ($this->isFieldError($hiddenField)) { $result .= $this->Html->div( 'form-group has-error', $this->error($hiddenField, null, ['class' => 'help-block']) ); } } return $result; }
php
public function hiddenFields($hiddenFields = null) { if (empty($hiddenFields)) { return null; } if (!is_array($hiddenFields)) { $hiddenFields = [$hiddenFields]; } $result = ''; $options = ['type' => 'hidden']; foreach ($hiddenFields as $hiddenField) { $result .= $this->input($hiddenField, $options); if ($this->isFieldError($hiddenField)) { $result .= $this->Html->div( 'form-group has-error', $this->error($hiddenField, null, ['class' => 'help-block']) ); } } return $result; }
[ "public", "function", "hiddenFields", "(", "$", "hiddenFields", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "hiddenFields", ")", ")", "{", "return", "null", ";", "}", "if", "(", "!", "is_array", "(", "$", "hiddenFields", ")", ")", "{", "$", ...
Create hidden fields with validation error message. @param array|string $hiddenFields List of hidden fields name, like this "Modelname.fieldname" @return string|null An HTML hidden input elements with error message block.
[ "Create", "hidden", "fields", "with", "validation", "error", "message", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/ExtBs3FormHelper.php#L831-L853
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Repositories/AccountType/EloquentAccountType.php
EloquentAccountType.create
public function create(array $data) { $AccountType = new AccountType(); $AccountType->setConnection($this->databaseConnectionName); $AccountType->fill($data)->save(); return $AccountType; }
php
public function create(array $data) { $AccountType = new AccountType(); $AccountType->setConnection($this->databaseConnectionName); $AccountType->fill($data)->save(); return $AccountType; }
[ "public", "function", "create", "(", "array", "$", "data", ")", "{", "$", "AccountType", "=", "new", "AccountType", "(", ")", ";", "$", "AccountType", "->", "setConnection", "(", "$", "this", "->", "databaseConnectionName", ")", ";", "$", "AccountType", "-...
Create a new account type @param array $data An array as follows: array('name'=>$name, 'pl_bs_category'=>$plBsCategory, 'deferral_method'=>$deferralMethod, 'lang_key'=>$langKey, 'organization_id'=>$organizationId ); @return boolean
[ "Create", "a", "new", "account", "type" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Repositories/AccountType/EloquentAccountType.php#L88-L95
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Repositories/AccountType/EloquentAccountType.php
EloquentAccountType.update
public function update(array $data, $AccountType = null) { if(empty($AccountType)) { $AccountType = $this->byId($data['id']); } foreach ($data as $key => $value) { $AccountType->$key = $value; } return $AccountType->save(); }
php
public function update(array $data, $AccountType = null) { if(empty($AccountType)) { $AccountType = $this->byId($data['id']); } foreach ($data as $key => $value) { $AccountType->$key = $value; } return $AccountType->save(); }
[ "public", "function", "update", "(", "array", "$", "data", ",", "$", "AccountType", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "AccountType", ")", ")", "{", "$", "AccountType", "=", "$", "this", "->", "byId", "(", "$", "data", "[", "'id'"...
Update an existing account type @param array $data An array as follows: array('name'=>$name, 'pl_bs_category'=>$plBsCategory, 'deferral_method'=>$deferralMethod, 'lang_key'=>$langKey, 'organization_id'=>$organizationId ); @param Mgallegos\DecimaAccounting\AccountType $AccountType @return boolean
[ "Update", "an", "existing", "account", "type" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Repositories/AccountType/EloquentAccountType.php#L109-L122
train
netgen-layouts/layouts-sylius
bundle/EventListener/Shop/ProductShowListener.php
ProductShowListener.onProductShow
public function onProductShow(ResourceControllerEvent $event): void { $product = $event->getSubject(); if (!$product instanceof ProductInterface) { return; } $currentRequest = $this->requestStack->getCurrentRequest(); if ($currentRequest instanceof Request) { $currentRequest->attributes->set('nglayouts_sylius_product', $product); // We set context here instead in a ContextProvider, since sylius.product.show // event happens too late, after onKernelRequest event has already been executed $this->context->set('sylius_product_id', (int) $product->getId()); } }
php
public function onProductShow(ResourceControllerEvent $event): void { $product = $event->getSubject(); if (!$product instanceof ProductInterface) { return; } $currentRequest = $this->requestStack->getCurrentRequest(); if ($currentRequest instanceof Request) { $currentRequest->attributes->set('nglayouts_sylius_product', $product); // We set context here instead in a ContextProvider, since sylius.product.show // event happens too late, after onKernelRequest event has already been executed $this->context->set('sylius_product_id', (int) $product->getId()); } }
[ "public", "function", "onProductShow", "(", "ResourceControllerEvent", "$", "event", ")", ":", "void", "{", "$", "product", "=", "$", "event", "->", "getSubject", "(", ")", ";", "if", "(", "!", "$", "product", "instanceof", "ProductInterface", ")", "{", "r...
Sets the currently displayed product to the request, to be able to match with layout resolver.
[ "Sets", "the", "currently", "displayed", "product", "to", "the", "request", "to", "be", "able", "to", "match", "with", "layout", "resolver", "." ]
a261f1b312cc7e18ac48e2c5ff19775672f60947
https://github.com/netgen-layouts/layouts-sylius/blob/a261f1b312cc7e18ac48e2c5ff19775672f60947/bundle/EventListener/Shop/ProductShowListener.php#L41-L55
train
CottaCush/yii2-widgets
src/Helpers/Html.php
Html.svgImg
public static function svgImg($src, $options = []) { $fallback = ArrayHelper::getValue($options, 'fallback', true); $fallbackExt = ArrayHelper::getValue($options, 'fallbackExt', 'png'); if ($fallback) { if (is_bool($fallback) && is_string($src)) { $fallback = rtrim($src, 'svg') . $fallbackExt; $options['onerror'] = "this.src = '$fallback'; this.onerror = '';"; } else if (is_string($fallback)) { $options['onerror'] = "this.src = '$fallback'; this.onerror = '';"; } } return self::img($src, $options); }
php
public static function svgImg($src, $options = []) { $fallback = ArrayHelper::getValue($options, 'fallback', true); $fallbackExt = ArrayHelper::getValue($options, 'fallbackExt', 'png'); if ($fallback) { if (is_bool($fallback) && is_string($src)) { $fallback = rtrim($src, 'svg') . $fallbackExt; $options['onerror'] = "this.src = '$fallback'; this.onerror = '';"; } else if (is_string($fallback)) { $options['onerror'] = "this.src = '$fallback'; this.onerror = '';"; } } return self::img($src, $options); }
[ "public", "static", "function", "svgImg", "(", "$", "src", ",", "$", "options", "=", "[", "]", ")", "{", "$", "fallback", "=", "ArrayHelper", "::", "getValue", "(", "$", "options", ",", "'fallback'", ",", "true", ")", ";", "$", "fallbackExt", "=", "A...
Add an SVG image with the option of providing a fallback image. This is useful when you want to use SVG images, but still provide fallback support for browsers that don't support SVG, like IE8 and below. @param array|string $src the source of the element. To be processed by [[Url::to()]] @param array $options options to be passed into the image tag, including two special properties: - 'fallback': bool|string the fallback image to use. If set to true, replace the image url extension with fallbackExt. - 'fallbackExt' string the fallback extension, default is 'png'. @return string @see YiiHtml::img()
[ "Add", "an", "SVG", "image", "with", "the", "option", "of", "providing", "a", "fallback", "image", ".", "This", "is", "useful", "when", "you", "want", "to", "use", "SVG", "images", "but", "still", "provide", "fallback", "support", "for", "browsers", "that"...
e13c09e8d78e3a01b3d64cdb53abba9d41db6277
https://github.com/CottaCush/yii2-widgets/blob/e13c09e8d78e3a01b3d64cdb53abba9d41db6277/src/Helpers/Html.php#L98-L113
train
stanislav-web/PhalconSonar
src/Sonar/Services/SocketService.php
SocketService.run
public function run() { if(!$this->server) { try { // initialize socket server $this->server = new AppServer($this->config->socket->host, $this->config->socket->port); // create application with dependencies $app = new Sonar( new StorageService($this->config->storage), new QueueService($this->config->beanstalk), new GeoService(), new CacheService() ); $this->server->route('/sonar', $app, ['*']); } catch(QueueServiceException $e) { throw new AppServiceException($e->getMessage()); } catch(ConnectionException $e) { throw new SocketServiceException($e->getMessage()); } catch(StorageServiceException $e) { throw new AppServiceException($e->getMessage()); } catch(CacheServiceException $e) { throw new AppServiceException($e->getMessage()); } } if(isset($this->config->storage) === false) { throw new AppServiceException('There is no option `storage` in your configurations'); } $this->server->run(); }
php
public function run() { if(!$this->server) { try { // initialize socket server $this->server = new AppServer($this->config->socket->host, $this->config->socket->port); // create application with dependencies $app = new Sonar( new StorageService($this->config->storage), new QueueService($this->config->beanstalk), new GeoService(), new CacheService() ); $this->server->route('/sonar', $app, ['*']); } catch(QueueServiceException $e) { throw new AppServiceException($e->getMessage()); } catch(ConnectionException $e) { throw new SocketServiceException($e->getMessage()); } catch(StorageServiceException $e) { throw new AppServiceException($e->getMessage()); } catch(CacheServiceException $e) { throw new AppServiceException($e->getMessage()); } } if(isset($this->config->storage) === false) { throw new AppServiceException('There is no option `storage` in your configurations'); } $this->server->run(); }
[ "public", "function", "run", "(", ")", "{", "if", "(", "!", "$", "this", "->", "server", ")", "{", "try", "{", "// initialize socket server", "$", "this", "->", "server", "=", "new", "AppServer", "(", "$", "this", "->", "config", "->", "socket", "->", ...
Run the server application through the WebSocket protocol @throws \Sonar\Exceptions\AppServiceException @throws \Sonar\Exceptions\SocketServiceException @return null
[ "Run", "the", "server", "application", "through", "the", "WebSocket", "protocol" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Services/SocketService.php#L56-L94
train
dazzle-php/throwable
src/Throwable/ErrorHandler.php
ErrorHandler.handleError
public static function handleError($code, $message, $file, $line) { $list = static::getSystemError($code); $name = $list[0]; $type = $list[1]; $message = "\"$message\" in $file:$line"; switch ($type) { case static::E_NOTICE: throw new NoticeError($message); case static::E_WARNING: throw new WarningError($message); case static::E_ERROR: throw new FatalError($message); default: return; } }
php
public static function handleError($code, $message, $file, $line) { $list = static::getSystemError($code); $name = $list[0]; $type = $list[1]; $message = "\"$message\" in $file:$line"; switch ($type) { case static::E_NOTICE: throw new NoticeError($message); case static::E_WARNING: throw new WarningError($message); case static::E_ERROR: throw new FatalError($message); default: return; } }
[ "public", "static", "function", "handleError", "(", "$", "code", ",", "$", "message", ",", "$", "file", ",", "$", "line", ")", "{", "$", "list", "=", "static", "::", "getSystemError", "(", "$", "code", ")", ";", "$", "name", "=", "$", "list", "[", ...
Invoke default Error Handler. @param int $code @param string $message @param string $file @param int $line @throws FatalError @throws NoticeError @throws WarningError
[ "Invoke", "default", "Error", "Handler", "." ]
daeec7b8857763765db686412886831704720bd0
https://github.com/dazzle-php/throwable/blob/daeec7b8857763765db686412886831704720bd0/src/Throwable/ErrorHandler.php#L52-L67
train
dazzle-php/throwable
src/Throwable/ErrorHandler.php
ErrorHandler.handleShutdown
public static function handleShutdown($forceKill = false) { $err = error_get_last(); try { static::handleError($err['type'], $err['message'], $err['file'], $err['line']); } catch (\Error $ex) { echo call_user_func(static::$errHandler, $ex) . PHP_EOL; } catch (\Exception $ex) { echo call_user_func(static::$excHandler, $ex) . PHP_EOL; } if ($forceKill) { posix_kill(posix_getpid(), 9); } }
php
public static function handleShutdown($forceKill = false) { $err = error_get_last(); try { static::handleError($err['type'], $err['message'], $err['file'], $err['line']); } catch (\Error $ex) { echo call_user_func(static::$errHandler, $ex) . PHP_EOL; } catch (\Exception $ex) { echo call_user_func(static::$excHandler, $ex) . PHP_EOL; } if ($forceKill) { posix_kill(posix_getpid(), 9); } }
[ "public", "static", "function", "handleShutdown", "(", "$", "forceKill", "=", "false", ")", "{", "$", "err", "=", "error_get_last", "(", ")", ";", "try", "{", "static", "::", "handleError", "(", "$", "err", "[", "'type'", "]", ",", "$", "err", "[", "...
Invoke default Shutdown Handler. @param bool $forceKill
[ "Invoke", "default", "Shutdown", "Handler", "." ]
daeec7b8857763765db686412886831704720bd0
https://github.com/dazzle-php/throwable/blob/daeec7b8857763765db686412886831704720bd0/src/Throwable/ErrorHandler.php#L74-L95
train
GlobalTradingTechnologies/ad-poller
src/Fetch/LdapFetcher.php
LdapFetcher.getInvocationId
public function getInvocationId() { $dsServiceNode = $this->ldap->getNode($this->getRootDse()->getDsServiceName()); $invocationId = bin2hex($dsServiceNode->getAttribute('invocationId', 0)); return $invocationId; }
php
public function getInvocationId() { $dsServiceNode = $this->ldap->getNode($this->getRootDse()->getDsServiceName()); $invocationId = bin2hex($dsServiceNode->getAttribute('invocationId', 0)); return $invocationId; }
[ "public", "function", "getInvocationId", "(", ")", "{", "$", "dsServiceNode", "=", "$", "this", "->", "ldap", "->", "getNode", "(", "$", "this", "->", "getRootDse", "(", ")", "->", "getDsServiceName", "(", ")", ")", ";", "$", "invocationId", "=", "bin2he...
Returns current invocation id @return string
[ "Returns", "current", "invocation", "id" ]
c90073b13a6963970e70af67c6439dfe8c48739e
https://github.com/GlobalTradingTechnologies/ad-poller/blob/c90073b13a6963970e70af67c6439dfe8c48739e/src/Fetch/LdapFetcher.php#L148-L154
train
GlobalTradingTechnologies/ad-poller
src/Fetch/LdapFetcher.php
LdapFetcher.fullFetch
public function fullFetch($uSNChangedTo) { $searchFilter = Filter::andFilter( Filter::greaterOrEqual('uSNChanged', 0), Filter::lessOrEqual('uSNChanged', $uSNChangedTo) ); if ($this->fullSyncEntryFilter) { $searchFilter = $searchFilter->addAnd($this->fullSyncEntryFilter); } $entries = $this->search($searchFilter); return $entries; }
php
public function fullFetch($uSNChangedTo) { $searchFilter = Filter::andFilter( Filter::greaterOrEqual('uSNChanged', 0), Filter::lessOrEqual('uSNChanged', $uSNChangedTo) ); if ($this->fullSyncEntryFilter) { $searchFilter = $searchFilter->addAnd($this->fullSyncEntryFilter); } $entries = $this->search($searchFilter); return $entries; }
[ "public", "function", "fullFetch", "(", "$", "uSNChangedTo", ")", "{", "$", "searchFilter", "=", "Filter", "::", "andFilter", "(", "Filter", "::", "greaterOrEqual", "(", "'uSNChanged'", ",", "0", ")", ",", "Filter", "::", "lessOrEqual", "(", "'uSNChanged'", ...
Performs full fetch @param integer $uSNChangedTo max usnChanged value to restrict objects search @return array list of fetched entries
[ "Performs", "full", "fetch" ]
c90073b13a6963970e70af67c6439dfe8c48739e
https://github.com/GlobalTradingTechnologies/ad-poller/blob/c90073b13a6963970e70af67c6439dfe8c48739e/src/Fetch/LdapFetcher.php#L163-L177
train
GlobalTradingTechnologies/ad-poller
src/Fetch/LdapFetcher.php
LdapFetcher.incrementalFetch
public function incrementalFetch($uSNChangedFrom, $uSNChangedTo, $detectDeleted = false) { // fetch changed $changedFilter = Filter::andFilter( Filter::greaterOrEqual('uSNChanged', $uSNChangedFrom), Filter::lessOrEqual('uSNChanged', $uSNChangedTo) ); if ($this->incrementalSyncEntryFilter) { $changedFilter = $changedFilter->addAnd($this->incrementalSyncEntryFilter); } $changed = $this->search($changedFilter); // fetch deleted $deleted = []; if ($detectDeleted) { $defaultNamingContext = $this->getRootDse()->getDefaultNamingContext(); $options = $this->ldap->getOptions(); $originalHost = isset($options['host']) ? $options['host'] : ''; $hostForDeleted = rtrim($originalHost, "/") . "/" .urlencode( sprintf("<WKGUID=%s,%s>", self::WK_GUID_DELETED_OBJECTS_CONTAINER_W, $defaultNamingContext) ) ; // hack that workarounds zendframework/zend-ldap connection issues. // should be removed after resolution of https://github.com/zendframework/zend-ldap/pull/69 if (!preg_match('~^ldap(?:i|s)?://~', $hostForDeleted)) { $schema = "ldap://"; if ((isset($options['port']) && $options['port'] == 636) || (isset($options['useSsl']) && $options['useSsl'] == true)) { $schema = "ldaps://"; } $hostForDeleted = $schema.$hostForDeleted; } // end of hack $options['host'] = $hostForDeleted; // force reconnection for search of deleted entries $this->ldap->setOptions($options); $this->ldap->disconnect(); $deletedFilter = Filter::andFilter( Filter::equals('isDeleted', 'TRUE'), Filter::greaterOrEqual('uSNChanged', $uSNChangedFrom), Filter::lessOrEqual('uSNChanged', $uSNChangedTo) ); if ($this->deletedSyncEntryFilter) { $deletedFilter = $deletedFilter->addAnd($this->deletedSyncEntryFilter); } $deleted = $this->search($deletedFilter); } return [$changed, $deleted]; }
php
public function incrementalFetch($uSNChangedFrom, $uSNChangedTo, $detectDeleted = false) { // fetch changed $changedFilter = Filter::andFilter( Filter::greaterOrEqual('uSNChanged', $uSNChangedFrom), Filter::lessOrEqual('uSNChanged', $uSNChangedTo) ); if ($this->incrementalSyncEntryFilter) { $changedFilter = $changedFilter->addAnd($this->incrementalSyncEntryFilter); } $changed = $this->search($changedFilter); // fetch deleted $deleted = []; if ($detectDeleted) { $defaultNamingContext = $this->getRootDse()->getDefaultNamingContext(); $options = $this->ldap->getOptions(); $originalHost = isset($options['host']) ? $options['host'] : ''; $hostForDeleted = rtrim($originalHost, "/") . "/" .urlencode( sprintf("<WKGUID=%s,%s>", self::WK_GUID_DELETED_OBJECTS_CONTAINER_W, $defaultNamingContext) ) ; // hack that workarounds zendframework/zend-ldap connection issues. // should be removed after resolution of https://github.com/zendframework/zend-ldap/pull/69 if (!preg_match('~^ldap(?:i|s)?://~', $hostForDeleted)) { $schema = "ldap://"; if ((isset($options['port']) && $options['port'] == 636) || (isset($options['useSsl']) && $options['useSsl'] == true)) { $schema = "ldaps://"; } $hostForDeleted = $schema.$hostForDeleted; } // end of hack $options['host'] = $hostForDeleted; // force reconnection for search of deleted entries $this->ldap->setOptions($options); $this->ldap->disconnect(); $deletedFilter = Filter::andFilter( Filter::equals('isDeleted', 'TRUE'), Filter::greaterOrEqual('uSNChanged', $uSNChangedFrom), Filter::lessOrEqual('uSNChanged', $uSNChangedTo) ); if ($this->deletedSyncEntryFilter) { $deletedFilter = $deletedFilter->addAnd($this->deletedSyncEntryFilter); } $deleted = $this->search($deletedFilter); } return [$changed, $deleted]; }
[ "public", "function", "incrementalFetch", "(", "$", "uSNChangedFrom", ",", "$", "uSNChangedTo", ",", "$", "detectDeleted", "=", "false", ")", "{", "// fetch changed", "$", "changedFilter", "=", "Filter", "::", "andFilter", "(", "Filter", "::", "greaterOrEqual", ...
Performs incremental fetch @param integer $uSNChangedFrom min usnChanged value to restrict objects search @param integer $uSNChangedTo max usnChanged value to restrict objects search @param bool $detectDeleted whether deleted entries should be fetched or not @return array with following structure: [ $changed, // list of changed entries $deleted // list of deleted entries ]
[ "Performs", "incremental", "fetch" ]
c90073b13a6963970e70af67c6439dfe8c48739e
https://github.com/GlobalTradingTechnologies/ad-poller/blob/c90073b13a6963970e70af67c6439dfe8c48739e/src/Fetch/LdapFetcher.php#L192-L244
train
GlobalTradingTechnologies/ad-poller
src/Fetch/LdapFetcher.php
LdapFetcher.getRootDse
private function getRootDse() { if (!$this->rootDse) { $rootDse = $this->ldap->getRootDse(); if (!$rootDse instanceof ActiveDirectory) { throw new UnsupportedRootDseException($rootDse); } $this->rootDse = $rootDse; } return $this->rootDse; }
php
private function getRootDse() { if (!$this->rootDse) { $rootDse = $this->ldap->getRootDse(); if (!$rootDse instanceof ActiveDirectory) { throw new UnsupportedRootDseException($rootDse); } $this->rootDse = $rootDse; } return $this->rootDse; }
[ "private", "function", "getRootDse", "(", ")", "{", "if", "(", "!", "$", "this", "->", "rootDse", ")", "{", "$", "rootDse", "=", "$", "this", "->", "ldap", "->", "getRootDse", "(", ")", ";", "if", "(", "!", "$", "rootDse", "instanceof", "ActiveDirect...
Returns current AD root dse @return ActiveDirectory
[ "Returns", "current", "AD", "root", "dse" ]
c90073b13a6963970e70af67c6439dfe8c48739e
https://github.com/GlobalTradingTechnologies/ad-poller/blob/c90073b13a6963970e70af67c6439dfe8c48739e/src/Fetch/LdapFetcher.php#L251-L262
train
GlobalTradingTechnologies/ad-poller
src/Fetch/LdapFetcher.php
LdapFetcher.setupEntryFilter
private function setupEntryFilter($entryFilter) { if ($entryFilter == null) { return null; } if (is_string($entryFilter)) { $filter = new Filter\StringFilter($entryFilter); } elseif ($entryFilter instanceof AbstractFilter) { $filter = $entryFilter; } else { throw new InvalidArgumentException( sprintf( 'baseEntryFilter argument must be either instance of %s or string. %s given', AbstractFilter::class, gettype($entryFilter) ) ); } return $filter; }
php
private function setupEntryFilter($entryFilter) { if ($entryFilter == null) { return null; } if (is_string($entryFilter)) { $filter = new Filter\StringFilter($entryFilter); } elseif ($entryFilter instanceof AbstractFilter) { $filter = $entryFilter; } else { throw new InvalidArgumentException( sprintf( 'baseEntryFilter argument must be either instance of %s or string. %s given', AbstractFilter::class, gettype($entryFilter) ) ); } return $filter; }
[ "private", "function", "setupEntryFilter", "(", "$", "entryFilter", ")", "{", "if", "(", "$", "entryFilter", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "is_string", "(", "$", "entryFilter", ")", ")", "{", "$", "filter", "=", "new", ...
Validates specified zend ldap filter and cast it to AbstractFilter implementation @param string|AbstractFilter $entryFilter zend ldap filter @return AbstractFilter|null @throws InvalidArgumentException in case of invalid filter
[ "Validates", "specified", "zend", "ldap", "filter", "and", "cast", "it", "to", "AbstractFilter", "implementation" ]
c90073b13a6963970e70af67c6439dfe8c48739e
https://github.com/GlobalTradingTechnologies/ad-poller/blob/c90073b13a6963970e70af67c6439dfe8c48739e/src/Fetch/LdapFetcher.php#L273-L294
train
GlobalTradingTechnologies/ad-poller
src/Fetch/LdapFetcher.php
LdapFetcher.search
private function search(AbstractFilter $filter) { if ($this->ldapSearchOptions) { $ldapResource = $this->ldap->getResource(); foreach ($this->ldapSearchOptions as $name => $options) { ldap_set_option($ldapResource, $name, $options); } } return $this->ldap->searchEntries($filter, null, Ldap::SEARCH_SCOPE_SUB, $this->entryAttributesToFetch); }
php
private function search(AbstractFilter $filter) { if ($this->ldapSearchOptions) { $ldapResource = $this->ldap->getResource(); foreach ($this->ldapSearchOptions as $name => $options) { ldap_set_option($ldapResource, $name, $options); } } return $this->ldap->searchEntries($filter, null, Ldap::SEARCH_SCOPE_SUB, $this->entryAttributesToFetch); }
[ "private", "function", "search", "(", "AbstractFilter", "$", "filter", ")", "{", "if", "(", "$", "this", "->", "ldapSearchOptions", ")", "{", "$", "ldapResource", "=", "$", "this", "->", "ldap", "->", "getResource", "(", ")", ";", "foreach", "(", "$", ...
Performs ldap search by filter @param AbstractFilter $filter ldap filter @return array list of fetched entries
[ "Performs", "ldap", "search", "by", "filter" ]
c90073b13a6963970e70af67c6439dfe8c48739e
https://github.com/GlobalTradingTechnologies/ad-poller/blob/c90073b13a6963970e70af67c6439dfe8c48739e/src/Fetch/LdapFetcher.php#L303-L313
train
honeybee/trellis
src/Runtime/ValueHolder/ValueHolder.php
ValueHolder.setValue
public function setValue($value, EntityInterface $entity = null) { $attribute_validator = $this->getAttribute()->getValidator(); $validation_result = $attribute_validator->validate($value, $entity); if ($validation_result->getSeverity() <= IncidentInterface::NOTICE) { $previous_native_value = $this->toNative(); $this->value = $validation_result->getSanitizedValue(); if (!$this->sameValueAs($previous_native_value)) { $value_changed_event = $this->createValueHolderChangedEvent($previous_native_value); $this->propagateValueChangedEvent($value_changed_event); } if ($this->value instanceof CollectionInterface) { $this->value->addListener($this); } if ($this->value instanceof EntityList) { $this->value->addEntityChangedListener($this); } } return $validation_result; }
php
public function setValue($value, EntityInterface $entity = null) { $attribute_validator = $this->getAttribute()->getValidator(); $validation_result = $attribute_validator->validate($value, $entity); if ($validation_result->getSeverity() <= IncidentInterface::NOTICE) { $previous_native_value = $this->toNative(); $this->value = $validation_result->getSanitizedValue(); if (!$this->sameValueAs($previous_native_value)) { $value_changed_event = $this->createValueHolderChangedEvent($previous_native_value); $this->propagateValueChangedEvent($value_changed_event); } if ($this->value instanceof CollectionInterface) { $this->value->addListener($this); } if ($this->value instanceof EntityList) { $this->value->addEntityChangedListener($this); } } return $validation_result; }
[ "public", "function", "setValue", "(", "$", "value", ",", "EntityInterface", "$", "entity", "=", "null", ")", "{", "$", "attribute_validator", "=", "$", "this", "->", "getAttribute", "(", ")", "->", "getValidator", "(", ")", ";", "$", "validation_result", ...
Sets the valueholder's value. @param mixed $value @param EntityInterface $entity @return ResultInterface
[ "Sets", "the", "valueholder", "s", "value", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/ValueHolder/ValueHolder.php#L117-L140
train
honeybee/trellis
src/Runtime/ValueHolder/ValueHolder.php
ValueHolder.sameValueAs
public function sameValueAs($other_value) { $null_value = $this->attribute->getNullValue(); if ($null_value === $this->getValue() && $null_value === $other_value) { return true; } $validation_result = $this->getAttribute()->getValidator()->validate($other_value); if ($validation_result->getSeverity() !== IncidentInterface::SUCCESS) { return false; } return $this->valueEquals($validation_result->getSanitizedValue()); }
php
public function sameValueAs($other_value) { $null_value = $this->attribute->getNullValue(); if ($null_value === $this->getValue() && $null_value === $other_value) { return true; } $validation_result = $this->getAttribute()->getValidator()->validate($other_value); if ($validation_result->getSeverity() !== IncidentInterface::SUCCESS) { return false; } return $this->valueEquals($validation_result->getSanitizedValue()); }
[ "public", "function", "sameValueAs", "(", "$", "other_value", ")", "{", "$", "null_value", "=", "$", "this", "->", "attribute", "->", "getNullValue", "(", ")", ";", "if", "(", "$", "null_value", "===", "$", "this", "->", "getValue", "(", ")", "&&", "$"...
Tells whether a specific ValueHolderInterface instance's value is considered equal to the given value. @param mixed $other_value @return boolean
[ "Tells", "whether", "a", "specific", "ValueHolderInterface", "instance", "s", "value", "is", "considered", "equal", "to", "the", "given", "value", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/ValueHolder/ValueHolder.php#L172-L185
train
honeybee/trellis
src/Runtime/ValueHolder/ValueHolder.php
ValueHolder.isEqualTo
public function isEqualTo(ValueHolderInterface $other_value_holder) { if (get_class($this) !== get_class($other_value_holder)) { return false; } return $this->sameValueAs($other_value_holder->getValue()); }
php
public function isEqualTo(ValueHolderInterface $other_value_holder) { if (get_class($this) !== get_class($other_value_holder)) { return false; } return $this->sameValueAs($other_value_holder->getValue()); }
[ "public", "function", "isEqualTo", "(", "ValueHolderInterface", "$", "other_value_holder", ")", "{", "if", "(", "get_class", "(", "$", "this", ")", "!==", "get_class", "(", "$", "other_value_holder", ")", ")", "{", "return", "false", ";", "}", "return", "$",...
Tells whether a valueholder is considered being equal to the given valueholder. That is, class and value are the same. The attribute and entity may be different. @param ValueHolderInterface $other_value_holder @return boolean
[ "Tells", "whether", "a", "valueholder", "is", "considered", "being", "equal", "to", "the", "given", "valueholder", ".", "That", "is", "class", "and", "value", "are", "the", "same", ".", "The", "attribute", "and", "entity", "may", "be", "different", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/ValueHolder/ValueHolder.php#L196-L203
train
honeybee/trellis
src/Runtime/ValueHolder/ValueHolder.php
ValueHolder.addValueChangedListener
public function addValueChangedListener(ValueChangedListenerInterface $listener) { if (!$this->listeners->hasItem($listener)) { $this->listeners->push($listener); } }
php
public function addValueChangedListener(ValueChangedListenerInterface $listener) { if (!$this->listeners->hasItem($listener)) { $this->listeners->push($listener); } }
[ "public", "function", "addValueChangedListener", "(", "ValueChangedListenerInterface", "$", "listener", ")", "{", "if", "(", "!", "$", "this", "->", "listeners", "->", "hasItem", "(", "$", "listener", ")", ")", "{", "$", "this", "->", "listeners", "->", "pus...
Registers a given listener as a recipient of value changed events. @param ValueChangedListenerInterface $listener
[ "Registers", "a", "given", "listener", "as", "a", "recipient", "of", "value", "changed", "events", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/ValueHolder/ValueHolder.php#L210-L215
train
honeybee/trellis
src/Runtime/ValueHolder/ValueHolder.php
ValueHolder.removedValueChangedListener
public function removedValueChangedListener(ValueChangedListenerInterface $listener) { if ($this->listeners->hasItem($listener)) { $this->listeners->removeItem($listener); } }
php
public function removedValueChangedListener(ValueChangedListenerInterface $listener) { if ($this->listeners->hasItem($listener)) { $this->listeners->removeItem($listener); } }
[ "public", "function", "removedValueChangedListener", "(", "ValueChangedListenerInterface", "$", "listener", ")", "{", "if", "(", "$", "this", "->", "listeners", "->", "hasItem", "(", "$", "listener", ")", ")", "{", "$", "this", "->", "listeners", "->", "remove...
Removes a given listener as from our list of value-changed listeners. @param ValueChangedListenerInterface $listener
[ "Removes", "a", "given", "listener", "as", "from", "our", "list", "of", "value", "-", "changed", "listeners", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/ValueHolder/ValueHolder.php#L222-L227
train
honeybee/trellis
src/Runtime/ValueHolder/ValueHolder.php
ValueHolder.onEntityChanged
public function onEntityChanged(EntityChangedEvent $embedded_entity_event) { $value_changed_event = $embedded_entity_event->getValueChangedEvent(); $this->propagateValueChangedEvent( new ValueChangedEvent( array( 'attribute_name' => $value_changed_event->getAttributeName(), 'prev_value' => $value_changed_event->getOldValue(), 'value' => $value_changed_event->getNewValue(), 'embedded_event' => $embedded_entity_event ) ) ); }
php
public function onEntityChanged(EntityChangedEvent $embedded_entity_event) { $value_changed_event = $embedded_entity_event->getValueChangedEvent(); $this->propagateValueChangedEvent( new ValueChangedEvent( array( 'attribute_name' => $value_changed_event->getAttributeName(), 'prev_value' => $value_changed_event->getOldValue(), 'value' => $value_changed_event->getNewValue(), 'embedded_event' => $embedded_entity_event ) ) ); }
[ "public", "function", "onEntityChanged", "(", "EntityChangedEvent", "$", "embedded_entity_event", ")", "{", "$", "value_changed_event", "=", "$", "embedded_entity_event", "->", "getValueChangedEvent", "(", ")", ";", "$", "this", "->", "propagateValueChangedEvent", "(", ...
Handles entity changed events that are sent by our embedd entity. @param EntityChangedEvent $embedded_entity_event
[ "Handles", "entity", "changed", "events", "that", "are", "sent", "by", "our", "embedd", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/ValueHolder/ValueHolder.php#L247-L261
train
honeybee/trellis
src/Runtime/ValueHolder/ValueHolder.php
ValueHolder.propagateValueChangedEvent
protected function propagateValueChangedEvent(ValueChangedEvent $event) { foreach ($this->listeners as $listener) { $listener->onValueChanged($event); } }
php
protected function propagateValueChangedEvent(ValueChangedEvent $event) { foreach ($this->listeners as $listener) { $listener->onValueChanged($event); } }
[ "protected", "function", "propagateValueChangedEvent", "(", "ValueChangedEvent", "$", "event", ")", "{", "foreach", "(", "$", "this", "->", "listeners", "as", "$", "listener", ")", "{", "$", "listener", "->", "onValueChanged", "(", "$", "event", ")", ";", "}...
Propagates a given value changed event to all corresponding listeners. @param ValueChangedEvent $event
[ "Propagates", "a", "given", "value", "changed", "event", "to", "all", "corresponding", "listeners", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/ValueHolder/ValueHolder.php#L278-L283
train
honeybee/trellis
src/Runtime/ValueHolder/ValueHolder.php
ValueHolder.createValueHolderChangedEvent
protected function createValueHolderChangedEvent($prev_value, EventInterface $embedded_event = null) { return new ValueChangedEvent( array( 'attribute_name' => $this->getAttribute()->getName(), 'prev_value' => $prev_value, 'value' => $this->toNative(), 'embedded_event' => $embedded_event ) ); }
php
protected function createValueHolderChangedEvent($prev_value, EventInterface $embedded_event = null) { return new ValueChangedEvent( array( 'attribute_name' => $this->getAttribute()->getName(), 'prev_value' => $prev_value, 'value' => $this->toNative(), 'embedded_event' => $embedded_event ) ); }
[ "protected", "function", "createValueHolderChangedEvent", "(", "$", "prev_value", ",", "EventInterface", "$", "embedded_event", "=", "null", ")", "{", "return", "new", "ValueChangedEvent", "(", "array", "(", "'attribute_name'", "=>", "$", "this", "->", "getAttribute...
Create a new value-changed event instance from the given info. @param mixed $prev_value @param EventInterface $embedded_event
[ "Create", "a", "new", "value", "-", "changed", "event", "instance", "from", "the", "given", "info", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/ValueHolder/ValueHolder.php#L291-L301
train
pauci/cqrs
src/HandlerResolver/EventHandlerResolver.php
EventHandlerResolver.resolveHandlingMethod
protected function resolveHandlingMethod($eventType) { // Remove namespace $pos = strrpos($eventType, '\\'); if ($pos !== false) { $eventType = substr($eventType, $pos + 1); } // Remove "Event" suffix if (substr($eventType, -5) === 'Event') { $eventType = substr($eventType, 0, -5); } return 'on' . $eventType; }
php
protected function resolveHandlingMethod($eventType) { // Remove namespace $pos = strrpos($eventType, '\\'); if ($pos !== false) { $eventType = substr($eventType, $pos + 1); } // Remove "Event" suffix if (substr($eventType, -5) === 'Event') { $eventType = substr($eventType, 0, -5); } return 'on' . $eventType; }
[ "protected", "function", "resolveHandlingMethod", "(", "$", "eventType", ")", "{", "// Remove namespace", "$", "pos", "=", "strrpos", "(", "$", "eventType", ",", "'\\\\'", ")", ";", "if", "(", "$", "pos", "!==", "false", ")", "{", "$", "eventType", "=", ...
Derives event handling method name from event type @param string $eventType @return string
[ "Derives", "event", "handling", "method", "name", "from", "event", "type" ]
951f2a3118b5f7d93b1e173952490f4a15b8f3fb
https://github.com/pauci/cqrs/blob/951f2a3118b5f7d93b1e173952490f4a15b8f3fb/src/HandlerResolver/EventHandlerResolver.php#L30-L44
train
honeybee/trellis
src/Common/Configurable.php
Configurable.setOptions
protected function setOptions($options) { if (!$options instanceof OptionsInterface) { $options = is_array($options) ? $options : []; $options = new Options($options); } $this->options = $options; }
php
protected function setOptions($options) { if (!$options instanceof OptionsInterface) { $options = is_array($options) ? $options : []; $options = new Options($options); } $this->options = $options; }
[ "protected", "function", "setOptions", "(", "$", "options", ")", "{", "if", "(", "!", "$", "options", "instanceof", "OptionsInterface", ")", "{", "$", "options", "=", "is_array", "(", "$", "options", ")", "?", "$", "options", ":", "[", "]", ";", "$", ...
Sets the given options. @param array|Options $options options to set
[ "Sets", "the", "given", "options", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Common/Configurable.php#L109-L117
train
smartboxgroup/core-bundle
Validation/ValidatorWithExclusion.php
ValidatorWithExclusion.shouldSkip
protected function shouldSkip($object, $propertyPath) { if (!\is_object($object) && !\is_array($object)) { return false; } if (!empty($propertyPath)) { $parts = \explode('.', $propertyPath); $accessor = new PropertyAccessor(); $parent = $object; foreach ($parts as $childSubPath) { if ($parent instanceof EntityInterface && $this->shouldSkipObjectProperty($parent, $childSubPath)) { return true; } if ($accessor->isReadable($parent, $childSubPath)) { $parent = $accessor->getValue($parent, $childSubPath); } else { return false; } } } return false; }
php
protected function shouldSkip($object, $propertyPath) { if (!\is_object($object) && !\is_array($object)) { return false; } if (!empty($propertyPath)) { $parts = \explode('.', $propertyPath); $accessor = new PropertyAccessor(); $parent = $object; foreach ($parts as $childSubPath) { if ($parent instanceof EntityInterface && $this->shouldSkipObjectProperty($parent, $childSubPath)) { return true; } if ($accessor->isReadable($parent, $childSubPath)) { $parent = $accessor->getValue($parent, $childSubPath); } else { return false; } } } return false; }
[ "protected", "function", "shouldSkip", "(", "$", "object", ",", "$", "propertyPath", ")", "{", "if", "(", "!", "\\", "is_object", "(", "$", "object", ")", "&&", "!", "\\", "is_array", "(", "$", "object", ")", ")", "{", "return", "false", ";", "}", ...
Returns true if a property of a given object should be ignored in the validation. @param $object @param $propertyPath @return bool
[ "Returns", "true", "if", "a", "property", "of", "a", "given", "object", "should", "be", "ignored", "in", "the", "validation", "." ]
88ffc0af6631efbea90425454ce0bce0c753504e
https://github.com/smartboxgroup/core-bundle/blob/88ffc0af6631efbea90425454ce0bce0c753504e/Validation/ValidatorWithExclusion.php#L46-L70
train
mridang/pearify
src/Pearify/UseAs.php
UseAs.getAliasForClassname
public function getAliasForClassname(Classname $class) { foreach ($this->classnames as $c) { if ($c['classname']->equals($class)) { return str_replace('\\', '_', ltrim($class->classname, '\\')); } } return str_replace('\\', '_', ltrim($class->classname, '\\')); }
php
public function getAliasForClassname(Classname $class) { foreach ($this->classnames as $c) { if ($c['classname']->equals($class)) { return str_replace('\\', '_', ltrim($class->classname, '\\')); } } return str_replace('\\', '_', ltrim($class->classname, '\\')); }
[ "public", "function", "getAliasForClassname", "(", "Classname", "$", "class", ")", "{", "foreach", "(", "$", "this", "->", "classnames", "as", "$", "c", ")", "{", "if", "(", "$", "c", "[", "'classname'", "]", "->", "equals", "(", "$", "class", ")", "...
Renamed the given class name by replacing all slashes with underscores for loading using Magento's classloader @param Classname $class the class name object to be renamed @return string the Magento autoloader-compliant class name
[ "Renamed", "the", "given", "class", "name", "by", "replacing", "all", "slashes", "with", "underscores", "for", "loading", "using", "Magento", "s", "classloader" ]
7bc0710beb4165164e07f88b456de47cad8b3002
https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/UseAs.php#L147-L156
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.getParameter
private function getParameter($paramName) { if (array_key_exists($paramName, $_REQUEST)) { return str_replace(FileUtil::Slash().FileUtil::Slash(), FileUtil::Slash(), $_REQUEST[$paramName]); } else { return ""; } }
php
private function getParameter($paramName) { if (array_key_exists($paramName, $_REQUEST)) { return str_replace(FileUtil::Slash().FileUtil::Slash(), FileUtil::Slash(), $_REQUEST[$paramName]); } else { return ""; } }
[ "private", "function", "getParameter", "(", "$", "paramName", ")", "{", "if", "(", "array_key_exists", "(", "$", "paramName", ",", "$", "_REQUEST", ")", ")", "{", "return", "str_replace", "(", "FileUtil", "::", "Slash", "(", ")", ".", "FileUtil", "::", "...
Look for a param name into the HttpContext Request already processed. @access public @param string $paramName Param to be looked for @return string Return the param value if exists or an empty string if doesnt exists
[ "Look", "for", "a", "param", "name", "into", "the", "HttpContext", "Request", "already", "processed", "." ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L342-L352
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.get
public function get($key, $persistent = false) { if ($persistent) { $origKey = $key; $key = "PVALUE.$key"; } $key = strtoupper($key); if (isset($this->_config[$key])) { $value = $this->_config[$key]; if ($value instanceof IProcessParameter) { return $value->getParameter(); } else { return $value; } } elseif ($persistent) { if ($this->get($origKey) != "") $value = $this->get($origKey); else if ($this->getSession($key)) $value = $this->getSession($key); else $value = ""; $this->setSession($key, $value); $this->set($key, $value); return $value; } else { return ""; } }
php
public function get($key, $persistent = false) { if ($persistent) { $origKey = $key; $key = "PVALUE.$key"; } $key = strtoupper($key); if (isset($this->_config[$key])) { $value = $this->_config[$key]; if ($value instanceof IProcessParameter) { return $value->getParameter(); } else { return $value; } } elseif ($persistent) { if ($this->get($origKey) != "") $value = $this->get($origKey); else if ($this->getSession($key)) $value = $this->getSession($key); else $value = ""; $this->setSession($key, $value); $this->set($key, $value); return $value; } else { return ""; } }
[ "public", "function", "get", "(", "$", "key", ",", "$", "persistent", "=", "false", ")", "{", "if", "(", "$", "persistent", ")", "{", "$", "origKey", "=", "$", "key", ";", "$", "key", "=", "\"PVALUE.$key\"", ";", "}", "$", "key", "=", "strtoupper",...
Access the Context collection and returns the value from a key. @access public @return string
[ "Access", "the", "Context", "collection", "and", "returns", "the", "value", "from", "a", "key", "." ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L694-L733
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.authenticatedUser
public function authenticatedUser() { if ($this->IsAuthenticated()) { $user = UserContext::getInstance()->userInfo(); return $user[$this->getUsersDatabase()->getUserTable()->username]; } else { return ""; } }
php
public function authenticatedUser() { if ($this->IsAuthenticated()) { $user = UserContext::getInstance()->userInfo(); return $user[$this->getUsersDatabase()->getUserTable()->username]; } else { return ""; } }
[ "public", "function", "authenticatedUser", "(", ")", "{", "if", "(", "$", "this", "->", "IsAuthenticated", "(", ")", ")", "{", "$", "user", "=", "UserContext", "::", "getInstance", "(", ")", "->", "userInfo", "(", ")", ";", "return", "$", "user", "[", ...
Get the authenticated user name @access public @return string The authenticated username if exists.
[ "Get", "the", "authenticated", "user", "name" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L829-L840
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.MakeLogin
public function MakeLogin($user, $id) { $userObj = $this->getUsersDatabase()->getById($id); UserContext::getInstance()->registerLogin($userObj->toArray()); }
php
public function MakeLogin($user, $id) { $userObj = $this->getUsersDatabase()->getById($id); UserContext::getInstance()->registerLogin($userObj->toArray()); }
[ "public", "function", "MakeLogin", "(", "$", "user", ",", "$", "id", ")", "{", "$", "userObj", "=", "$", "this", "->", "getUsersDatabase", "(", ")", "->", "getById", "(", "$", "id", ")", ";", "UserContext", "::", "getInstance", "(", ")", "->", "regis...
Make login in XMLNuke Engine @access public @param string $user @return void
[ "Make", "login", "in", "XMLNuke", "Engine" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L861-L865
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.AddCollectionToConfig
private function AddCollectionToConfig($collection) { foreach($collection as $key=>$value) { if ($key[0] == '/') $this->_virtualCommand = str_replace('_', '.', substr($key, 1)); $this->addPairToConfig($key, $value); } }
php
private function AddCollectionToConfig($collection) { foreach($collection as $key=>$value) { if ($key[0] == '/') $this->_virtualCommand = str_replace('_', '.', substr($key, 1)); $this->addPairToConfig($key, $value); } }
[ "private", "function", "AddCollectionToConfig", "(", "$", "collection", ")", "{", "foreach", "(", "$", "collection", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "key", "[", "0", "]", "==", "'/'", ")", "$", "this", "->", "_virtualC...
Collection to be added @access public @param array $collection Collection to be added @return void
[ "Collection", "to", "be", "added" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L883-L891
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.AddSessionToConfig
private function AddSessionToConfig($collection) { if (is_array($collection)) { foreach($collection as $key => $value) { $this->addPairToConfig('session.' . $key, $value); } } }
php
private function AddSessionToConfig($collection) { if (is_array($collection)) { foreach($collection as $key => $value) { $this->addPairToConfig('session.' . $key, $value); } } }
[ "private", "function", "AddSessionToConfig", "(", "$", "collection", ")", "{", "if", "(", "is_array", "(", "$", "collection", ")", ")", "{", "foreach", "(", "$", "collection", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "addPairT...
Collection Session to be added @access public @param array $collection Session Collection to be added @return void
[ "Collection", "Session", "to", "be", "added" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L899-L908
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.AddCookieToConfig
private function AddCookieToConfig($collection) { foreach($collection as $key => $value) { $this->addPairToConfig('cookie.' . $key, $value); } }
php
private function AddCookieToConfig($collection) { foreach($collection as $key => $value) { $this->addPairToConfig('cookie.' . $key, $value); } }
[ "private", "function", "AddCookieToConfig", "(", "$", "collection", ")", "{", "foreach", "(", "$", "collection", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "addPairToConfig", "(", "'cookie.'", ".", "$", "key", ",", "$", "value", ...
Cookie Collection to be added @access public @param array $collection Cookie Collection to be added @return void
[ "Cookie", "Collection", "to", "be", "added" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L916-L922
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.redirectUrl
public function redirectUrl($url) { $processor = new ParamProcessor(); $url = $processor->GetFullLink($url); $url = str_replace("&amp;", "&", $url); // IIS running CGI mode has a bug related to POST and header(LOCATION) to the SAME script. // In this environment the behavior expected causes a loop to the same page // To reproduce this behavior comment the this and try use any processpage state class $isBugVersion = stristr(PHP_OS, "win") && stristr($this->get("GATEWAY_INTERFACE"), "cgi") && stristr($this->get("SERVER_SOFTWARE"), "iis"); ob_clean(); if (!$isBugVersion) { header("Location: " . $url); } echo "<html>"; echo "<head>"; echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1;URL=$url\">"; echo "<style type='text/css'> "; echo " #logo{"; echo " width:32px;"; echo " height:32px;"; echo " top: 50%;"; echo " left: 50%;"; echo " margin-top: -16px;"; echo " margin-left: -16px;"; echo " position:absolute;"; echo "} </style>"; echo "</head>"; echo "<h1></h1>"; echo "<div id='logo'><a href='$url'><img src='common/imgs/ajax-loader.gif' border='0' title='If this page does not refresh, Click here' alt='If this page does not refresh, Click here' /></a></div>"; echo "</html>"; exit; }
php
public function redirectUrl($url) { $processor = new ParamProcessor(); $url = $processor->GetFullLink($url); $url = str_replace("&amp;", "&", $url); // IIS running CGI mode has a bug related to POST and header(LOCATION) to the SAME script. // In this environment the behavior expected causes a loop to the same page // To reproduce this behavior comment the this and try use any processpage state class $isBugVersion = stristr(PHP_OS, "win") && stristr($this->get("GATEWAY_INTERFACE"), "cgi") && stristr($this->get("SERVER_SOFTWARE"), "iis"); ob_clean(); if (!$isBugVersion) { header("Location: " . $url); } echo "<html>"; echo "<head>"; echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1;URL=$url\">"; echo "<style type='text/css'> "; echo " #logo{"; echo " width:32px;"; echo " height:32px;"; echo " top: 50%;"; echo " left: 50%;"; echo " margin-top: -16px;"; echo " margin-left: -16px;"; echo " position:absolute;"; echo "} </style>"; echo "</head>"; echo "<h1></h1>"; echo "<div id='logo'><a href='$url'><img src='common/imgs/ajax-loader.gif' border='0' title='If this page does not refresh, Click here' alt='If this page does not refresh, Click here' /></a></div>"; echo "</html>"; exit; }
[ "public", "function", "redirectUrl", "(", "$", "url", ")", "{", "$", "processor", "=", "new", "ParamProcessor", "(", ")", ";", "$", "url", "=", "$", "processor", "->", "GetFullLink", "(", "$", "url", ")", ";", "$", "url", "=", "str_replace", "(", "\"...
Redirect to Url. @access public @param string $url @return void
[ "Redirect", "to", "Url", "." ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L968-L1003
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.getUploadFileNames
public function getUploadFileNames($systemArray=false) { if ($systemArray) { return $_FILES; } else { $ret = array(); foreach($_FILES as $file => $property) { $ret[$file] = $property["name"]; } } return $ret; }
php
public function getUploadFileNames($systemArray=false) { if ($systemArray) { return $_FILES; } else { $ret = array(); foreach($_FILES as $file => $property) { $ret[$file] = $property["name"]; } } return $ret; }
[ "public", "function", "getUploadFileNames", "(", "$", "systemArray", "=", "false", ")", "{", "if", "(", "$", "systemArray", ")", "{", "return", "$", "_FILES", ";", "}", "else", "{", "$", "ret", "=", "array", "(", ")", ";", "foreach", "(", "$", "_FILE...
Return the Field name and the FILENAME for Saving files @param bool $systemArray @return array
[ "Return", "the", "Field", "name", "and", "the", "FILENAME", "for", "Saving", "files" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L1281-L1296
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.processUpload
public function processUpload($filenameProcessor, $useProcessorForName, $field = null) { if (!($filenameProcessor instanceof UploadFilenameProcessor)) { throw new UploadUtilException("processUpload must receive a UploadFilenameProcessor class"); } else if (is_null($field)) { $ret = array(); foreach($_FILES as $file => $property) { $ret[] = $this->processUpload($filenameProcessor, $useProcessorForName, $property); } return $ret; } else if (is_string($field)) { $ret = array(); $ret[] = $this->processUpload($filenameProcessor, $useProcessorForName, $_FILES[$field]); return $ret; } else if (is_array($field)) { if ($useProcessorForName) { $uploadfile = $filenameProcessor->FullQualifiedNameAndPath(); } else { $uploadfile = $filenameProcessor->PathSuggested() . FileUtil::Slash() . $field["name"]; } if (move_uploaded_file($field['tmp_name'], $uploadfile)) { return $uploadfile; } else { $message = "Unknow error: " . $field['error']; switch ($field['error']) { case UPLOAD_ERR_CANT_WRITE: $message = "Can't write"; break; case UPLOAD_ERR_EXTENSION: $message = "Extension is not permitted"; break; case UPLOAD_ERR_FORM_SIZE: $message = "Max post size reached"; break; case UPLOAD_ERR_INI_SIZE: $message = "Max system size reached"; break; case UPLOAD_ERR_NO_FILE: $message = "No file was uploaded"; break; case UPLOAD_ERR_NO_TMP_DIR: $message = "No temp dir"; break; case UPLOAD_ERR_PARTIAL: $message = "The uploaded file was only partially uploaded"; break; } throw new UploadUtilException($message); } } else { throw new UploadUtilException("Something is wrong with Upload file."); } }
php
public function processUpload($filenameProcessor, $useProcessorForName, $field = null) { if (!($filenameProcessor instanceof UploadFilenameProcessor)) { throw new UploadUtilException("processUpload must receive a UploadFilenameProcessor class"); } else if (is_null($field)) { $ret = array(); foreach($_FILES as $file => $property) { $ret[] = $this->processUpload($filenameProcessor, $useProcessorForName, $property); } return $ret; } else if (is_string($field)) { $ret = array(); $ret[] = $this->processUpload($filenameProcessor, $useProcessorForName, $_FILES[$field]); return $ret; } else if (is_array($field)) { if ($useProcessorForName) { $uploadfile = $filenameProcessor->FullQualifiedNameAndPath(); } else { $uploadfile = $filenameProcessor->PathSuggested() . FileUtil::Slash() . $field["name"]; } if (move_uploaded_file($field['tmp_name'], $uploadfile)) { return $uploadfile; } else { $message = "Unknow error: " . $field['error']; switch ($field['error']) { case UPLOAD_ERR_CANT_WRITE: $message = "Can't write"; break; case UPLOAD_ERR_EXTENSION: $message = "Extension is not permitted"; break; case UPLOAD_ERR_FORM_SIZE: $message = "Max post size reached"; break; case UPLOAD_ERR_INI_SIZE: $message = "Max system size reached"; break; case UPLOAD_ERR_NO_FILE: $message = "No file was uploaded"; break; case UPLOAD_ERR_NO_TMP_DIR: $message = "No temp dir"; break; case UPLOAD_ERR_PARTIAL: $message = "The uploaded file was only partially uploaded"; break; } throw new UploadUtilException($message); } } else { throw new UploadUtilException("Something is wrong with Upload file."); } }
[ "public", "function", "processUpload", "(", "$", "filenameProcessor", ",", "$", "useProcessorForName", ",", "$", "field", "=", "null", ")", "{", "if", "(", "!", "(", "$", "filenameProcessor", "instanceof", "UploadFilenameProcessor", ")", ")", "{", "throw", "ne...
Process a document Upload @param UploadFilenameProcessor $filenameProcessor @param bool $useProcessorForName @param string|array $field Contain the filename properties (if Array, or $filename if string) @param array Valid Extensions @return Array Filename saved.
[ "Process", "a", "document", "Upload" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L1307-L1376
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php
Context.getSuggestedContentType
public function getSuggestedContentType() { if (count($this->_contentType) == 0) { $this->_contentType["xsl"] = $this->getXsl(); $this->_contentType["content-type"] = "text/html"; $this->_contentType["content-disposition"] = ""; $this->_contentType["extension"] = ""; if ($this->get("xmlnuke.CHECKCONTENTTYPE")) { $filename = new AnydatasetFilenameProcessor("contenttype"); $anydataset = new AnyDataset($filename->FullQualifiedNameAndPath()); $itf = new IteratorFilter(); $itf->addRelation("xsl", Relation::EQUAL, $this->getXsl()); $it = $anydataset->getIterator($itf); if ($it->hasNext()) { $sr = $it->moveNext(); $this->_contentType = $sr->getOriginalRawFormat(); } else { $filename = new AnydatasetSetupFilenameProcessor("contenttype"); $anydataset = new AnyDataset($filename->FullQualifiedNameAndPath()); $itf = new IteratorFilter(); $itf->addRelation("xsl", Relation::EQUAL, $this->getXsl()); $it = $anydataset->getIterator($itf); if ($it->hasNext()) { $sr = $it->moveNext(); $this->_contentType = $sr->getOriginalRawFormat(); } } } } return ($this->_contentType); }
php
public function getSuggestedContentType() { if (count($this->_contentType) == 0) { $this->_contentType["xsl"] = $this->getXsl(); $this->_contentType["content-type"] = "text/html"; $this->_contentType["content-disposition"] = ""; $this->_contentType["extension"] = ""; if ($this->get("xmlnuke.CHECKCONTENTTYPE")) { $filename = new AnydatasetFilenameProcessor("contenttype"); $anydataset = new AnyDataset($filename->FullQualifiedNameAndPath()); $itf = new IteratorFilter(); $itf->addRelation("xsl", Relation::EQUAL, $this->getXsl()); $it = $anydataset->getIterator($itf); if ($it->hasNext()) { $sr = $it->moveNext(); $this->_contentType = $sr->getOriginalRawFormat(); } else { $filename = new AnydatasetSetupFilenameProcessor("contenttype"); $anydataset = new AnyDataset($filename->FullQualifiedNameAndPath()); $itf = new IteratorFilter(); $itf->addRelation("xsl", Relation::EQUAL, $this->getXsl()); $it = $anydataset->getIterator($itf); if ($it->hasNext()) { $sr = $it->moveNext(); $this->_contentType = $sr->getOriginalRawFormat(); } } } } return ($this->_contentType); }
[ "public", "function", "getSuggestedContentType", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "_contentType", ")", "==", "0", ")", "{", "$", "this", "->", "_contentType", "[", "\"xsl\"", "]", "=", "$", "this", "->", "getXsl", "(", ")", ...
Gets and array with the best content-type for the page. It checks the file "contenttype.anydata.xsl" if the property "xmlnuke.CHECKCONTENTTYPE" is true The returned array is: array( "xsl" => "", "content-type" => "", "content-disposition" => "", "extension" => "" ) @return array
[ "Gets", "and", "array", "with", "the", "best", "content", "-", "type", "for", "the", "page", ".", "It", "checks", "the", "file", "contenttype", ".", "anydata", ".", "xsl", "if", "the", "property", "xmlnuke", ".", "CHECKCONTENTTYPE", "is", "true" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/Context.php#L1392-L1428
train
ansas/php-component
src/Component/Money/Price.php
Price.createFromArray
public static function createFromArray($properties, string $priceType = self::GROSS, $validate = true) { if (!is_array($properties) && !$properties instanceof Traversable) { throw new InvalidArgumentException("prices must be iterable"); } $price = new static(null, $priceType); // Make sure default type is set first in order to be able to sanitize sign of other properties if (isset($properties[$priceType])) { $properties = [$priceType => $properties[$priceType]] + $properties; } foreach ($properties as $property => $value) { $value = Text::trim($value); if (mb_strlen($value)) { $value = ConvertPrice::getInstance()->sanitize($value); $price->set($property, $value, false, true); } } if (count($properties) > 1) { $price->calculate(); } if ($validate) { $price->validate(); } return $price; }
php
public static function createFromArray($properties, string $priceType = self::GROSS, $validate = true) { if (!is_array($properties) && !$properties instanceof Traversable) { throw new InvalidArgumentException("prices must be iterable"); } $price = new static(null, $priceType); // Make sure default type is set first in order to be able to sanitize sign of other properties if (isset($properties[$priceType])) { $properties = [$priceType => $properties[$priceType]] + $properties; } foreach ($properties as $property => $value) { $value = Text::trim($value); if (mb_strlen($value)) { $value = ConvertPrice::getInstance()->sanitize($value); $price->set($property, $value, false, true); } } if (count($properties) > 1) { $price->calculate(); } if ($validate) { $price->validate(); } return $price; }
[ "public", "static", "function", "createFromArray", "(", "$", "properties", ",", "string", "$", "priceType", "=", "self", "::", "GROSS", ",", "$", "validate", "=", "true", ")", "{", "if", "(", "!", "is_array", "(", "$", "properties", ")", "&&", "!", "$"...
Create new instance via static method. @param array $properties @param string $priceType [optional] @param bool $validate [optional] @return static @throws InvalidArgumentException
[ "Create", "new", "instance", "via", "static", "method", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Money/Price.php#L131-L161
train
HeroBanana/directadmin
src/DirectAdmin/DirectAdminClient.php
DirectAdminClient.da_request
public function da_request(string $method, string $uri = '', array $options = []): array { $this->lastRequest = microtime(true); try { $response = $this->request($method, $uri, $options); } catch(\Exception $e) { if($e instanceof RequestException) { throw new DirectAdminRequestException(sprintf('DirectAdmin %s %s request failed.', $method, $uri)); } if($e instanceof TransferException) { throw new DirectAdminTransferException(sprintf('DirectAdmin %s %s transfer failed.', $method, $uri)); } } if($response->getHeader('Content-Type')[0] === 'text/html') { throw new DirectAdminBadContentException(sprintf('DirectAdmin %s %s returned text/html.', $method, $uri)); } $body = $response->getBody()->getContents(); return $this->responseToArray($body); }
php
public function da_request(string $method, string $uri = '', array $options = []): array { $this->lastRequest = microtime(true); try { $response = $this->request($method, $uri, $options); } catch(\Exception $e) { if($e instanceof RequestException) { throw new DirectAdminRequestException(sprintf('DirectAdmin %s %s request failed.', $method, $uri)); } if($e instanceof TransferException) { throw new DirectAdminTransferException(sprintf('DirectAdmin %s %s transfer failed.', $method, $uri)); } } if($response->getHeader('Content-Type')[0] === 'text/html') { throw new DirectAdminBadContentException(sprintf('DirectAdmin %s %s returned text/html.', $method, $uri)); } $body = $response->getBody()->getContents(); return $this->responseToArray($body); }
[ "public", "function", "da_request", "(", "string", "$", "method", ",", "string", "$", "uri", "=", "''", ",", "array", "$", "options", "=", "[", "]", ")", ":", "array", "{", "$", "this", "->", "lastRequest", "=", "microtime", "(", "true", ")", ";", ...
DirectAdmin request to Server. @param string $method Method. @param string $uri Request URL. @param array $options Additional options. @return mixed
[ "DirectAdmin", "request", "to", "Server", "." ]
9081ce63ecc881c43bb497a114345a9b483b5a62
https://github.com/HeroBanana/directadmin/blob/9081ce63ecc881c43bb497a114345a9b483b5a62/src/DirectAdmin/DirectAdminClient.php#L89-L114
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Admin/Modules/CustomConfig.php
CustomConfig.generateLanguageInput
protected function generateLanguageInput($form) { $curValueArray = $this->_context->get("xmlnuke.LANGUAGESAVAILABLE"); foreach ($curValueArray as $key => $value) { $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "languagesavailable$key", "xmlnuke.LANGUAGESAVAILABLE", $this->getLangArray(), $value)); } $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "languagesavailable" . ++$key, "xmlnuke.LANGUAGESAVAILABLE", $this->getLangArray())); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "languagesavailable" . ++$key, "xmlnuke.LANGUAGESAVAILABLE", $this->getLangArray())); $form->addXmlnukeObject(new XmlInputHidden("languagesavailable", $key)); }
php
protected function generateLanguageInput($form) { $curValueArray = $this->_context->get("xmlnuke.LANGUAGESAVAILABLE"); foreach ($curValueArray as $key => $value) { $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "languagesavailable$key", "xmlnuke.LANGUAGESAVAILABLE", $this->getLangArray(), $value)); } $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "languagesavailable" . ++$key, "xmlnuke.LANGUAGESAVAILABLE", $this->getLangArray())); $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "languagesavailable" . ++$key, "xmlnuke.LANGUAGESAVAILABLE", $this->getLangArray())); $form->addXmlnukeObject(new XmlInputHidden("languagesavailable", $key)); }
[ "protected", "function", "generateLanguageInput", "(", "$", "form", ")", "{", "$", "curValueArray", "=", "$", "this", "->", "_context", "->", "get", "(", "\"xmlnuke.LANGUAGESAVAILABLE\"", ")", ";", "foreach", "(", "$", "curValueArray", "as", "$", "key", "=>", ...
Write Languages Available function @param XmlFormCollection $form
[ "Write", "Languages", "Available", "function" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Admin/Modules/CustomConfig.php#L209-L220
train
joshiausdemwald/Force.com-Toolkit-for-PHP-5.3
Soap/Client/Connection/ConnectionFactory.php
ConnectionFactory.needsRelogin
private function needsRelogin(SfdcConnectionInterface $con) { return ! $con->isLoggedIn() || (time() - $con->getLastLoginTime()) > $this->connectionTTL; }
php
private function needsRelogin(SfdcConnectionInterface $con) { return ! $con->isLoggedIn() || (time() - $con->getLastLoginTime()) > $this->connectionTTL; }
[ "private", "function", "needsRelogin", "(", "SfdcConnectionInterface", "$", "con", ")", "{", "return", "!", "$", "con", "->", "isLoggedIn", "(", ")", "||", "(", "time", "(", ")", "-", "$", "con", "->", "getLastLoginTime", "(", ")", ")", ">", "$", "this...
Returns true if the given connection has timed out. @param SfdcConnectionInterface $con @return bool
[ "Returns", "true", "if", "the", "given", "connection", "has", "timed", "out", "." ]
7fd3194eb3155f019e34439e586e6baf6cbb202f
https://github.com/joshiausdemwald/Force.com-Toolkit-for-PHP-5.3/blob/7fd3194eb3155f019e34439e586e6baf6cbb202f/Soap/Client/Connection/ConnectionFactory.php#L307-L310
train
ElijahGM/October-jwt
src/Blacklist.php
Blacklist.getMinutesUntilExpired
protected function getMinutesUntilExpired(Payload $payload) { $exp = Utils::timestamp($payload['exp']); $iat = Utils::timestamp($payload['iat']); // get the latter of the two expiration dates and find // the number of minutes until the expiration date, // plus 1 minute to avoid overlap return $exp->max($iat->addMinutes($this->refreshTTL))->addMinute()->diffInMinutes(); }
php
protected function getMinutesUntilExpired(Payload $payload) { $exp = Utils::timestamp($payload['exp']); $iat = Utils::timestamp($payload['iat']); // get the latter of the two expiration dates and find // the number of minutes until the expiration date, // plus 1 minute to avoid overlap return $exp->max($iat->addMinutes($this->refreshTTL))->addMinute()->diffInMinutes(); }
[ "protected", "function", "getMinutesUntilExpired", "(", "Payload", "$", "payload", ")", "{", "$", "exp", "=", "Utils", "::", "timestamp", "(", "$", "payload", "[", "'exp'", "]", ")", ";", "$", "iat", "=", "Utils", "::", "timestamp", "(", "$", "payload", ...
Get the number of minutes until the token expiry. @param \Tymon\JWTAuth\Payload $payload @return int
[ "Get", "the", "number", "of", "minutes", "until", "the", "token", "expiry", "." ]
ab1c0749ae3d6953fe4dab278baf4ea7d874b36f
https://github.com/ElijahGM/October-jwt/blob/ab1c0749ae3d6953fe4dab278baf4ea7d874b36f/src/Blacklist.php#L90-L99
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php
MxmapQuery.filterByTrackuid
public function filterByTrackuid($trackuid = null, $comparison = null) { if (null === $comparison) { if (is_array($trackuid)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_TRACKUID, $trackuid, $comparison); }
php
public function filterByTrackuid($trackuid = null, $comparison = null) { if (null === $comparison) { if (is_array($trackuid)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_TRACKUID, $trackuid, $comparison); }
[ "public", "function", "filterByTrackuid", "(", "$", "trackuid", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "trackuid", ")", ")", "{", "$", "compa...
Filter the query on the trackUID column Example usage: <code> $query->filterByTrackuid('fooValue'); // WHERE trackUID = 'fooValue' $query->filterByTrackuid('%fooValue%', Criteria::LIKE); // WHERE trackUID LIKE '%fooValue%' </code> @param string $trackuid The value to use as filter. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildMxmapQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "trackUID", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php#L492-L501
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php
MxmapQuery.filterByGbxmapname
public function filterByGbxmapname($gbxmapname = null, $comparison = null) { if (null === $comparison) { if (is_array($gbxmapname)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_GBXMAPNAME, $gbxmapname, $comparison); }
php
public function filterByGbxmapname($gbxmapname = null, $comparison = null) { if (null === $comparison) { if (is_array($gbxmapname)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_GBXMAPNAME, $gbxmapname, $comparison); }
[ "public", "function", "filterByGbxmapname", "(", "$", "gbxmapname", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "gbxmapname", ")", ")", "{", "$", ...
Filter the query on the gbxMapName column Example usage: <code> $query->filterByGbxmapname('fooValue'); // WHERE gbxMapName = 'fooValue' $query->filterByGbxmapname('%fooValue%', Criteria::LIKE); // WHERE gbxMapName LIKE '%fooValue%' </code> @param string $gbxmapname The value to use as filter. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildMxmapQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "gbxMapName", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php#L517-L526
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php
MxmapQuery.filterByTrackid
public function filterByTrackid($trackid = null, $comparison = null) { if (is_array($trackid)) { $useMinMax = false; if (isset($trackid['min'])) { $this->addUsingAlias(MxmapTableMap::COL_TRACKID, $trackid['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($trackid['max'])) { $this->addUsingAlias(MxmapTableMap::COL_TRACKID, $trackid['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_TRACKID, $trackid, $comparison); }
php
public function filterByTrackid($trackid = null, $comparison = null) { if (is_array($trackid)) { $useMinMax = false; if (isset($trackid['min'])) { $this->addUsingAlias(MxmapTableMap::COL_TRACKID, $trackid['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($trackid['max'])) { $this->addUsingAlias(MxmapTableMap::COL_TRACKID, $trackid['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_TRACKID, $trackid, $comparison); }
[ "public", "function", "filterByTrackid", "(", "$", "trackid", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "trackid", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$", ...
Filter the query on the trackID column Example usage: <code> $query->filterByTrackid(1234); // WHERE trackID = 1234 $query->filterByTrackid(array(12, 34)); // WHERE trackID IN (12, 34) $query->filterByTrackid(array('min' => 12)); // WHERE trackID > 12 </code> @param mixed $trackid The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildMxmapQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "trackID", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php#L546-L567
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php
MxmapQuery.filterByUserid
public function filterByUserid($userid = null, $comparison = null) { if (is_array($userid)) { $useMinMax = false; if (isset($userid['min'])) { $this->addUsingAlias(MxmapTableMap::COL_USERID, $userid['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($userid['max'])) { $this->addUsingAlias(MxmapTableMap::COL_USERID, $userid['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_USERID, $userid, $comparison); }
php
public function filterByUserid($userid = null, $comparison = null) { if (is_array($userid)) { $useMinMax = false; if (isset($userid['min'])) { $this->addUsingAlias(MxmapTableMap::COL_USERID, $userid['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($userid['max'])) { $this->addUsingAlias(MxmapTableMap::COL_USERID, $userid['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_USERID, $userid, $comparison); }
[ "public", "function", "filterByUserid", "(", "$", "userid", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "userid", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$", "us...
Filter the query on the userID column Example usage: <code> $query->filterByUserid(1234); // WHERE userID = 1234 $query->filterByUserid(array(12, 34)); // WHERE userID IN (12, 34) $query->filterByUserid(array('min' => 12)); // WHERE userID > 12 </code> @param mixed $userid The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildMxmapQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "userID", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php#L587-L608
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php
MxmapQuery.filterByUploadedat
public function filterByUploadedat($uploadedat = null, $comparison = null) { if (is_array($uploadedat)) { $useMinMax = false; if (isset($uploadedat['min'])) { $this->addUsingAlias(MxmapTableMap::COL_UPLOADEDAT, $uploadedat['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($uploadedat['max'])) { $this->addUsingAlias(MxmapTableMap::COL_UPLOADEDAT, $uploadedat['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_UPLOADEDAT, $uploadedat, $comparison); }
php
public function filterByUploadedat($uploadedat = null, $comparison = null) { if (is_array($uploadedat)) { $useMinMax = false; if (isset($uploadedat['min'])) { $this->addUsingAlias(MxmapTableMap::COL_UPLOADEDAT, $uploadedat['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($uploadedat['max'])) { $this->addUsingAlias(MxmapTableMap::COL_UPLOADEDAT, $uploadedat['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_UPLOADEDAT, $uploadedat, $comparison); }
[ "public", "function", "filterByUploadedat", "(", "$", "uploadedat", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "uploadedat", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", ...
Filter the query on the uploadedAt column Example usage: <code> $query->filterByUploadedat('2011-03-14'); // WHERE uploadedAt = '2011-03-14' $query->filterByUploadedat('now'); // WHERE uploadedAt = '2011-03-14' $query->filterByUploadedat(array('max' => 'yesterday')); // WHERE uploadedAt > '2011-03-13' </code> @param mixed $uploadedat The value to use as filter. Values can be integers (unix timestamps), DateTime objects, or strings. Empty strings are treated as NULL. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildMxmapQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "uploadedAt", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php#L655-L676
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php
MxmapQuery.filterByUpdatedat
public function filterByUpdatedat($updatedat = null, $comparison = null) { if (is_array($updatedat)) { $useMinMax = false; if (isset($updatedat['min'])) { $this->addUsingAlias(MxmapTableMap::COL_UPDATEDAT, $updatedat['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($updatedat['max'])) { $this->addUsingAlias(MxmapTableMap::COL_UPDATEDAT, $updatedat['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_UPDATEDAT, $updatedat, $comparison); }
php
public function filterByUpdatedat($updatedat = null, $comparison = null) { if (is_array($updatedat)) { $useMinMax = false; if (isset($updatedat['min'])) { $this->addUsingAlias(MxmapTableMap::COL_UPDATEDAT, $updatedat['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($updatedat['max'])) { $this->addUsingAlias(MxmapTableMap::COL_UPDATEDAT, $updatedat['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_UPDATEDAT, $updatedat, $comparison); }
[ "public", "function", "filterByUpdatedat", "(", "$", "updatedat", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "updatedat", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "...
Filter the query on the updatedAt column Example usage: <code> $query->filterByUpdatedat('2011-03-14'); // WHERE updatedAt = '2011-03-14' $query->filterByUpdatedat('now'); // WHERE updatedAt = '2011-03-14' $query->filterByUpdatedat(array('max' => 'yesterday')); // WHERE updatedAt > '2011-03-13' </code> @param mixed $updatedat The value to use as filter. Values can be integers (unix timestamps), DateTime objects, or strings. Empty strings are treated as NULL. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildMxmapQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "updatedAt", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php#L698-L719
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php
MxmapQuery.filterByMaptype
public function filterByMaptype($maptype = null, $comparison = null) { if (null === $comparison) { if (is_array($maptype)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_MAPTYPE, $maptype, $comparison); }
php
public function filterByMaptype($maptype = null, $comparison = null) { if (null === $comparison) { if (is_array($maptype)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_MAPTYPE, $maptype, $comparison); }
[ "public", "function", "filterByMaptype", "(", "$", "maptype", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "maptype", ")", ")", "{", "$", "comparis...
Filter the query on the mapType column Example usage: <code> $query->filterByMaptype('fooValue'); // WHERE mapType = 'fooValue' $query->filterByMaptype('%fooValue%', Criteria::LIKE); // WHERE mapType LIKE '%fooValue%' </code> @param string $maptype The value to use as filter. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildMxmapQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "mapType", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php#L735-L744
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php
MxmapQuery.filterByTitlepack
public function filterByTitlepack($titlepack = null, $comparison = null) { if (null === $comparison) { if (is_array($titlepack)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_TITLEPACK, $titlepack, $comparison); }
php
public function filterByTitlepack($titlepack = null, $comparison = null) { if (null === $comparison) { if (is_array($titlepack)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_TITLEPACK, $titlepack, $comparison); }
[ "public", "function", "filterByTitlepack", "(", "$", "titlepack", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "titlepack", ")", ")", "{", "$", "co...
Filter the query on the titlePack column Example usage: <code> $query->filterByTitlepack('fooValue'); // WHERE titlePack = 'fooValue' $query->filterByTitlepack('%fooValue%', Criteria::LIKE); // WHERE titlePack LIKE '%fooValue%' </code> @param string $titlepack The value to use as filter. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildMxmapQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "titlePack", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php#L760-L769
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php
MxmapQuery.filterByStylename
public function filterByStylename($stylename = null, $comparison = null) { if (null === $comparison) { if (is_array($stylename)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_STYLENAME, $stylename, $comparison); }
php
public function filterByStylename($stylename = null, $comparison = null) { if (null === $comparison) { if (is_array($stylename)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MxmapTableMap::COL_STYLENAME, $stylename, $comparison); }
[ "public", "function", "filterByStylename", "(", "$", "stylename", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "stylename", ")", ")", "{", "$", "co...
Filter the query on the styleName column Example usage: <code> $query->filterByStylename('fooValue'); // WHERE styleName = 'fooValue' $query->filterByStylename('%fooValue%', Criteria::LIKE); // WHERE styleName LIKE '%fooValue%' </code> @param string $stylename The value to use as filter. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildMxmapQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "styleName", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MxmapQuery.php#L785-L794
train