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
vegas-cmf/core
src/Db/Decorator/Helper/ReadNestedAttributeTrait.php
ReadNestedAttributeTrait.traverseObject
private function traverseObject($obj, $keys) { if (empty($keys)) { return $obj; } $key = current($keys); if (is_array($obj) && isset($obj[$key])) { return $this->traverseObject($obj[$key], array_slice($keys, 1)); } else if (is_object($obj) && isset($obj->{$key})) { return $this->traverseObject($obj->{$key}, array_slice($keys, 1)); } else { return null; } }
php
private function traverseObject($obj, $keys) { if (empty($keys)) { return $obj; } $key = current($keys); if (is_array($obj) && isset($obj[$key])) { return $this->traverseObject($obj[$key], array_slice($keys, 1)); } else if (is_object($obj) && isset($obj->{$key})) { return $this->traverseObject($obj->{$key}, array_slice($keys, 1)); } else { return null; } }
[ "private", "function", "traverseObject", "(", "$", "obj", ",", "$", "keys", ")", "{", "if", "(", "empty", "(", "$", "keys", ")", ")", "{", "return", "$", "obj", ";", "}", "$", "key", "=", "current", "(", "$", "keys", ")", ";", "if", "(", "is_ar...
Recursive traversing object based on properties from array @param $obj @param $keys @return mixed
[ "Recursive", "traversing", "object", "based", "on", "properties", "from", "array" ]
50fc3f31a6a8fc3cf274efd5b3eb3203d1206100
https://github.com/vegas-cmf/core/blob/50fc3f31a6a8fc3cf274efd5b3eb3203d1206100/src/Db/Decorator/Helper/ReadNestedAttributeTrait.php#L62-L76
train
vegas-cmf/core
src/Cli/EventsListener/TaskListener.php
TaskListener.beforeHandleTask
public function beforeHandleTask($argv) { return function(Event $event, Console $console, Dispatcher $dispatcher) use ($argv) { //parse parameters $parsedOptions = OptionParser::parse($argv); $dispatcher->setParams(array( 'activeTask' => isset($parsedOptions[0]) ? $parsedOptions[0] : false, 'activeAction' => isset($parsedOptions[1]) ? $parsedOptions[1] : false, 'args' => count($parsedOptions) > 2 ? array_slice($parsedOptions, 2) : [] )); }; }
php
public function beforeHandleTask($argv) { return function(Event $event, Console $console, Dispatcher $dispatcher) use ($argv) { //parse parameters $parsedOptions = OptionParser::parse($argv); $dispatcher->setParams(array( 'activeTask' => isset($parsedOptions[0]) ? $parsedOptions[0] : false, 'activeAction' => isset($parsedOptions[1]) ? $parsedOptions[1] : false, 'args' => count($parsedOptions) > 2 ? array_slice($parsedOptions, 2) : [] )); }; }
[ "public", "function", "beforeHandleTask", "(", "$", "argv", ")", "{", "return", "function", "(", "Event", "$", "event", ",", "Console", "$", "console", ",", "Dispatcher", "$", "dispatcher", ")", "use", "(", "$", "argv", ")", "{", "//parse parameters", "$",...
Event fired before task is handling @param $argv @return callable
[ "Event", "fired", "before", "task", "is", "handling" ]
50fc3f31a6a8fc3cf274efd5b3eb3203d1206100
https://github.com/vegas-cmf/core/blob/50fc3f31a6a8fc3cf274efd5b3eb3203d1206100/src/Cli/EventsListener/TaskListener.php#L34-L46
train
softberg/quantum-core
src/Routes/Router.php
Router.findPattern
private function findPattern($matches) { switch ($matches[1]) { case ':num': $replacement = '([0-9]'; break; case ':alpha': $replacement = '([a-zA-Z]'; break; case ':any': $replacement = '([^\/]'; break; } if (isset($matches[3]) && is_numeric($matches[3])) { if (isset($matches[4]) && $matches[4] == '?') { $replacement .= '{0,' . $matches[3] . '})'; } else { $replacement .= '{' . $matches[3] . '})'; } } else { if (isset($matches[4]) && $matches[4] == '?') { $replacement .= '*)'; } else { $replacement .= '+)'; } } return $replacement; }
php
private function findPattern($matches) { switch ($matches[1]) { case ':num': $replacement = '([0-9]'; break; case ':alpha': $replacement = '([a-zA-Z]'; break; case ':any': $replacement = '([^\/]'; break; } if (isset($matches[3]) && is_numeric($matches[3])) { if (isset($matches[4]) && $matches[4] == '?') { $replacement .= '{0,' . $matches[3] . '})'; } else { $replacement .= '{' . $matches[3] . '})'; } } else { if (isset($matches[4]) && $matches[4] == '?') { $replacement .= '*)'; } else { $replacement .= '+)'; } } return $replacement; }
[ "private", "function", "findPattern", "(", "$", "matches", ")", "{", "switch", "(", "$", "matches", "[", "1", "]", ")", "{", "case", "':num'", ":", "$", "replacement", "=", "'([0-9]'", ";", "break", ";", "case", "':alpha'", ":", "$", "replacement", "="...
Finds url pattern @param string $matches @return string
[ "Finds", "url", "pattern" ]
081d42a4ce4197ac8687d438c571914473ade9da
https://github.com/softberg/quantum-core/blob/081d42a4ce4197ac8687d438c571914473ade9da/src/Routes/Router.php#L158-L187
train
vegas-cmf/core
src/Db/Decorator/Helper/MappingHelperTrait.php
MappingHelperTrait.toMappedArray
public function toMappedArray() { $values = $this->toArray(); $mappedValues = []; foreach ($values as $key => $value) { $mappedValues[$key] = $this->readMapped($key); } return $mappedValues; }
php
public function toMappedArray() { $values = $this->toArray(); $mappedValues = []; foreach ($values as $key => $value) { $mappedValues[$key] = $this->readMapped($key); } return $mappedValues; }
[ "public", "function", "toMappedArray", "(", ")", "{", "$", "values", "=", "$", "this", "->", "toArray", "(", ")", ";", "$", "mappedValues", "=", "[", "]", ";", "foreach", "(", "$", "values", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "m...
Returns array of attributes with mapped values @return array
[ "Returns", "array", "of", "attributes", "with", "mapped", "values" ]
50fc3f31a6a8fc3cf274efd5b3eb3203d1206100
https://github.com/vegas-cmf/core/blob/50fc3f31a6a8fc3cf274efd5b3eb3203d1206100/src/Db/Decorator/Helper/MappingHelperTrait.php#L41-L50
train
vegas-cmf/core
src/Db/Decorator/Helper/MappingHelperTrait.php
MappingHelperTrait.readMapped
public function readMapped($name) { if (!$this->hasMapping($name) && isset($this->mappings[$name])) { $this->addMapping($name, $this->mappings[$name]); } $value = $this->readAttribute($name); $value = $this->resolveMapping($name, $value); return $value; }
php
public function readMapped($name) { if (!$this->hasMapping($name) && isset($this->mappings[$name])) { $this->addMapping($name, $this->mappings[$name]); } $value = $this->readAttribute($name); $value = $this->resolveMapping($name, $value); return $value; }
[ "public", "function", "readMapped", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "hasMapping", "(", "$", "name", ")", "&&", "isset", "(", "$", "this", "->", "mappings", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", ...
Returns mapped value of attribute @param string $name @return mixed
[ "Returns", "mapped", "value", "of", "attribute" ]
50fc3f31a6a8fc3cf274efd5b3eb3203d1206100
https://github.com/vegas-cmf/core/blob/50fc3f31a6a8fc3cf274efd5b3eb3203d1206100/src/Db/Decorator/Helper/MappingHelperTrait.php#L58-L68
train
duncan3dc/php-helpers
src/Dict.php
Dict.value
public static function value(array $data, $key, $default = null) { $value = static::valueIfSet($data, $key, $default); if ($value) { return $value; } else { return $default; } }
php
public static function value(array $data, $key, $default = null) { $value = static::valueIfSet($data, $key, $default); if ($value) { return $value; } else { return $default; } }
[ "public", "static", "function", "value", "(", "array", "$", "data", ",", "$", "key", ",", "$", "default", "=", "null", ")", "{", "$", "value", "=", "static", "::", "valueIfSet", "(", "$", "data", ",", "$", "key", ",", "$", "default", ")", ";", "i...
Get an element from an array, or the default if it is not set or it's value is falsy. @param array $data The array to get the element from @param mixed $key The key within the array to get @param mixed $default The default value to return if no element exists or it's value is falsy @return mixed
[ "Get", "an", "element", "from", "an", "array", "or", "the", "default", "if", "it", "is", "not", "set", "or", "it", "s", "value", "is", "falsy", "." ]
0305d220183d9b515f17600bf064291da7a8813b
https://github.com/duncan3dc/php-helpers/blob/0305d220183d9b515f17600bf064291da7a8813b/src/Dict.php#L17-L26
train
BenGorUser/User
src/BenGorUser/User/Infrastructure/Persistence/SqlUserRepository.php
SqlUserRepository.exist
private function exist(User $aUser) { $count = $this->execute( 'SELECT COUNT(*) FROM user WHERE id = :id', [':id' => $aUser->id()->id()] )->fetchColumn(); return (int) $count === 1; }
php
private function exist(User $aUser) { $count = $this->execute( 'SELECT COUNT(*) FROM user WHERE id = :id', [':id' => $aUser->id()->id()] )->fetchColumn(); return (int) $count === 1; }
[ "private", "function", "exist", "(", "User", "$", "aUser", ")", "{", "$", "count", "=", "$", "this", "->", "execute", "(", "'SELECT COUNT(*) FROM user WHERE id = :id'", ",", "[", "':id'", "=>", "$", "aUser", "->", "id", "(", ")", "->", "id", "(", ")", ...
Checks if the user given exists in the database. @param User $aUser The user @return bool
[ "Checks", "if", "the", "user", "given", "exists", "in", "the", "database", "." ]
734900f463042194502191e4fb3e4f588cb7bf6f
https://github.com/BenGorUser/User/blob/734900f463042194502191e4fb3e4f588cb7bf6f/src/BenGorUser/User/Infrastructure/Persistence/SqlUserRepository.php#L198-L205
train
BenGorUser/User
src/BenGorUser/User/Infrastructure/Persistence/SqlUserRepository.php
SqlUserRepository.insert
private function insert(User $aUser) { $sql = 'INSERT INTO user ( id, confirmation_token_token, confirmation_token_created_on, created_on, email, invitation_token_token, invitation_token_created_on, last_login, password, salt, remember_password_token_token, remember_password_token_created_on, roles, updated_on ) VALUES ( :id, :confirmationTokenToken, :confirmationTokenCreatedOn, :createdOn, :email, :invitationTokenToken, :invitationTokenCreatedOn, :lastLogin, :password, :salt, :rememberPasswordTokenToken, :rememberPasswordTokenCreatedOn, :roles, :updatedOn )'; $this->execute($sql, [ 'id' => $aUser->id()->id(), 'confirmationTokenToken' => $aUser->confirmationToken() ? $aUser->confirmationToken()->token() : null, 'confirmationTokenCreatedOn' => $aUser->confirmationToken() ? $aUser->confirmationToken()->createdOn() : null, 'createdOn' => $aUser->createdOn()->format(self::DATE_FORMAT), 'email' => $aUser->email()->email(), 'invitationTokenToken' => $aUser->invitationToken() ? $aUser->invitationToken()->token() : null, 'invitationTokenCreatedOn' => $aUser->invitationToken() ? $aUser->invitationToken()->createdOn() : null, 'lastLogin' => $aUser->lastLogin() ? $aUser->lastLogin()->format(self::DATE_FORMAT) : null, 'password' => $aUser->password()->encodedPassword(), 'salt' => $aUser->password()->salt(), 'rememberPasswordTokenToken' => $aUser->rememberPasswordToken() ? $aUser->rememberPasswordToken()->token() : null, 'rememberPasswordTokenCreatedOn' => $aUser->rememberPasswordToken() ? $aUser->rememberPasswordToken()->createdOn() : null, 'roles' => $this->rolesToString($aUser->roles()), 'updatedOn' => $aUser->updatedOn()->format(self::DATE_FORMAT), ]); }
php
private function insert(User $aUser) { $sql = 'INSERT INTO user ( id, confirmation_token_token, confirmation_token_created_on, created_on, email, invitation_token_token, invitation_token_created_on, last_login, password, salt, remember_password_token_token, remember_password_token_created_on, roles, updated_on ) VALUES ( :id, :confirmationTokenToken, :confirmationTokenCreatedOn, :createdOn, :email, :invitationTokenToken, :invitationTokenCreatedOn, :lastLogin, :password, :salt, :rememberPasswordTokenToken, :rememberPasswordTokenCreatedOn, :roles, :updatedOn )'; $this->execute($sql, [ 'id' => $aUser->id()->id(), 'confirmationTokenToken' => $aUser->confirmationToken() ? $aUser->confirmationToken()->token() : null, 'confirmationTokenCreatedOn' => $aUser->confirmationToken() ? $aUser->confirmationToken()->createdOn() : null, 'createdOn' => $aUser->createdOn()->format(self::DATE_FORMAT), 'email' => $aUser->email()->email(), 'invitationTokenToken' => $aUser->invitationToken() ? $aUser->invitationToken()->token() : null, 'invitationTokenCreatedOn' => $aUser->invitationToken() ? $aUser->invitationToken()->createdOn() : null, 'lastLogin' => $aUser->lastLogin() ? $aUser->lastLogin()->format(self::DATE_FORMAT) : null, 'password' => $aUser->password()->encodedPassword(), 'salt' => $aUser->password()->salt(), 'rememberPasswordTokenToken' => $aUser->rememberPasswordToken() ? $aUser->rememberPasswordToken()->token() : null, 'rememberPasswordTokenCreatedOn' => $aUser->rememberPasswordToken() ? $aUser->rememberPasswordToken()->createdOn() : null, 'roles' => $this->rolesToString($aUser->roles()), 'updatedOn' => $aUser->updatedOn()->format(self::DATE_FORMAT), ]); }
[ "private", "function", "insert", "(", "User", "$", "aUser", ")", "{", "$", "sql", "=", "'INSERT INTO user (\n id,\n confirmation_token_token,\n confirmation_token_created_on,\n created_on,\n email,\n invitation_token_token,\n ...
Prepares the insert SQL with the user given. @param User $aUser The user
[ "Prepares", "the", "insert", "SQL", "with", "the", "user", "given", "." ]
734900f463042194502191e4fb3e4f588cb7bf6f
https://github.com/BenGorUser/User/blob/734900f463042194502191e4fb3e4f588cb7bf6f/src/BenGorUser/User/Infrastructure/Persistence/SqlUserRepository.php#L212-L261
train
BenGorUser/User
src/BenGorUser/User/Infrastructure/Persistence/SqlUserRepository.php
SqlUserRepository.execute
private function execute($aSql, array $parameters) { $statement = $this->pdo->prepare($aSql); $statement->execute($parameters); return $statement; }
php
private function execute($aSql, array $parameters) { $statement = $this->pdo->prepare($aSql); $statement->execute($parameters); return $statement; }
[ "private", "function", "execute", "(", "$", "aSql", ",", "array", "$", "parameters", ")", "{", "$", "statement", "=", "$", "this", "->", "pdo", "->", "prepare", "(", "$", "aSql", ")", ";", "$", "statement", "->", "execute", "(", "$", "parameters", ")...
Wrapper that encapsulates the same logic about execute the query in PDO. @param string $aSql The SQL @param array $parameters Array which contains the parameters of SQL @return \PDOStatement
[ "Wrapper", "that", "encapsulates", "the", "same", "logic", "about", "execute", "the", "query", "in", "PDO", "." ]
734900f463042194502191e4fb3e4f588cb7bf6f
https://github.com/BenGorUser/User/blob/734900f463042194502191e4fb3e4f588cb7bf6f/src/BenGorUser/User/Infrastructure/Persistence/SqlUserRepository.php#L306-L312
train
BenGorUser/User
src/BenGorUser/User/Infrastructure/Persistence/SqlUserRepository.php
SqlUserRepository.buildUser
private function buildUser($row) { $createdOn = new \DateTimeImmutable($row['created_on']); $updatedOn = new \DateTimeImmutable($row['updated_on']); $lastLogin = null === $row['last_login'] ? null : new \DateTimeImmutable($row['last_login']); $confirmationToken = null; if (null !== $row['confirmation_token_token']) { $confirmationToken = new UserToken($row['confirmation_token_token']); $this->set($confirmationToken, 'createdOn', new \DateTimeImmutable($row['confirmation_token_created_on'])); } $invitationToken = null; if (null !== $row['invitation_token_token']) { $invitationToken = new UserToken($row['invitation_token_token']); $this->set($invitationToken, 'createdOn', new \DateTimeImmutable($row['invitation_token_created_on'])); } $rememberPasswordToken = null; if (null !== $row['remember_password_token_token']) { $rememberPasswordToken = new UserToken($row['remember_password_token_token']); $this->set($rememberPasswordToken, 'createdOn', new \DateTimeImmutable($row['remember_password_token_created_on'])); } $user = User::signUp( new UserId($row['id']), new UserEmail($row['email']), UserPassword::fromEncoded($row['password'], $row['salt']), $this->rolesToArray($row['roles']) ); $user = $this->set($user, 'createdOn', $createdOn); $user = $this->set($user, 'updatedOn', $updatedOn); $user = $this->set($user, 'lastLogin', $lastLogin); $user = $this->set($user, 'confirmationToken', $confirmationToken); $user = $this->set($user, 'invitationToken', $invitationToken); $user = $this->set($user, 'rememberPasswordToken', $rememberPasswordToken); return $user; }
php
private function buildUser($row) { $createdOn = new \DateTimeImmutable($row['created_on']); $updatedOn = new \DateTimeImmutable($row['updated_on']); $lastLogin = null === $row['last_login'] ? null : new \DateTimeImmutable($row['last_login']); $confirmationToken = null; if (null !== $row['confirmation_token_token']) { $confirmationToken = new UserToken($row['confirmation_token_token']); $this->set($confirmationToken, 'createdOn', new \DateTimeImmutable($row['confirmation_token_created_on'])); } $invitationToken = null; if (null !== $row['invitation_token_token']) { $invitationToken = new UserToken($row['invitation_token_token']); $this->set($invitationToken, 'createdOn', new \DateTimeImmutable($row['invitation_token_created_on'])); } $rememberPasswordToken = null; if (null !== $row['remember_password_token_token']) { $rememberPasswordToken = new UserToken($row['remember_password_token_token']); $this->set($rememberPasswordToken, 'createdOn', new \DateTimeImmutable($row['remember_password_token_created_on'])); } $user = User::signUp( new UserId($row['id']), new UserEmail($row['email']), UserPassword::fromEncoded($row['password'], $row['salt']), $this->rolesToArray($row['roles']) ); $user = $this->set($user, 'createdOn', $createdOn); $user = $this->set($user, 'updatedOn', $updatedOn); $user = $this->set($user, 'lastLogin', $lastLogin); $user = $this->set($user, 'confirmationToken', $confirmationToken); $user = $this->set($user, 'invitationToken', $invitationToken); $user = $this->set($user, 'rememberPasswordToken', $rememberPasswordToken); return $user; }
[ "private", "function", "buildUser", "(", "$", "row", ")", "{", "$", "createdOn", "=", "new", "\\", "DateTimeImmutable", "(", "$", "row", "[", "'created_on'", "]", ")", ";", "$", "updatedOn", "=", "new", "\\", "DateTimeImmutable", "(", "$", "row", "[", ...
Builds the user with the given sql row attributes. @param array $row Array which contains attributes of user @return User
[ "Builds", "the", "user", "with", "the", "given", "sql", "row", "attributes", "." ]
734900f463042194502191e4fb3e4f588cb7bf6f
https://github.com/BenGorUser/User/blob/734900f463042194502191e4fb3e4f588cb7bf6f/src/BenGorUser/User/Infrastructure/Persistence/SqlUserRepository.php#L321-L360
train
stanislav-web/Searcher
src/Searcher/Searcher.php
Searcher.setFields
public function setFields(array $models) { try { // need to return << true $this->validator->verify($models, [ 'isArray', 'isNotEmpty', 'isExists' ], 'where'); } catch(ExceptionFactory $e) { echo $e->getMessage(); } return $this; }
php
public function setFields(array $models) { try { // need to return << true $this->validator->verify($models, [ 'isArray', 'isNotEmpty', 'isExists' ], 'where'); } catch(ExceptionFactory $e) { echo $e->getMessage(); } return $this; }
[ "public", "function", "setFields", "(", "array", "$", "models", ")", "{", "try", "{", "// need to return << true", "$", "this", "->", "validator", "->", "verify", "(", "$", "models", ",", "[", "'isArray'", ",", "'isNotEmpty'", ",", "'isExists'", "]", ",", ...
Prepare models and fields to participate in search @param array $models @example <code> $s->setFields([ 'Model/Table1' => [ 'title', 'text' ], 'Model/Table2' => [ 'name', 'mark' ].... ]) </code> @throws ExceptionFactory {$error} @return Searcher
[ "Prepare", "models", "and", "fields", "to", "participate", "in", "search" ]
bf01156d1a2416ceddef0d238469563b74087d44
https://github.com/stanislav-web/Searcher/blob/bf01156d1a2416ceddef0d238469563b74087d44/src/Searcher/Searcher.php#L114-L130
train
stanislav-web/Searcher
src/Searcher/Searcher.php
Searcher.setThreshold
public function setThreshold($threshold) { // need to return << true if (is_array($threshold) === true) { $threshold = array_map('intval', array_splice($threshold, 0, 2)); } else { $threshold = intval($threshold); } $this->validator->verify($threshold, [], 'threshold'); return $this; }
php
public function setThreshold($threshold) { // need to return << true if (is_array($threshold) === true) { $threshold = array_map('intval', array_splice($threshold, 0, 2)); } else { $threshold = intval($threshold); } $this->validator->verify($threshold, [], 'threshold'); return $this; }
[ "public", "function", "setThreshold", "(", "$", "threshold", ")", "{", "// need to return << true", "if", "(", "is_array", "(", "$", "threshold", ")", "===", "true", ")", "{", "$", "threshold", "=", "array_map", "(", "'intval'", ",", "array_splice", "(", "$"...
Setup offset, limit threshold @param mixed $threshold @example <code> $s->setThreshold(100) // limit $s->setThreshold([0,100]) // offset, limit </code> @throws ExceptionFactory {$error} @return Searcher
[ "Setup", "offset", "limit", "threshold" ]
bf01156d1a2416ceddef0d238469563b74087d44
https://github.com/stanislav-web/Searcher/blob/bf01156d1a2416ceddef0d238469563b74087d44/src/Searcher/Searcher.php#L205-L219
train
stanislav-web/Searcher
src/Searcher/Searcher.php
Searcher.setQuery
public function setQuery($query = null) { try { // need to return << true $this->validator->verify($query, ['isNotNull', 'isAcceptLength']); if (false === $this->exact) { $this->query = ['query' => '%' . $query . '%']; } else { $this->query = ['query' => $query]; } } catch(ExceptionFactory $e) { echo $e->getMessage(); } return $this; }
php
public function setQuery($query = null) { try { // need to return << true $this->validator->verify($query, ['isNotNull', 'isAcceptLength']); if (false === $this->exact) { $this->query = ['query' => '%' . $query . '%']; } else { $this->query = ['query' => $query]; } } catch(ExceptionFactory $e) { echo $e->getMessage(); } return $this; }
[ "public", "function", "setQuery", "(", "$", "query", "=", "null", ")", "{", "try", "{", "// need to return << true", "$", "this", "->", "validator", "->", "verify", "(", "$", "query", ",", "[", "'isNotNull'", ",", "'isAcceptLength'", "]", ")", ";", "if", ...
Prepare query value @param string|null $query @example <code> $s->setQuery('what i want to find') </code> @throws ExceptionFactory {$error} @return Searcher
[ "Prepare", "query", "value" ]
bf01156d1a2416ceddef0d238469563b74087d44
https://github.com/stanislav-web/Searcher/blob/bf01156d1a2416ceddef0d238469563b74087d44/src/Searcher/Searcher.php#L231-L252
train
stanislav-web/Searcher
src/Searcher/Searcher.php
Searcher.run
final public function run($hydratorset = null, $callback = null) { try { // call to get result $result = (new Builder($this))->loop($hydratorset, $callback); return $result; } catch (ExceptionFactory $e) { echo $e->getMessage(); } }
php
final public function run($hydratorset = null, $callback = null) { try { // call to get result $result = (new Builder($this))->loop($hydratorset, $callback); return $result; } catch (ExceptionFactory $e) { echo $e->getMessage(); } }
[ "final", "public", "function", "run", "(", "$", "hydratorset", "=", "null", ",", "$", "callback", "=", "null", ")", "{", "try", "{", "// call to get result", "$", "result", "=", "(", "new", "Builder", "(", "$", "this", ")", ")", "->", "loop", "(", "$...
Search procedure started @param null $hydratorset result mode @param null $callback post modifier @throws ExceptionFactory {$error} @return Builder|null
[ "Search", "procedure", "started" ]
bf01156d1a2416ceddef0d238469563b74087d44
https://github.com/stanislav-web/Searcher/blob/bf01156d1a2416ceddef0d238469563b74087d44/src/Searcher/Searcher.php#L272-L286
train
milejko/mmi-cms
src/Cms/ApiController.php
ApiController.soapServerAction
public function soapServerAction() { try { $apiModel = $this->_getModelName($this->obj); //parametry WSDL $wsdlParams = [ 'module' => 'cms', 'controller' => 'api', 'action' => 'wsdl', 'obj' => $this->obj, ]; //prywatny serwer if (\Mmi\App\FrontController::getInstance()->getEnvironment()->authUser) { $apiModel .= 'Private'; $auth = new \Mmi\Security\Auth; $auth->setModelName($apiModel); $auth->httpAuth('Private API', 'Access denied!'); $wsdlParams['type'] = 'private'; } //ścieżka do WSDL $url = $this->view->url($wsdlParams, true, true, $this->_isSsl()); //typ odpowiedzi na application/xml $this->getResponse()->setTypeXml(); //powołanie klasy serwera SOAP $soap = new SoapServer($url); $soap->setClass($apiModel); //obsługa żądania $soap->handle(); return ''; } catch (\Exception $e) { //rzuca wyjątek internal return $this->_internalError($e); } }
php
public function soapServerAction() { try { $apiModel = $this->_getModelName($this->obj); //parametry WSDL $wsdlParams = [ 'module' => 'cms', 'controller' => 'api', 'action' => 'wsdl', 'obj' => $this->obj, ]; //prywatny serwer if (\Mmi\App\FrontController::getInstance()->getEnvironment()->authUser) { $apiModel .= 'Private'; $auth = new \Mmi\Security\Auth; $auth->setModelName($apiModel); $auth->httpAuth('Private API', 'Access denied!'); $wsdlParams['type'] = 'private'; } //ścieżka do WSDL $url = $this->view->url($wsdlParams, true, true, $this->_isSsl()); //typ odpowiedzi na application/xml $this->getResponse()->setTypeXml(); //powołanie klasy serwera SOAP $soap = new SoapServer($url); $soap->setClass($apiModel); //obsługa żądania $soap->handle(); return ''; } catch (\Exception $e) { //rzuca wyjątek internal return $this->_internalError($e); } }
[ "public", "function", "soapServerAction", "(", ")", "{", "try", "{", "$", "apiModel", "=", "$", "this", "->", "_getModelName", "(", "$", "this", "->", "obj", ")", ";", "//parametry WSDL", "$", "wsdlParams", "=", "[", "'module'", "=>", "'cms'", ",", "'con...
Akcja serwera SOAP
[ "Akcja", "serwera", "SOAP" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/ApiController.php#L22-L55
train
milejko/mmi-cms
src/Cms/Model/File.php
File._checkAndCopyFile
protected static function _checkAndCopyFile(\Mmi\Http\RequestFile $file, $allowedTypes = []) { //pomijanie plików typu bmp (bitmapy windows - nieobsługiwane w PHP) if ($file->type == 'image/x-ms-bmp' || $file->type == 'image/tiff') { $file->type = 'application/octet-stream'; } //plik nie jest dozwolony if (!empty($allowedTypes) && !in_array($file->type, $allowedTypes)) { return null; } //pozycja ostatniej kropki w nazwie - rozszerzenie pliku $pointPosition = strrpos($file->name, '.'); //kalkulacja nazwy systemowej $name = md5(microtime(true) . $file->tmpName) . (($pointPosition !== false) ? substr($file->name, $pointPosition) : ''); //określanie ścieżki $dir = BASE_PATH . '/var/data/' . $name[0] . '/' . $name[1] . '/' . $name[2] . '/' . $name[3]; //tworzenie ścieżki if (!file_exists($dir)) { mkdir($dir, 0777, true); } //zmiana uprawnień chmod($file->tmpName, 0664); //kopiowanie pliku copy($file->tmpName, $dir . '/' . $name); return $name; }
php
protected static function _checkAndCopyFile(\Mmi\Http\RequestFile $file, $allowedTypes = []) { //pomijanie plików typu bmp (bitmapy windows - nieobsługiwane w PHP) if ($file->type == 'image/x-ms-bmp' || $file->type == 'image/tiff') { $file->type = 'application/octet-stream'; } //plik nie jest dozwolony if (!empty($allowedTypes) && !in_array($file->type, $allowedTypes)) { return null; } //pozycja ostatniej kropki w nazwie - rozszerzenie pliku $pointPosition = strrpos($file->name, '.'); //kalkulacja nazwy systemowej $name = md5(microtime(true) . $file->tmpName) . (($pointPosition !== false) ? substr($file->name, $pointPosition) : ''); //określanie ścieżki $dir = BASE_PATH . '/var/data/' . $name[0] . '/' . $name[1] . '/' . $name[2] . '/' . $name[3]; //tworzenie ścieżki if (!file_exists($dir)) { mkdir($dir, 0777, true); } //zmiana uprawnień chmod($file->tmpName, 0664); //kopiowanie pliku copy($file->tmpName, $dir . '/' . $name); return $name; }
[ "protected", "static", "function", "_checkAndCopyFile", "(", "\\", "Mmi", "\\", "Http", "\\", "RequestFile", "$", "file", ",", "$", "allowedTypes", "=", "[", "]", ")", "{", "//pomijanie plików typu bmp (bitmapy windows - nieobsługiwane w PHP)", "if", "(", "$", "file...
Sprawdza parametry i kopiuje plik do odpowiedniego katalogu na dysku @param \Mmi\Http\RequestFile $file obiekt pliku @param array $allowedTypes dozwolone typy plików @return string|null zwraca nazwę utworzonego pliku na dysku
[ "Sprawdza", "parametry", "i", "kopiuje", "plik", "do", "odpowiedniego", "katalogu", "na", "dysku" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Model/File.php#L83-L109
train
milejko/mmi-cms
src/Cms/Model/File.php
File.move
public static function move($srcObject, $srcId, $destObject, $destId) { $i = 0; //przenoszenie plików foreach (CmsFileQuery::byObject($srcObject, $srcId)->find() as $file) { //nowy obiekt i id $file->object = $destObject; $file->objectId = $destId; //zapis $file->save(); $i++; } return $i; }
php
public static function move($srcObject, $srcId, $destObject, $destId) { $i = 0; //przenoszenie plików foreach (CmsFileQuery::byObject($srcObject, $srcId)->find() as $file) { //nowy obiekt i id $file->object = $destObject; $file->objectId = $destId; //zapis $file->save(); $i++; } return $i; }
[ "public", "static", "function", "move", "(", "$", "srcObject", ",", "$", "srcId", ",", "$", "destObject", ",", "$", "destId", ")", "{", "$", "i", "=", "0", ";", "//przenoszenie plików", "foreach", "(", "CmsFileQuery", "::", "byObject", "(", "$", "srcObje...
Przenosi plik z jednego obiektu na inny @param string $srcObject obiekt źródłowy @param int $srcId id źródła @param string $destObject obiekt docelowy @param int $destId docelowy id @return int ilość przeniesionych
[ "Przenosi", "plik", "z", "jednego", "obiektu", "na", "inny" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Model/File.php#L119-L132
train
milejko/mmi-cms
src/Cms/Model/File.php
File.copy
public static function copy($srcObject, $srcId, $destObject, $destId) { $i = 0; //kopiowanie plików foreach (CmsFileQuery::byObject($srcObject, $srcId)->find() as $file) { try { //tworzenie kopii $copy = new \Mmi\Http\RequestFile([ 'name' => $file->original, 'tmp_name' => $file->getRealPath(), 'size' => $file->size ]); } catch (\Mmi\App\KernelException $e) { \Mmi\App\FrontController::getInstance()->getLogger()->warning('Unable to copy file, file not found: ' . $file->getRealPath()); continue; } $newFile = clone $file; $newFile->id = null; //dołączanie pliku self::_copyFile($copy, $destObject, $destId, $newFile); $i++; } return $i; }
php
public static function copy($srcObject, $srcId, $destObject, $destId) { $i = 0; //kopiowanie plików foreach (CmsFileQuery::byObject($srcObject, $srcId)->find() as $file) { try { //tworzenie kopii $copy = new \Mmi\Http\RequestFile([ 'name' => $file->original, 'tmp_name' => $file->getRealPath(), 'size' => $file->size ]); } catch (\Mmi\App\KernelException $e) { \Mmi\App\FrontController::getInstance()->getLogger()->warning('Unable to copy file, file not found: ' . $file->getRealPath()); continue; } $newFile = clone $file; $newFile->id = null; //dołączanie pliku self::_copyFile($copy, $destObject, $destId, $newFile); $i++; } return $i; }
[ "public", "static", "function", "copy", "(", "$", "srcObject", ",", "$", "srcId", ",", "$", "destObject", ",", "$", "destId", ")", "{", "$", "i", "=", "0", ";", "//kopiowanie plików", "foreach", "(", "CmsFileQuery", "::", "byObject", "(", "$", "srcObject...
Kopiuje plik z jednego obiektu na inny @param string $srcObject obiekt źródłowy @param int $srcId id źródła @param string $destObject obiekt docelowy @param int $destId docelowy id @return int ilość skopiowanych
[ "Kopiuje", "plik", "z", "jednego", "obiektu", "na", "inny" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Model/File.php#L142-L165
train
milejko/mmi-cms
src/Cms/Model/File.php
File._updateRecordFromRequestFile
protected static function _updateRecordFromRequestFile(\Mmi\Http\RequestFile $file, \Cms\Orm\CmsFileRecord $record) { //typ zasobu $record->mimeType = $file->type; //klasa zasobu $class = explode('/', $file->type); $record->class = $class[0]; //oryginalna nazwa pliku $record->original = $file->name; //rozmiar pliku $record->size = $file->size; //daty dodania i modyfikacji if (!$record->dateAdd) { $record->dateAdd = date('Y-m-d H:i:s'); } if (!$record->dateModify) { $record->dateModify = date('Y-m-d H:i:s'); } //właściciel pliku $record->cmsAuthId = \App\Registry::$auth ? \App\Registry::$auth->getId() : null; if ($record->active === null) { //domyślnie aktywny $record->active = 1; } return $record; }
php
protected static function _updateRecordFromRequestFile(\Mmi\Http\RequestFile $file, \Cms\Orm\CmsFileRecord $record) { //typ zasobu $record->mimeType = $file->type; //klasa zasobu $class = explode('/', $file->type); $record->class = $class[0]; //oryginalna nazwa pliku $record->original = $file->name; //rozmiar pliku $record->size = $file->size; //daty dodania i modyfikacji if (!$record->dateAdd) { $record->dateAdd = date('Y-m-d H:i:s'); } if (!$record->dateModify) { $record->dateModify = date('Y-m-d H:i:s'); } //właściciel pliku $record->cmsAuthId = \App\Registry::$auth ? \App\Registry::$auth->getId() : null; if ($record->active === null) { //domyślnie aktywny $record->active = 1; } return $record; }
[ "protected", "static", "function", "_updateRecordFromRequestFile", "(", "\\", "Mmi", "\\", "Http", "\\", "RequestFile", "$", "file", ",", "\\", "Cms", "\\", "Orm", "\\", "CmsFileRecord", "$", "record", ")", "{", "//typ zasobu", "$", "record", "->", "mimeType",...
Aktualizuje rekord na podstawie pliku z requestu @param \Mmi\Http\RequestFile $file plik z requesta @param \Cms\Orm\CmsFileRecord $record rekord pliku Cms @return CmsFileRecord rekord pliku
[ "Aktualizuje", "rekord", "na", "podstawie", "pliku", "z", "requestu" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Model/File.php#L264-L289
train
mapbender/fom
src/FOM/UserBundle/Controller/RegistrationController.php
RegistrationController.setContainer
public function setContainer(ContainerInterface $container = NULL) { parent::setContainer($container); if(!$this->container->getParameter('fom_user.selfregister')) throw new AccessDeniedHttpException(); }
php
public function setContainer(ContainerInterface $container = NULL) { parent::setContainer($container); if(!$this->container->getParameter('fom_user.selfregister')) throw new AccessDeniedHttpException(); }
[ "public", "function", "setContainer", "(", "ContainerInterface", "$", "container", "=", "NULL", ")", "{", "parent", "::", "setContainer", "(", "$", "container", ")", ";", "if", "(", "!", "$", "this", "->", "container", "->", "getParameter", "(", "'fom_user.s...
Check if self registration is allowed. setContainer is called after controller creation is used to deny access to controller if self registration has been disabled.
[ "Check", "if", "self", "registration", "is", "allowed", "." ]
6dea943121f3c3f9b1b4b14dc2a8e8640a120675
https://github.com/mapbender/fom/blob/6dea943121f3c3f9b1b4b14dc2a8e8640a120675/src/FOM/UserBundle/Controller/RegistrationController.php#L34-L40
train
oscarotero/GettextRobo
src/GettextScanner.php
TaskGettextScanner.extract
public function extract($path, $regex = null) { $directory = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS); $iterator = new RecursiveIteratorIterator($directory); if ($regex) { $iterator = new RegexIterator($iterator, $regex); } $this->iterator->attachIterator($iterator); return $this; }
php
public function extract($path, $regex = null) { $directory = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS); $iterator = new RecursiveIteratorIterator($directory); if ($regex) { $iterator = new RegexIterator($iterator, $regex); } $this->iterator->attachIterator($iterator); return $this; }
[ "public", "function", "extract", "(", "$", "path", ",", "$", "regex", "=", "null", ")", "{", "$", "directory", "=", "new", "RecursiveDirectoryIterator", "(", "$", "path", ",", "FilesystemIterator", "::", "SKIP_DOTS", ")", ";", "$", "iterator", "=", "new", ...
Add a new source folder. @param string $path @param null|string $regex @return $this
[ "Add", "a", "new", "source", "folder", "." ]
403ffbb17b28f35e9d561fbb428db3d64574e393
https://github.com/oscarotero/GettextRobo/blob/403ffbb17b28f35e9d561fbb428db3d64574e393/src/GettextScanner.php#L63-L75
train
oscarotero/GettextRobo
src/GettextScanner.php
TaskGettextScanner.scan
private function scan(Translations $translations) { foreach ($this->iterator as $each) { foreach ($each as $file) { if ($file === null || !$file->isFile()) { continue; } $target = $file->getPathname(); if (($fn = $this->getFunctionName('addFrom', $target, 'File'))) { $translations->$fn($target); } } } }
php
private function scan(Translations $translations) { foreach ($this->iterator as $each) { foreach ($each as $file) { if ($file === null || !$file->isFile()) { continue; } $target = $file->getPathname(); if (($fn = $this->getFunctionName('addFrom', $target, 'File'))) { $translations->$fn($target); } } } }
[ "private", "function", "scan", "(", "Translations", "$", "translations", ")", "{", "foreach", "(", "$", "this", "->", "iterator", "as", "$", "each", ")", "{", "foreach", "(", "$", "each", "as", "$", "file", ")", "{", "if", "(", "$", "file", "===", ...
Execute the scan. @param Translations $translations
[ "Execute", "the", "scan", "." ]
403ffbb17b28f35e9d561fbb428db3d64574e393
https://github.com/oscarotero/GettextRobo/blob/403ffbb17b28f35e9d561fbb428db3d64574e393/src/GettextScanner.php#L129-L144
train
oscarotero/GettextRobo
src/GettextScanner.php
TaskGettextScanner.getFunctionName
private function getFunctionName($prefix, $file, $suffix, $key = 0) { if (preg_match(self::getRegex(), strtolower($file), $matches)) { $format = self::$suffixes[$matches[1]]; if (is_array($format)) { $format = $format[$key]; } return sprintf('%s%s%s', $prefix, $format, $suffix); } }
php
private function getFunctionName($prefix, $file, $suffix, $key = 0) { if (preg_match(self::getRegex(), strtolower($file), $matches)) { $format = self::$suffixes[$matches[1]]; if (is_array($format)) { $format = $format[$key]; } return sprintf('%s%s%s', $prefix, $format, $suffix); } }
[ "private", "function", "getFunctionName", "(", "$", "prefix", ",", "$", "file", ",", "$", "suffix", ",", "$", "key", "=", "0", ")", "{", "if", "(", "preg_match", "(", "self", "::", "getRegex", "(", ")", ",", "strtolower", "(", "$", "file", ")", ","...
Get the format based in the extension. @param string $file @return string|null
[ "Get", "the", "format", "based", "in", "the", "extension", "." ]
403ffbb17b28f35e9d561fbb428db3d64574e393
https://github.com/oscarotero/GettextRobo/blob/403ffbb17b28f35e9d561fbb428db3d64574e393/src/GettextScanner.php#L153-L164
train
oscarotero/GettextRobo
src/GettextScanner.php
TaskGettextScanner.getRegex
private static function getRegex() { if (self::$regex === null) { self::$regex = '/('.str_replace('.', '\\.', implode('|', array_keys(self::$suffixes))).')$/'; } return self::$regex; }
php
private static function getRegex() { if (self::$regex === null) { self::$regex = '/('.str_replace('.', '\\.', implode('|', array_keys(self::$suffixes))).')$/'; } return self::$regex; }
[ "private", "static", "function", "getRegex", "(", ")", "{", "if", "(", "self", "::", "$", "regex", "===", "null", ")", "{", "self", "::", "$", "regex", "=", "'/('", ".", "str_replace", "(", "'.'", ",", "'\\\\.'", ",", "implode", "(", "'|'", ",", "a...
Returns the regular expression to detect the file format. @param string
[ "Returns", "the", "regular", "expression", "to", "detect", "the", "file", "format", "." ]
403ffbb17b28f35e9d561fbb428db3d64574e393
https://github.com/oscarotero/GettextRobo/blob/403ffbb17b28f35e9d561fbb428db3d64574e393/src/GettextScanner.php#L171-L178
train
mapbender/fom
src/FOM/UserBundle/Security/UserHelper.php
UserHelper.setPassword
public function setPassword(User $user, $password) { $encoder = $this->container->get('security.encoder_factory') ->getEncoder($user); $salt = $this->createSalt(); $encryptedPassword = $encoder->encodePassword($password, $salt); $user ->setPassword($encryptedPassword) ->setSalt($salt); }
php
public function setPassword(User $user, $password) { $encoder = $this->container->get('security.encoder_factory') ->getEncoder($user); $salt = $this->createSalt(); $encryptedPassword = $encoder->encodePassword($password, $salt); $user ->setPassword($encryptedPassword) ->setSalt($salt); }
[ "public", "function", "setPassword", "(", "User", "$", "user", ",", "$", "password", ")", "{", "$", "encoder", "=", "$", "this", "->", "container", "->", "get", "(", "'security.encoder_factory'", ")", "->", "getEncoder", "(", "$", "user", ")", ";", "$", ...
Set salt, encrypt password and set it on the user object @param User $user User object to manipulate @param string $password Password to encrypt and store
[ "Set", "salt", "encrypt", "password", "and", "set", "it", "on", "the", "user", "object" ]
6dea943121f3c3f9b1b4b14dc2a8e8640a120675
https://github.com/mapbender/fom/blob/6dea943121f3c3f9b1b4b14dc2a8e8640a120675/src/FOM/UserBundle/Security/UserHelper.php#L30-L42
train
mapbender/fom
src/FOM/UserBundle/Security/UserHelper.php
UserHelper.createSalt
private function createSalt($max = 15) { $characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $i = 0; $salt = ""; do { $salt .= $characterList{mt_rand(0,strlen($characterList)-1)}; $i++; } while ($i < $max); return $salt; }
php
private function createSalt($max = 15) { $characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $i = 0; $salt = ""; do { $salt .= $characterList{mt_rand(0,strlen($characterList)-1)}; $i++; } while ($i < $max); return $salt; }
[ "private", "function", "createSalt", "(", "$", "max", "=", "15", ")", "{", "$", "characterList", "=", "\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"", ";", "$", "i", "=", "0", ";", "$", "salt", "=", "\"\"", ";", "do", "{", "$", "salt", "...
Generate a salt for storing the encrypted password Taken from http://code.activestate.com/recipes/576894-generate-a-salt/ @param int $max Length of salt @return string
[ "Generate", "a", "salt", "for", "storing", "the", "encrypted", "password" ]
6dea943121f3c3f9b1b4b14dc2a8e8640a120675
https://github.com/mapbender/fom/blob/6dea943121f3c3f9b1b4b14dc2a8e8640a120675/src/FOM/UserBundle/Security/UserHelper.php#L52-L63
train
mapbender/fom
src/FOM/UserBundle/Security/UserHelper.php
UserHelper.giveOwnRights
public function giveOwnRights($user) { $aclProvider = $this->container->get('security.acl.provider'); $maskBuilder = new MaskBuilder(); $usid = UserSecurityIdentity::fromAccount($user); $uoid = ObjectIdentity::fromDomainObject($user); foreach($this->container->getParameter("fom_user.user_own_permissions") as $permission) { $maskBuilder->add($permission); } $umask = $maskBuilder->get(); try { $acl = $aclProvider->findAcl($uoid); } catch(\Exception $e) { $acl = $aclProvider->createAcl($uoid); } $acl->insertObjectAce($usid, $umask); $aclProvider->updateAcl($acl); }
php
public function giveOwnRights($user) { $aclProvider = $this->container->get('security.acl.provider'); $maskBuilder = new MaskBuilder(); $usid = UserSecurityIdentity::fromAccount($user); $uoid = ObjectIdentity::fromDomainObject($user); foreach($this->container->getParameter("fom_user.user_own_permissions") as $permission) { $maskBuilder->add($permission); } $umask = $maskBuilder->get(); try { $acl = $aclProvider->findAcl($uoid); } catch(\Exception $e) { $acl = $aclProvider->createAcl($uoid); } $acl->insertObjectAce($usid, $umask); $aclProvider->updateAcl($acl); }
[ "public", "function", "giveOwnRights", "(", "$", "user", ")", "{", "$", "aclProvider", "=", "$", "this", "->", "container", "->", "get", "(", "'security.acl.provider'", ")", ";", "$", "maskBuilder", "=", "new", "MaskBuilder", "(", ")", ";", "$", "usid", ...
Gives a user the right to edit himself.
[ "Gives", "a", "user", "the", "right", "to", "edit", "himself", "." ]
6dea943121f3c3f9b1b4b14dc2a8e8640a120675
https://github.com/mapbender/fom/blob/6dea943121f3c3f9b1b4b14dc2a8e8640a120675/src/FOM/UserBundle/Security/UserHelper.php#L68-L86
train
manaphp/framework
Cli/Controllers/MongodbController.php
MongodbController.modelCommand
public function modelCommand($input, $modelName, $optimized = false) { if (strpos($modelName, '\\') === false) { $modelName = 'App\\Models\\' . ucfirst($modelName); } $fieldTypes = $this->_inferFieldTypes([$input]); $model = $this->_renderModel($fieldTypes, $modelName, 'mongodb', $optimized); $file = '@tmp/mongodb_model/' . substr($modelName, strrpos($modelName, '\\') + 1) . '.php'; $this->filesystem->filePut($file, $model); $this->console->writeLn(['write model to :file', 'file' => $file]); }
php
public function modelCommand($input, $modelName, $optimized = false) { if (strpos($modelName, '\\') === false) { $modelName = 'App\\Models\\' . ucfirst($modelName); } $fieldTypes = $this->_inferFieldTypes([$input]); $model = $this->_renderModel($fieldTypes, $modelName, 'mongodb', $optimized); $file = '@tmp/mongodb_model/' . substr($modelName, strrpos($modelName, '\\') + 1) . '.php'; $this->filesystem->filePut($file, $model); $this->console->writeLn(['write model to :file', 'file' => $file]); }
[ "public", "function", "modelCommand", "(", "$", "input", ",", "$", "modelName", ",", "$", "optimized", "=", "false", ")", "{", "if", "(", "strpos", "(", "$", "modelName", ",", "'\\\\'", ")", "===", "false", ")", "{", "$", "modelName", "=", "'App\\\\Mod...
generate model file from base64 encoded string @param string $input the base64 encoded json string @param string $modelName @param bool $optimized output as more methods as possible
[ "generate", "model", "file", "from", "base64", "encoded", "string" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Cli/Controllers/MongodbController.php#L51-L63
train
manaphp/framework
Cli/Controllers/MongodbController.php
MongodbController.modelsCommand
public function modelsCommand($services = [], $namespace = 'App\Models', $optimized = false, $sample = 1000, $db = []) { if (strpos($namespace, '\\') === false) { $namespace = 'App\\' . ucfirst($namespace) . '\\Models'; } foreach ($this->_getServices($services) as $service) { /** * @var \ManaPHP\Mongodb $mongodb */ $mongodb = $this->_di->getShared($service); $defaultDb = $mongodb->getDefaultDb(); foreach ($defaultDb ? [$defaultDb] : $mongodb->listDatabases() as $cdb) { if (in_array($cdb, ['admin', 'local'], true) || ($db && !in_array($cdb, $db, true))) { continue; } foreach ($mongodb->listCollections($cdb) as $collection) { if (strpos($collection, '.')) { continue; } if (!$docs = $mongodb->aggregate("$cdb.$collection", [['$sample' => ['size' => $sample]]])) { continue; } $plainClass = Text::camelize($collection); $fileName = "@tmp/mongodb_models/$plainClass.php"; $this->console->progress(['`:collection` processing...', 'collection' => $collection], ''); $fieldTypes = $this->_inferFieldTypes($docs); $modelClass = $namespace . '\\' . $plainClass; $model = $this->_renderModel($fieldTypes, $modelClass, $service, $defaultDb ? $collection : "$cdb.$collection", $optimized); $this->filesystem->filePut($fileName, $model); $this->console->progress([ ' `:namespace` collection saved to `:file`', 'namespace' => "$cdb.$collection", 'file' => $fileName]); $pending_fields = []; foreach ($fieldTypes as $field => $type) { if ($type === '' || strpos($type, '|') !== false) { $pending_fields[] = $field; } } if ($pending_fields) { $this->console->warn(['`:collection` has pending fields: :fields', 'collection' => $collection, 'fields' => implode(', ', $pending_fields)]); } } } } }
php
public function modelsCommand($services = [], $namespace = 'App\Models', $optimized = false, $sample = 1000, $db = []) { if (strpos($namespace, '\\') === false) { $namespace = 'App\\' . ucfirst($namespace) . '\\Models'; } foreach ($this->_getServices($services) as $service) { /** * @var \ManaPHP\Mongodb $mongodb */ $mongodb = $this->_di->getShared($service); $defaultDb = $mongodb->getDefaultDb(); foreach ($defaultDb ? [$defaultDb] : $mongodb->listDatabases() as $cdb) { if (in_array($cdb, ['admin', 'local'], true) || ($db && !in_array($cdb, $db, true))) { continue; } foreach ($mongodb->listCollections($cdb) as $collection) { if (strpos($collection, '.')) { continue; } if (!$docs = $mongodb->aggregate("$cdb.$collection", [['$sample' => ['size' => $sample]]])) { continue; } $plainClass = Text::camelize($collection); $fileName = "@tmp/mongodb_models/$plainClass.php"; $this->console->progress(['`:collection` processing...', 'collection' => $collection], ''); $fieldTypes = $this->_inferFieldTypes($docs); $modelClass = $namespace . '\\' . $plainClass; $model = $this->_renderModel($fieldTypes, $modelClass, $service, $defaultDb ? $collection : "$cdb.$collection", $optimized); $this->filesystem->filePut($fileName, $model); $this->console->progress([ ' `:namespace` collection saved to `:file`', 'namespace' => "$cdb.$collection", 'file' => $fileName]); $pending_fields = []; foreach ($fieldTypes as $field => $type) { if ($type === '' || strpos($type, '|') !== false) { $pending_fields[] = $field; } } if ($pending_fields) { $this->console->warn(['`:collection` has pending fields: :fields', 'collection' => $collection, 'fields' => implode(', ', $pending_fields)]); } } } } }
[ "public", "function", "modelsCommand", "(", "$", "services", "=", "[", "]", ",", "$", "namespace", "=", "'App\\Models'", ",", "$", "optimized", "=", "false", ",", "$", "sample", "=", "1000", ",", "$", "db", "=", "[", "]", ")", "{", "if", "(", "strp...
generate models file from data files or online data @param array $services explicit the mongodb service name @param string $namespace namespaces of models @param bool $optimized output as more methods as possible @param int $sample sample size @param array $db db name list @throws \ManaPHP\Mongodb\Exception
[ "generate", "models", "file", "from", "data", "files", "or", "online", "data" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Cli/Controllers/MongodbController.php#L76-L133
train
manaphp/framework
Cli/Controllers/MongodbController.php
MongodbController.csvCommand
public function csvCommand($services = [], $collection_pattern = '', $bom = false) { foreach ($this->_getServices($services) as $service) { /** * @var \ManaPHP\Mongodb $mongodb */ $mongodb = $this->_di->getShared($service); $defaultDb = $mongodb->getDefaultDb(); foreach ($defaultDb ? [$defaultDb] : $mongodb->listDatabases() as $db) { if (in_array($db, ['admin', 'local'], true)) { continue; } foreach ($mongodb->listCollections($db) as $collection) { if ($collection_pattern && !fnmatch($collection_pattern, $collection)) { continue; } $fileName = "@tmp/mongodb_csv/$db/$collection.csv"; $this->console->progress(['`:collection` processing...', 'collection' => $collection], ''); $this->filesystem->dirCreate(dirname($fileName)); $file = fopen($this->alias->resolve($fileName), 'wb'); if ($bom) { fprintf($file, "\xEF\xBB\xBF"); } $docs = $mongodb->fetchAll("$db.$collection"); if ($docs) { $columns = []; foreach ($docs[0] as $k => $v) { if ($k === '_id' && is_object($v)) { continue; } $columns[] = $k; } fputcsv($file, $columns); } $linesCount = 0; $startTime = microtime(true); if (count($docs) !== 0) { foreach ($docs as $doc) { $line = []; foreach ($doc as $k => $v) { if ($k === '_id' && is_object($v)) { continue; } $line[] = $v; } $linesCount++; fputcsv($file, $line); } } fclose($file); $this->console->progress(['write to `:file` success: :count [:time]', 'file' => $fileName, 'count' => $linesCount, 'time' => round(microtime(true) - $startTime, 4)]); /** @noinspection DisconnectedForeachInstructionInspection */ } } } }
php
public function csvCommand($services = [], $collection_pattern = '', $bom = false) { foreach ($this->_getServices($services) as $service) { /** * @var \ManaPHP\Mongodb $mongodb */ $mongodb = $this->_di->getShared($service); $defaultDb = $mongodb->getDefaultDb(); foreach ($defaultDb ? [$defaultDb] : $mongodb->listDatabases() as $db) { if (in_array($db, ['admin', 'local'], true)) { continue; } foreach ($mongodb->listCollections($db) as $collection) { if ($collection_pattern && !fnmatch($collection_pattern, $collection)) { continue; } $fileName = "@tmp/mongodb_csv/$db/$collection.csv"; $this->console->progress(['`:collection` processing...', 'collection' => $collection], ''); $this->filesystem->dirCreate(dirname($fileName)); $file = fopen($this->alias->resolve($fileName), 'wb'); if ($bom) { fprintf($file, "\xEF\xBB\xBF"); } $docs = $mongodb->fetchAll("$db.$collection"); if ($docs) { $columns = []; foreach ($docs[0] as $k => $v) { if ($k === '_id' && is_object($v)) { continue; } $columns[] = $k; } fputcsv($file, $columns); } $linesCount = 0; $startTime = microtime(true); if (count($docs) !== 0) { foreach ($docs as $doc) { $line = []; foreach ($doc as $k => $v) { if ($k === '_id' && is_object($v)) { continue; } $line[] = $v; } $linesCount++; fputcsv($file, $line); } } fclose($file); $this->console->progress(['write to `:file` success: :count [:time]', 'file' => $fileName, 'count' => $linesCount, 'time' => round(microtime(true) - $startTime, 4)]); /** @noinspection DisconnectedForeachInstructionInspection */ } } } }
[ "public", "function", "csvCommand", "(", "$", "services", "=", "[", "]", ",", "$", "collection_pattern", "=", "''", ",", "$", "bom", "=", "false", ")", "{", "foreach", "(", "$", "this", "->", "_getServices", "(", "$", "services", ")", "as", "$", "ser...
export mongodb data to csv files @param array $services services list @param string $collection_pattern match collection against a pattern @param bool $bom contains BOM or not
[ "export", "mongodb", "data", "to", "csv", "files" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Cli/Controllers/MongodbController.php#L351-L424
train
manaphp/framework
Cli/Controllers/MongodbController.php
MongodbController.listCommand
public function listCommand($services = [], $collection_pattern = '', $field = '', $db = []) { foreach ($this->_getServices($services) as $service) { /** * @var \ManaPHP\Mongodb $mongodb */ $mongodb = $this->_di->getShared($service); $defaultDb = $mongodb->getDefaultDb(); foreach ($defaultDb ? [$defaultDb] : $mongodb->listDatabases() as $cdb) { if ($db && !in_array($cdb, $db, true)) { continue; } $this->console->writeLn(['---`:db` db of `:service` service---', 'db' => $cdb, 'service' => $service], Console::BC_CYAN); foreach ($mongodb->listCollections($cdb) as $row => $collection) { if ($collection_pattern && !fnmatch($collection_pattern, $collection)) { continue; } if ($field) { if (!$docs = $mongodb->fetchAll("$cdb.$collection", [$field => ['$exists' => 1]], ['limit' => 1])) { continue; } } else { $docs = $mongodb->fetchAll("$cdb.$collection", [], ['limit' => 1]); } $columns = $docs ? array_keys($docs[0]) : []; $this->console->writeLn([' :row :namespace(:columns)', 'row' => sprintf('%2d ', $row + 1), 'namespace' => $this->console->colorize("$cdb.$collection", Console::FC_GREEN), 'columns' => implode(', ', $columns)]); } } } }
php
public function listCommand($services = [], $collection_pattern = '', $field = '', $db = []) { foreach ($this->_getServices($services) as $service) { /** * @var \ManaPHP\Mongodb $mongodb */ $mongodb = $this->_di->getShared($service); $defaultDb = $mongodb->getDefaultDb(); foreach ($defaultDb ? [$defaultDb] : $mongodb->listDatabases() as $cdb) { if ($db && !in_array($cdb, $db, true)) { continue; } $this->console->writeLn(['---`:db` db of `:service` service---', 'db' => $cdb, 'service' => $service], Console::BC_CYAN); foreach ($mongodb->listCollections($cdb) as $row => $collection) { if ($collection_pattern && !fnmatch($collection_pattern, $collection)) { continue; } if ($field) { if (!$docs = $mongodb->fetchAll("$cdb.$collection", [$field => ['$exists' => 1]], ['limit' => 1])) { continue; } } else { $docs = $mongodb->fetchAll("$cdb.$collection", [], ['limit' => 1]); } $columns = $docs ? array_keys($docs[0]) : []; $this->console->writeLn([' :row :namespace(:columns)', 'row' => sprintf('%2d ', $row + 1), 'namespace' => $this->console->colorize("$cdb.$collection", Console::FC_GREEN), 'columns' => implode(', ', $columns)]); } } } }
[ "public", "function", "listCommand", "(", "$", "services", "=", "[", "]", ",", "$", "collection_pattern", "=", "''", ",", "$", "field", "=", "''", ",", "$", "db", "=", "[", "]", ")", "{", "foreach", "(", "$", "this", "->", "_getServices", "(", "$",...
list databases and collections @param array $services services list @param string $collection_pattern match collection against a pattern @param string $field collection must contains one this field @param array $db
[ "list", "databases", "and", "collections" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Cli/Controllers/MongodbController.php#L434-L469
train
Jalle19/php-tvheadend
src/model/Filter.php
Filter.addDefinition
public function addDefinition($type, $value, $field) { $definition = new \stdClass(); $definition->type = $type; $definition->value = $value; $definition->field = $field; $this->_filter[] = $definition; }
php
public function addDefinition($type, $value, $field) { $definition = new \stdClass(); $definition->type = $type; $definition->value = $value; $definition->field = $field; $this->_filter[] = $definition; }
[ "public", "function", "addDefinition", "(", "$", "type", ",", "$", "value", ",", "$", "field", ")", "{", "$", "definition", "=", "new", "\\", "stdClass", "(", ")", ";", "$", "definition", "->", "type", "=", "$", "type", ";", "$", "definition", "->", ...
Adds a new filter definition @param string $type the filter type @param mixed $value the filter value @param string $field the field/column the filter applies to
[ "Adds", "a", "new", "filter", "definition" ]
8fad6570f267ba573ca78b243cff7797b6cf8bbf
https://github.com/Jalle19/php-tvheadend/blob/8fad6570f267ba573ca78b243cff7797b6cf8bbf/src/model/Filter.php#L40-L48
train
stanislav-web/Searcher
src/Searcher/Exceptions/Model.php
Model.rise
public function rise(array $params, $line, $filename) { $this->invoke = [ 'MODEL_DOES_NOT_EXISTS' => function ($params, $filename, $line) { // set message for not existing column $this->message = "Model `" . $params[1] . "` not exists. File: " . $filename . " Line: " . $line; }]; $this->invoke[current($params)]($params, $filename, $line); return $this; }
php
public function rise(array $params, $line, $filename) { $this->invoke = [ 'MODEL_DOES_NOT_EXISTS' => function ($params, $filename, $line) { // set message for not existing column $this->message = "Model `" . $params[1] . "` not exists. File: " . $filename . " Line: " . $line; }]; $this->invoke[current($params)]($params, $filename, $line); return $this; }
[ "public", "function", "rise", "(", "array", "$", "params", ",", "$", "line", ",", "$", "filename", ")", "{", "$", "this", "->", "invoke", "=", "[", "'MODEL_DOES_NOT_EXISTS'", "=>", "function", "(", "$", "params", ",", "$", "filename", ",", "$", "line",...
Rise error message for Model Exceptions @param array $params message params @param int $line error line @param string $filename file error @return \Searcher\Searcher\Exceptions\Model
[ "Rise", "error", "message", "for", "Model", "Exceptions" ]
bf01156d1a2416ceddef0d238469563b74087d44
https://github.com/stanislav-web/Searcher/blob/bf01156d1a2416ceddef0d238469563b74087d44/src/Searcher/Exceptions/Model.php#L41-L54
train
Erdiko/users
src/controllers/RoleAjax.php
RoleAjax.postDeleteRole
public function postDeleteRole() { $response = (object)array( 'method' => 'deleterole', 'success' => false, 'status' => 200, 'error_code' => 0, 'error_message' => '' ); // decode json data $data = json_decode(file_get_contents("php://input")); if( empty($data)) { $data = (object) $_POST; } $requiredParams = array('id'); try { AuthorizerHelper::can(RoleValidator::ROLE_CAN_DELETE); $data = (array) $data; foreach ($requiredParams as $param){ if (empty($data[$param])) { throw new \Exception(ucfirst($param) .' is required.'); } } $roleModel = new \erdiko\users\models\Role(); $roleId = $roleModel->delete($data['id']); $responseRoleId = array('id' => $roleId); $response->success = true; $response->role = $responseRoleId; unset($response->error_code); unset($response->error_message); } catch (\Exception $e) { $response->success = false; $response->error_code = $e->getCode(); $response->error_message = $e->getMessage(); } $this->setContent($response); }
php
public function postDeleteRole() { $response = (object)array( 'method' => 'deleterole', 'success' => false, 'status' => 200, 'error_code' => 0, 'error_message' => '' ); // decode json data $data = json_decode(file_get_contents("php://input")); if( empty($data)) { $data = (object) $_POST; } $requiredParams = array('id'); try { AuthorizerHelper::can(RoleValidator::ROLE_CAN_DELETE); $data = (array) $data; foreach ($requiredParams as $param){ if (empty($data[$param])) { throw new \Exception(ucfirst($param) .' is required.'); } } $roleModel = new \erdiko\users\models\Role(); $roleId = $roleModel->delete($data['id']); $responseRoleId = array('id' => $roleId); $response->success = true; $response->role = $responseRoleId; unset($response->error_code); unset($response->error_message); } catch (\Exception $e) { $response->success = false; $response->error_code = $e->getCode(); $response->error_message = $e->getMessage(); } $this->setContent($response); }
[ "public", "function", "postDeleteRole", "(", ")", "{", "$", "response", "=", "(", "object", ")", "array", "(", "'method'", "=>", "'deleterole'", ",", "'success'", "=>", "false", ",", "'status'", "=>", "200", ",", "'error_code'", "=>", "0", ",", "'error_mes...
delete a given role
[ "delete", "a", "given", "role" ]
a063e0c61ceccdbfeaf7750e92bac8c3565c39a9
https://github.com/Erdiko/users/blob/a063e0c61ceccdbfeaf7750e92bac8c3565c39a9/src/controllers/RoleAjax.php#L345-L383
train
manaphp/framework
View/Flash.php
Flash.output
public function output($remove = true) { $context = $this->_context; foreach ($context->messages as $message) { echo $message; } if ($remove) { $context->messages = []; } }
php
public function output($remove = true) { $context = $this->_context; foreach ($context->messages as $message) { echo $message; } if ($remove) { $context->messages = []; } }
[ "public", "function", "output", "(", "$", "remove", "=", "true", ")", "{", "$", "context", "=", "$", "this", "->", "_context", ";", "foreach", "(", "$", "context", "->", "messages", "as", "$", "message", ")", "{", "echo", "$", "message", ";", "}", ...
Prints the messages in the session flasher @param bool $remove @return void
[ "Prints", "the", "messages", "in", "the", "session", "flasher" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/View/Flash.php#L99-L110
train
milejko/mmi-cms
src/CmsAdmin/TextController.php
TextController.editAction
public function editAction() { $form = new \CmsAdmin\Form\Text(new \Cms\Orm\CmsTextRecord($this->id)); $this->view->textForm = $form; //brak wysłanych danych if (!$form->isMine()) { return; } //zapisany if ($form->isSaved()) { $this->getMessenger()->addMessage('messenger.text.text.saved', true); $this->getResponse()->redirect('cmsAdmin', 'text'); } $this->getMessenger()->addMessage('messenger.text.text.error', false); }
php
public function editAction() { $form = new \CmsAdmin\Form\Text(new \Cms\Orm\CmsTextRecord($this->id)); $this->view->textForm = $form; //brak wysłanych danych if (!$form->isMine()) { return; } //zapisany if ($form->isSaved()) { $this->getMessenger()->addMessage('messenger.text.text.saved', true); $this->getResponse()->redirect('cmsAdmin', 'text'); } $this->getMessenger()->addMessage('messenger.text.text.error', false); }
[ "public", "function", "editAction", "(", ")", "{", "$", "form", "=", "new", "\\", "CmsAdmin", "\\", "Form", "\\", "Text", "(", "new", "\\", "Cms", "\\", "Orm", "\\", "CmsTextRecord", "(", "$", "this", "->", "id", ")", ")", ";", "$", "this", "->", ...
Akcja edycji tekstu
[ "Akcja", "edycji", "tekstu" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/CmsAdmin/TextController.php#L30-L44
train
GromNaN/TubeLink
src/TubeLink/Service/Youtube.php
Youtube.getThumbnailUrl
public function getThumbnailUrl(Tube $video) { if (0 === strlen($this->thumbnailSize)) { return false; } return sprintf('http://img.youtube.com/vi/%s/%s.jpg', $video->id, $this->thumbnailSize); }
php
public function getThumbnailUrl(Tube $video) { if (0 === strlen($this->thumbnailSize)) { return false; } return sprintf('http://img.youtube.com/vi/%s/%s.jpg', $video->id, $this->thumbnailSize); }
[ "public", "function", "getThumbnailUrl", "(", "Tube", "$", "video", ")", "{", "if", "(", "0", "===", "strlen", "(", "$", "this", "->", "thumbnailSize", ")", ")", "{", "return", "false", ";", "}", "return", "sprintf", "(", "'http://img.youtube.com/vi/%s/%s.jp...
Get the thumbnail from a given URL. @param Tube $video Tube object @return string Thumbnail url
[ "Get", "the", "thumbnail", "from", "a", "given", "URL", "." ]
a1d9bdd0c92b043d297b95e8069a5b30ceaded9a
https://github.com/GromNaN/TubeLink/blob/a1d9bdd0c92b043d297b95e8069a5b30ceaded9a/src/TubeLink/Service/Youtube.php#L104-L111
train
Ma27/Ma27ApiKeyAuthenticationBundle
Service/Mapping/ClassMetadata.php
ClassMetadata.getPropertyValue
public function getPropertyValue($user, $property = self::LOGIN_PROPERTY, $strict = false) { if ($this->checkProperty($property, $strict)) { $oid = spl_object_hash($user); if (null !== $cacheHit = $this->resolveCache($oid, $property)) { return $cacheHit; } if (is_string($this->properties[$property])) { $this->properties[$property] = new ReflectionProperty($user, $this->properties[$property]); } $this->properties[$property]->setAccessible(true); return $this->lazyValueCache[$oid][$property] = $this->properties[$property]->getValue($user); } }
php
public function getPropertyValue($user, $property = self::LOGIN_PROPERTY, $strict = false) { if ($this->checkProperty($property, $strict)) { $oid = spl_object_hash($user); if (null !== $cacheHit = $this->resolveCache($oid, $property)) { return $cacheHit; } if (is_string($this->properties[$property])) { $this->properties[$property] = new ReflectionProperty($user, $this->properties[$property]); } $this->properties[$property]->setAccessible(true); return $this->lazyValueCache[$oid][$property] = $this->properties[$property]->getValue($user); } }
[ "public", "function", "getPropertyValue", "(", "$", "user", ",", "$", "property", "=", "self", "::", "LOGIN_PROPERTY", ",", "$", "strict", "=", "false", ")", "{", "if", "(", "$", "this", "->", "checkProperty", "(", "$", "property", ",", "$", "strict", ...
Gets the value of the given property. @param object $user @param string $property @param bool $strict @return mixed
[ "Gets", "the", "value", "of", "the", "given", "property", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/Service/Mapping/ClassMetadata.php#L73-L88
train
Ma27/Ma27ApiKeyAuthenticationBundle
Service/Mapping/ClassMetadata.php
ClassMetadata.getPropertyName
public function getPropertyName($property = self::LOGIN_PROPERTY, $strict = false) { if ($this->checkProperty($property, $strict)) { if (is_string($this->properties[$property])) { return $this->properties[$property]; } if (isset($this->lazyPropertyNameCache[$property])) { return $this->lazyPropertyNameCache[$property]; } return $this->lazyPropertyNameCache[$property] = $this->properties[$property]->getName(); } }
php
public function getPropertyName($property = self::LOGIN_PROPERTY, $strict = false) { if ($this->checkProperty($property, $strict)) { if (is_string($this->properties[$property])) { return $this->properties[$property]; } if (isset($this->lazyPropertyNameCache[$property])) { return $this->lazyPropertyNameCache[$property]; } return $this->lazyPropertyNameCache[$property] = $this->properties[$property]->getName(); } }
[ "public", "function", "getPropertyName", "(", "$", "property", "=", "self", "::", "LOGIN_PROPERTY", ",", "$", "strict", "=", "false", ")", "{", "if", "(", "$", "this", "->", "checkProperty", "(", "$", "property", ",", "$", "strict", ")", ")", "{", "if"...
Gets the name of a specific property by its metadata constant. @param string $property @param bool $strict @return null|string
[ "Gets", "the", "name", "of", "a", "specific", "property", "by", "its", "metadata", "constant", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/Service/Mapping/ClassMetadata.php#L98-L110
train
Ma27/Ma27ApiKeyAuthenticationBundle
Service/Mapping/ClassMetadata.php
ClassMetadata.modifyProperty
public function modifyProperty($user, $newValue, $property = self::LOGIN_PROPERTY) { $this->checkProperty($property, true); $propertyObject = $this->properties[$property]; if (is_string($propertyObject)) { $this->properties[$property] = $propertyObject = new ReflectionProperty($user, $propertyObject); } $propertyObject->setAccessible(true); $propertyObject->setValue($user, $newValue); $oid = spl_object_hash($user); if (!array_key_exists($oid, $this->lazyValueCache)) { $this->lazyValueCache[$oid] = array(); } $this->lazyValueCache[$oid][$property] = $newValue; }
php
public function modifyProperty($user, $newValue, $property = self::LOGIN_PROPERTY) { $this->checkProperty($property, true); $propertyObject = $this->properties[$property]; if (is_string($propertyObject)) { $this->properties[$property] = $propertyObject = new ReflectionProperty($user, $propertyObject); } $propertyObject->setAccessible(true); $propertyObject->setValue($user, $newValue); $oid = spl_object_hash($user); if (!array_key_exists($oid, $this->lazyValueCache)) { $this->lazyValueCache[$oid] = array(); } $this->lazyValueCache[$oid][$property] = $newValue; }
[ "public", "function", "modifyProperty", "(", "$", "user", ",", "$", "newValue", ",", "$", "property", "=", "self", "::", "LOGIN_PROPERTY", ")", "{", "$", "this", "->", "checkProperty", "(", "$", "property", ",", "true", ")", ";", "$", "propertyObject", "...
Modifies a property and clears the cache. @param object $user @param mixed $newValue @param string $property
[ "Modifies", "a", "property", "and", "clears", "the", "cache", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/Service/Mapping/ClassMetadata.php#L119-L137
train
Ma27/Ma27ApiKeyAuthenticationBundle
Service/Mapping/ClassMetadata.php
ClassMetadata.checkProperty
private function checkProperty($property = self::LOGIN_PROPERTY, $strict = false) { if (!isset($this->properties[$property])) { if ($strict) { throw new \LogicException(sprintf( 'Cannot get property "%s"!', $property )); } return false; } return true; }
php
private function checkProperty($property = self::LOGIN_PROPERTY, $strict = false) { if (!isset($this->properties[$property])) { if ($strict) { throw new \LogicException(sprintf( 'Cannot get property "%s"!', $property )); } return false; } return true; }
[ "private", "function", "checkProperty", "(", "$", "property", "=", "self", "::", "LOGIN_PROPERTY", ",", "$", "strict", "=", "false", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "properties", "[", "$", "property", "]", ")", ")", "{", "i...
Validates a property. @param string $property @param bool $strict @return bool
[ "Validates", "a", "property", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/Service/Mapping/ClassMetadata.php#L147-L161
train
Ma27/Ma27ApiKeyAuthenticationBundle
Service/Mapping/ClassMetadata.php
ClassMetadata.resolveCache
private function resolveCache($oid, $property) { if (isset($this->lazyValueCache[$oid])) { if (isset($this->lazyValueCache[$oid][$property])) { return $this->lazyValueCache[$oid][$property]; } return; } $this->lazyValueCache[$oid] = array(); }
php
private function resolveCache($oid, $property) { if (isset($this->lazyValueCache[$oid])) { if (isset($this->lazyValueCache[$oid][$property])) { return $this->lazyValueCache[$oid][$property]; } return; } $this->lazyValueCache[$oid] = array(); }
[ "private", "function", "resolveCache", "(", "$", "oid", ",", "$", "property", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "lazyValueCache", "[", "$", "oid", "]", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "lazyValueCache", ...
Resolves the lazy value cache. @param string $oid @param string $property @return mixed|null
[ "Resolves", "the", "lazy", "value", "cache", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/Service/Mapping/ClassMetadata.php#L171-L182
train
vtalbot/repository-generator
src/RepositoryGeneratorServiceProvider.php
RepositoryGeneratorServiceProvider.registerMakeCommand
protected function registerMakeCommand() { $this->app->singleton('command.repository.make', function ($app) { $prefix = $app['config']['repository.prefix']; $suffix = $app['config']['repository.suffix']; $contract = $app['config']['repository.contract']; $namespace = $app['config']['repository.namespace']; $creator = $app['repository.creator']; $files = $app['files']; return new RepositoryMakeCommand($creator, $prefix, $suffix, $contract, $namespace, $files); }); $this->commands('command.repository.make'); }
php
protected function registerMakeCommand() { $this->app->singleton('command.repository.make', function ($app) { $prefix = $app['config']['repository.prefix']; $suffix = $app['config']['repository.suffix']; $contract = $app['config']['repository.contract']; $namespace = $app['config']['repository.namespace']; $creator = $app['repository.creator']; $files = $app['files']; return new RepositoryMakeCommand($creator, $prefix, $suffix, $contract, $namespace, $files); }); $this->commands('command.repository.make'); }
[ "protected", "function", "registerMakeCommand", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "'command.repository.make'", ",", "function", "(", "$", "app", ")", "{", "$", "prefix", "=", "$", "app", "[", "'config'", "]", "[", "'repositor...
Register the "make" repository command. @return void
[ "Register", "the", "make", "repository", "command", "." ]
e74924552bd322c3b6f93087a049896d960843e3
https://github.com/vtalbot/repository-generator/blob/e74924552bd322c3b6f93087a049896d960843e3/src/RepositoryGeneratorServiceProvider.php#L60-L74
train
manaphp/framework
Http/Response.php
Response.setCookie
public function setCookie($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) { $context = $this->_context; if ($expire > 0) { $current = time(); if ($expire < $current) { $expire += $current; } } $context->cookies[$name] = [ 'name' => $name, 'value' => $value, 'expire' => $expire, 'path' => $path, 'domain' => $domain, 'secure' => $secure, 'httpOnly' => $httpOnly ]; $globals = $this->request->getGlobals(); $globals->_COOKIE[$name] = $value; return $this; }
php
public function setCookie($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) { $context = $this->_context; if ($expire > 0) { $current = time(); if ($expire < $current) { $expire += $current; } } $context->cookies[$name] = [ 'name' => $name, 'value' => $value, 'expire' => $expire, 'path' => $path, 'domain' => $domain, 'secure' => $secure, 'httpOnly' => $httpOnly ]; $globals = $this->request->getGlobals(); $globals->_COOKIE[$name] = $value; return $this; }
[ "public", "function", "setCookie", "(", "$", "name", ",", "$", "value", ",", "$", "expire", "=", "0", ",", "$", "path", "=", "null", ",", "$", "domain", "=", "null", ",", "$", "secure", "=", "false", ",", "$", "httpOnly", "=", "true", ")", "{", ...
Sets a cookie to be sent at the end of the request @param string $name @param mixed $value @param int $expire @param string $path @param string $domain @param bool $secure @param bool $httpOnly @return static
[ "Sets", "a", "cookie", "to", "be", "sent", "at", "the", "end", "of", "the", "request" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Http/Response.php#L69-L95
train
manaphp/framework
Http/Response.php
Response.setStatus
public function setStatus($code, $text = null) { $context = $this->_context; $context->status_code = (int)$code; $context->status_text = $text ?: $this->getStatusText($code); return $this; }
php
public function setStatus($code, $text = null) { $context = $this->_context; $context->status_code = (int)$code; $context->status_text = $text ?: $this->getStatusText($code); return $this; }
[ "public", "function", "setStatus", "(", "$", "code", ",", "$", "text", "=", "null", ")", "{", "$", "context", "=", "$", "this", "->", "_context", ";", "$", "context", "->", "status_code", "=", "(", "int", ")", "$", "code", ";", "$", "context", "->"...
Sets the HTTP response code @param int $code @param string $text @return static
[ "Sets", "the", "HTTP", "response", "code" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Http/Response.php#L137-L145
train
manaphp/framework
Http/Response.php
Response.setHeader
public function setHeader($name, $value) { $context = $this->_context; $context->headers[$name] = $value; return $this; }
php
public function setHeader($name, $value) { $context = $this->_context; $context->headers[$name] = $value; return $this; }
[ "public", "function", "setHeader", "(", "$", "name", ",", "$", "value", ")", "{", "$", "context", "=", "$", "this", "->", "_context", ";", "$", "context", "->", "headers", "[", "$", "name", "]", "=", "$", "value", ";", "return", "$", "this", ";", ...
Overwrites a header in the response @param string $name @param string $value @return static
[ "Overwrites", "a", "header", "in", "the", "response" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Http/Response.php#L247-L254
train
manaphp/framework
Http/Response.php
Response.redirect
public function redirect($location, $temporarily = true) { if ($temporarily) { $this->setStatus(302, 'Temporarily Moved'); } else { $this->setStatus(301, 'Permanently Moved'); } $this->setHeader('Location', $this->url->get($location)); throw new AbortException(); /** @noinspection PhpUnreachableStatementInspection */ return $this; }
php
public function redirect($location, $temporarily = true) { if ($temporarily) { $this->setStatus(302, 'Temporarily Moved'); } else { $this->setStatus(301, 'Permanently Moved'); } $this->setHeader('Location', $this->url->get($location)); throw new AbortException(); /** @noinspection PhpUnreachableStatementInspection */ return $this; }
[ "public", "function", "redirect", "(", "$", "location", ",", "$", "temporarily", "=", "true", ")", "{", "if", "(", "$", "temporarily", ")", "{", "$", "this", "->", "setStatus", "(", "302", ",", "'Temporarily Moved'", ")", ";", "}", "else", "{", "$", ...
Redirect by HTTP to another action or URL @param string|array $location @param bool $temporarily @return static
[ "Redirect", "by", "HTTP", "to", "another", "action", "or", "URL" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Http/Response.php#L411-L425
train
manaphp/framework
Http/Response.php
Response.setContent
public function setContent($content) { $context = $this->_context; $context->content = (string)$content; return $this; }
php
public function setContent($content) { $context = $this->_context; $context->content = (string)$content; return $this; }
[ "public", "function", "setContent", "(", "$", "content", ")", "{", "$", "context", "=", "$", "this", "->", "_context", ";", "$", "context", "->", "content", "=", "(", "string", ")", "$", "content", ";", "return", "$", "this", ";", "}" ]
Sets HTTP response body @param string $content @return static
[ "Sets", "HTTP", "response", "body" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Http/Response.php#L434-L441
train
manaphp/framework
Http/Response.php
Response.setJsonContent
public function setJsonContent($content) { $context = $this->_context; $this->setHeader('Content-Type', 'application/json; charset=utf-8'); if (is_array($content)) { if (!isset($content['code'])) { $content = ['code' => 0, 'message' => '', 'data' => $content]; } } elseif ($content instanceof \JsonSerializable) { $content = ['code' => 0, 'message' => '', 'data' => $content]; } elseif (is_string($content)) { null; } elseif (is_int($content)) { $content = ['code' => $content, 'message' => '']; } elseif ($content === null) { $content = ['code' => 0, 'message' => '', 'data' => null]; } elseif ($content instanceof ValidatorException) { $content = ['code' => -2, 'message' => $content->getMessage()]; } elseif ($content instanceof \Exception) { if ($content instanceof \ManaPHP\Exception) { $this->setStatus($content->getStatusCode()); $content = $content->getJson(); } else { $this->setStatus(500); $content = ['code' => 500, 'message' => 'Server Internal Error']; } } $context->content = $this->_jsonEncode($content); return $this; }
php
public function setJsonContent($content) { $context = $this->_context; $this->setHeader('Content-Type', 'application/json; charset=utf-8'); if (is_array($content)) { if (!isset($content['code'])) { $content = ['code' => 0, 'message' => '', 'data' => $content]; } } elseif ($content instanceof \JsonSerializable) { $content = ['code' => 0, 'message' => '', 'data' => $content]; } elseif (is_string($content)) { null; } elseif (is_int($content)) { $content = ['code' => $content, 'message' => '']; } elseif ($content === null) { $content = ['code' => 0, 'message' => '', 'data' => null]; } elseif ($content instanceof ValidatorException) { $content = ['code' => -2, 'message' => $content->getMessage()]; } elseif ($content instanceof \Exception) { if ($content instanceof \ManaPHP\Exception) { $this->setStatus($content->getStatusCode()); $content = $content->getJson(); } else { $this->setStatus(500); $content = ['code' => 500, 'message' => 'Server Internal Error']; } } $context->content = $this->_jsonEncode($content); return $this; }
[ "public", "function", "setJsonContent", "(", "$", "content", ")", "{", "$", "context", "=", "$", "this", "->", "_context", ";", "$", "this", "->", "setHeader", "(", "'Content-Type'", ",", "'application/json; charset=utf-8'", ")", ";", "if", "(", "is_array", ...
Sets HTTP response body. The parameter is automatically converted to JSON @param array|\JsonSerializable|int|string|\Exception $content @return static
[ "Sets", "HTTP", "response", "body", ".", "The", "parameter", "is", "automatically", "converted", "to", "JSON" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Http/Response.php#L492-L525
train
milejko/mmi-cms
src/Cms/Console/FileGarbageCollectorCommand.php
FileGarbageCollectorCommand._checkForFile
protected function _checkForFile($directory, $file) { //szukamy tylko plików w przedziale 33 - 37 znaków if (strlen($file) < 33 || strlen($file) > 37) { echo $file . "\n"; return; } //brak pliku w plikach CMS if (null === $fr = (new \Cms\Orm\CmsFileQuery) ->whereName()->equals($file) ->findFirst() ) { $this->_size += filesize($directory . '/' . $file); $this->_count++; unlink($directory . '/' . $file); return $this->_reportLine($directory . '/' . $file); } $this->_found++; }
php
protected function _checkForFile($directory, $file) { //szukamy tylko plików w przedziale 33 - 37 znaków if (strlen($file) < 33 || strlen($file) > 37) { echo $file . "\n"; return; } //brak pliku w plikach CMS if (null === $fr = (new \Cms\Orm\CmsFileQuery) ->whereName()->equals($file) ->findFirst() ) { $this->_size += filesize($directory . '/' . $file); $this->_count++; unlink($directory . '/' . $file); return $this->_reportLine($directory . '/' . $file); } $this->_found++; }
[ "protected", "function", "_checkForFile", "(", "$", "directory", ",", "$", "file", ")", "{", "//szukamy tylko plików w przedziale 33 - 37 znaków", "if", "(", "strlen", "(", "$", "file", ")", "<", "33", "||", "strlen", "(", "$", "file", ")", ">", "37", ")", ...
Sprawdza istnienie pliku @param string $directory @param string $file
[ "Sprawdza", "istnienie", "pliku" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Console/FileGarbageCollectorCommand.php#L82-L100
train
manaphp/framework
Cli/Controllers/FiddlerController.php
FiddlerController.webCommand
public function webCommand($id = '', $ip = '') { $options = []; if ($id) { $options['id'] = $id; } if ($ip) { $options['ip'] = $ip; } $this->fiddlerPlugin->subscribeWeb($options); }
php
public function webCommand($id = '', $ip = '') { $options = []; if ($id) { $options['id'] = $id; } if ($ip) { $options['ip'] = $ip; } $this->fiddlerPlugin->subscribeWeb($options); }
[ "public", "function", "webCommand", "(", "$", "id", "=", "''", ",", "$", "ip", "=", "''", ")", "{", "$", "options", "=", "[", "]", ";", "if", "(", "$", "id", ")", "{", "$", "options", "[", "'id'", "]", "=", "$", "id", ";", "}", "if", "(", ...
fiddler web app @param string $id application id @param string $ip client ip
[ "fiddler", "web", "app" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Cli/Controllers/FiddlerController.php#L27-L40
train
manaphp/framework
Cli/Controllers/FiddlerController.php
FiddlerController.cliCommand
public function cliCommand($id = '') { $options = []; if ($id) { $options['id'] = $id; } $this->fiddlerPlugin->subscribeCli($options); }
php
public function cliCommand($id = '') { $options = []; if ($id) { $options['id'] = $id; } $this->fiddlerPlugin->subscribeCli($options); }
[ "public", "function", "cliCommand", "(", "$", "id", "=", "''", ")", "{", "$", "options", "=", "[", "]", ";", "if", "(", "$", "id", ")", "{", "$", "options", "[", "'id'", "]", "=", "$", "id", ";", "}", "$", "this", "->", "fiddlerPlugin", "->", ...
fiddler cli app @param string $id application id
[ "fiddler", "cli", "app" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Cli/Controllers/FiddlerController.php#L47-L56
train
pscheit/jparser
PLUG/parsing/Parser.php
Parser.register_node_class
function register_node_class( $s, $class ){ if( ! class_exists($class) ){ $s = $this->token_name( $s ); throw new Exception( "If you want to register class `$class' for symbol `$s' you should include it first" ); } $this->node_classes[$s] = $class; }
php
function register_node_class( $s, $class ){ if( ! class_exists($class) ){ $s = $this->token_name( $s ); throw new Exception( "If you want to register class `$class' for symbol `$s' you should include it first" ); } $this->node_classes[$s] = $class; }
[ "function", "register_node_class", "(", "$", "s", ",", "$", "class", ")", "{", "if", "(", "!", "class_exists", "(", "$", "class", ")", ")", "{", "$", "s", "=", "$", "this", "->", "token_name", "(", "$", "s", ")", ";", "throw", "new", "Exception", ...
Register a custom ParseNode class for a given symbol @param Mixed @param string @return void
[ "Register", "a", "custom", "ParseNode", "class", "for", "a", "given", "symbol" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/parsing/Parser.php#L208-L214
train
pscheit/jparser
PLUG/parsing/Parser.php
Parser.create_node
function create_node( $s ){ if( isset($this->node_classes[$s]) ){ // custom node class $class = $this->node_classes[$s]; } else { // vanilla flavour node $class = $this->default_node_class; } return new $class( $s ); }
php
function create_node( $s ){ if( isset($this->node_classes[$s]) ){ // custom node class $class = $this->node_classes[$s]; } else { // vanilla flavour node $class = $this->default_node_class; } return new $class( $s ); }
[ "function", "create_node", "(", "$", "s", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "node_classes", "[", "$", "s", "]", ")", ")", "{", "// custom node class", "$", "class", "=", "$", "this", "->", "node_classes", "[", "$", "s", "]", ";"...
Create a Parse Node according to registered symbol @param mixed scalar symbol @return ParseNode
[ "Create", "a", "Parse", "Node", "according", "to", "registered", "symbol" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/parsing/Parser.php#L224-L234
train
pscheit/jparser
PLUG/parsing/Parser.php
Parser.token_name
function token_name ( $t ){ $t = self::token_to_symbol( $t ); if( ! is_int($t) ){ return $t; } return $this->Lex->name( $t ); }
php
function token_name ( $t ){ $t = self::token_to_symbol( $t ); if( ! is_int($t) ){ return $t; } return $this->Lex->name( $t ); }
[ "function", "token_name", "(", "$", "t", ")", "{", "$", "t", "=", "self", "::", "token_to_symbol", "(", "$", "t", ")", ";", "if", "(", "!", "is_int", "(", "$", "t", ")", ")", "{", "return", "$", "t", ";", "}", "return", "$", "this", "->", "Le...
Get name of scalar symbol for debugging @param Mixed @return string
[ "Get", "name", "of", "scalar", "symbol", "for", "debugging" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/parsing/Parser.php#L260-L266
train
pscheit/jparser
PLUG/parsing/Parser.php
Parser.current_token
protected function current_token(){ if( !isset($this->tok) ){ $this->tok = current( $this->input ); $this->t = self::token_to_symbol( $this->tok ); } return $this->tok; }
php
protected function current_token(){ if( !isset($this->tok) ){ $this->tok = current( $this->input ); $this->t = self::token_to_symbol( $this->tok ); } return $this->tok; }
[ "protected", "function", "current_token", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "tok", ")", ")", "{", "$", "this", "->", "tok", "=", "current", "(", "$", "this", "->", "input", ")", ";", "$", "this", "->", "t", "=", "s...
Get current token from input stream. @return Mixed
[ "Get", "current", "token", "from", "input", "stream", "." ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/parsing/Parser.php#L346-L352
train
pscheit/jparser
PLUG/parsing/Parser.php
Parser.next_token
protected function next_token(){ $this->tok = next( $this->input ); $this->t = self::token_to_symbol( $this->tok ); return $this->tok; }
php
protected function next_token(){ $this->tok = next( $this->input ); $this->t = self::token_to_symbol( $this->tok ); return $this->tok; }
[ "protected", "function", "next_token", "(", ")", "{", "$", "this", "->", "tok", "=", "next", "(", "$", "this", "->", "input", ")", ";", "$", "this", "->", "t", "=", "self", "::", "token_to_symbol", "(", "$", "this", "->", "tok", ")", ";", "return",...
Advance input stream to next token @return Mixed next token in input stream
[ "Advance", "input", "stream", "to", "next", "token" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/parsing/Parser.php#L375-L379
train
pscheit/jparser
PLUG/parsing/Parser.php
Parser.prev_token
protected function prev_token(){ $this->tok = prev( $this->input ); $this->t = self::token_to_symbol( $this->tok ); return $this->tok; }
php
protected function prev_token(){ $this->tok = prev( $this->input ); $this->t = self::token_to_symbol( $this->tok ); return $this->tok; }
[ "protected", "function", "prev_token", "(", ")", "{", "$", "this", "->", "tok", "=", "prev", "(", "$", "this", "->", "input", ")", ";", "$", "this", "->", "t", "=", "self", "::", "token_to_symbol", "(", "$", "this", "->", "tok", ")", ";", "return",...
Rollback input stream to previous token @return Mixed previous token in input stream
[ "Rollback", "input", "stream", "to", "previous", "token" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/parsing/Parser.php#L388-L392
train
manaphp/framework
Cli/Controllers/DateController.php
DateController.syncCommand
public function syncCommand($url = 'http://www.baidu.com') { $timestamp = $this->_getRemoteTimestamp($url); if ($timestamp === false) { return $this->console->error(['fetch remote timestamp failed: `:url`', 'url' => $url]); } else { $this->_updateDate($timestamp); $this->console->write(date('Y-m-d H:i:s')); return 0; } }
php
public function syncCommand($url = 'http://www.baidu.com') { $timestamp = $this->_getRemoteTimestamp($url); if ($timestamp === false) { return $this->console->error(['fetch remote timestamp failed: `:url`', 'url' => $url]); } else { $this->_updateDate($timestamp); $this->console->write(date('Y-m-d H:i:s')); return 0; } }
[ "public", "function", "syncCommand", "(", "$", "url", "=", "'http://www.baidu.com'", ")", "{", "$", "timestamp", "=", "$", "this", "->", "_getRemoteTimestamp", "(", "$", "url", ")", ";", "if", "(", "$", "timestamp", "===", "false", ")", "{", "return", "$...
sync system time with http server time clock @param string $url the time original @return int
[ "sync", "system", "time", "with", "http", "server", "time", "clock" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Cli/Controllers/DateController.php#L46-L56
train
manaphp/framework
Cli/Controllers/DateController.php
DateController.remoteCommand
public function remoteCommand($url = 'http://www.baidu.com') { $timestamp = $this->_getRemoteTimestamp($url); if ($timestamp === false) { return $this->console->error(['fetch remote timestamp failed: `:url`', 'url' => $url]); } else { $this->console->writeLn(date('Y-m-d H:i:s', $timestamp)); return 0; } }
php
public function remoteCommand($url = 'http://www.baidu.com') { $timestamp = $this->_getRemoteTimestamp($url); if ($timestamp === false) { return $this->console->error(['fetch remote timestamp failed: `:url`', 'url' => $url]); } else { $this->console->writeLn(date('Y-m-d H:i:s', $timestamp)); return 0; } }
[ "public", "function", "remoteCommand", "(", "$", "url", "=", "'http://www.baidu.com'", ")", "{", "$", "timestamp", "=", "$", "this", "->", "_getRemoteTimestamp", "(", "$", "url", ")", ";", "if", "(", "$", "timestamp", "===", "false", ")", "{", "return", ...
show remote time @param string $url the time original @return int
[ "show", "remote", "time" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Cli/Controllers/DateController.php#L65-L74
train
manaphp/framework
Cli/Controllers/DateController.php
DateController.diffCommand
public function diffCommand($url = 'http://www.baidu.com') { $remote_ts = $this->_getRemoteTimestamp($url); $local_ts = time(); if ($remote_ts === false) { return $this->console->error(['fetch remote timestamp failed: `:url`', 'url' => $url]); } else { $this->console->writeLn(' local: ' . date('Y-m-d H:i:s', $local_ts)); $this->console->writeLn('remote: ' . date('Y-m-d H:i:s', $remote_ts)); $this->console->writeLn(' diff: ' . ($local_ts - $remote_ts)); return 0; } }
php
public function diffCommand($url = 'http://www.baidu.com') { $remote_ts = $this->_getRemoteTimestamp($url); $local_ts = time(); if ($remote_ts === false) { return $this->console->error(['fetch remote timestamp failed: `:url`', 'url' => $url]); } else { $this->console->writeLn(' local: ' . date('Y-m-d H:i:s', $local_ts)); $this->console->writeLn('remote: ' . date('Y-m-d H:i:s', $remote_ts)); $this->console->writeLn(' diff: ' . ($local_ts - $remote_ts)); return 0; } }
[ "public", "function", "diffCommand", "(", "$", "url", "=", "'http://www.baidu.com'", ")", "{", "$", "remote_ts", "=", "$", "this", "->", "_getRemoteTimestamp", "(", "$", "url", ")", ";", "$", "local_ts", "=", "time", "(", ")", ";", "if", "(", "$", "rem...
show local and remote diff @param string $url the time original @return string
[ "show", "local", "and", "remote", "diff" ]
b9a15c7f8f5d4770cacbea43f26914765bfcb248
https://github.com/manaphp/framework/blob/b9a15c7f8f5d4770cacbea43f26914765bfcb248/Cli/Controllers/DateController.php#L83-L95
train
milejko/mmi-cms
src/CmsAdmin/Model/PluploadHandler.php
PluploadHandler._getRequestFile
private function _getRequestFile() { $data = [ 'name' => $this->_fileName, 'size' => $this->_fileSize, 'tmp_name' => $this->_filePath ]; return new \Mmi\Http\RequestFile($data); }
php
private function _getRequestFile() { $data = [ 'name' => $this->_fileName, 'size' => $this->_fileSize, 'tmp_name' => $this->_filePath ]; return new \Mmi\Http\RequestFile($data); }
[ "private", "function", "_getRequestFile", "(", ")", "{", "$", "data", "=", "[", "'name'", "=>", "$", "this", "->", "_fileName", ",", "'size'", "=>", "$", "this", "->", "_fileSize", ",", "'tmp_name'", "=>", "$", "this", "->", "_filePath", "]", ";", "ret...
Zwraca obiekt pliku request @return \Mmi\Http\RequestFile
[ "Zwraca", "obiekt", "pliku", "request" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/CmsAdmin/Model/PluploadHandler.php#L493-L501
train
Jalle19/php-tvheadend
src/cli/TvheadendCommand.php
TvheadendCommand.askQuestion
protected function askQuestion($question, $choices, $default) { // Ask until we get a valid response do { echo $question.' '.$choices.': '; $handle = fopen("php://stdin", "r"); $line = fgets($handle); $response = trim($line); // Use default when no response is given if (empty($response)) $response = $default; } while (!in_array($response, explode('/', $choices))); return $response; }
php
protected function askQuestion($question, $choices, $default) { // Ask until we get a valid response do { echo $question.' '.$choices.': '; $handle = fopen("php://stdin", "r"); $line = fgets($handle); $response = trim($line); // Use default when no response is given if (empty($response)) $response = $default; } while (!in_array($response, explode('/', $choices))); return $response; }
[ "protected", "function", "askQuestion", "(", "$", "question", ",", "$", "choices", ",", "$", "default", ")", "{", "// Ask until we get a valid response", "do", "{", "echo", "$", "question", ".", "' '", ".", "$", "choices", ".", "': '", ";", "$", "handle", ...
Prompts the user for a response @param string $question the question to ask @param string $choices the available choices @param string $default the default choice when no input is entered @return string the choice
[ "Prompts", "the", "user", "for", "a", "response" ]
8fad6570f267ba573ca78b243cff7797b6cf8bbf
https://github.com/Jalle19/php-tvheadend/blob/8fad6570f267ba573ca78b243cff7797b6cf8bbf/src/cli/TvheadendCommand.php#L93-L112
train
Ma27/Ma27ApiKeyAuthenticationBundle
Controller/ApiKeyController.php
ApiKeyController.requestApiKeyAction
public function requestApiKeyAction(Request $request) { /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */ $dispatcher = $this->get('event_dispatcher'); $credentials = []; if ($request->request->has('login')) { $credentials[$this->getPropertyName(ClassMetadata::LOGIN_PROPERTY)] = $request->request->get('login'); } if ($request->request->has('password')) { $credentials[$this->getPropertyName(ClassMetadata::PASSWORD_PROPERTY)] = $request->request->get('password'); } [$user, $exception] = $this->processAuthentication($credentials); /** @var OnAssembleResponseEvent $result */ $result = $dispatcher->dispatch( Ma27ApiKeyAuthenticationEvents::ASSEMBLE_RESPONSE, new OnAssembleResponseEvent($user, $exception) ); if (!$response = $result->getResponse()) { throw new HttpException( Response::HTTP_INTERNAL_SERVER_ERROR, 'Cannot assemble the response!', $exception ); } return $response; }
php
public function requestApiKeyAction(Request $request) { /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */ $dispatcher = $this->get('event_dispatcher'); $credentials = []; if ($request->request->has('login')) { $credentials[$this->getPropertyName(ClassMetadata::LOGIN_PROPERTY)] = $request->request->get('login'); } if ($request->request->has('password')) { $credentials[$this->getPropertyName(ClassMetadata::PASSWORD_PROPERTY)] = $request->request->get('password'); } [$user, $exception] = $this->processAuthentication($credentials); /** @var OnAssembleResponseEvent $result */ $result = $dispatcher->dispatch( Ma27ApiKeyAuthenticationEvents::ASSEMBLE_RESPONSE, new OnAssembleResponseEvent($user, $exception) ); if (!$response = $result->getResponse()) { throw new HttpException( Response::HTTP_INTERNAL_SERVER_ERROR, 'Cannot assemble the response!', $exception ); } return $response; }
[ "public", "function", "requestApiKeyAction", "(", "Request", "$", "request", ")", "{", "/** @var \\Symfony\\Component\\EventDispatcher\\EventDispatcherInterface $dispatcher */", "$", "dispatcher", "=", "$", "this", "->", "get", "(", "'event_dispatcher'", ")", ";", "$", "c...
Requests an api key. @param Request $request @throws HttpException If the login fails. @return JsonResponse
[ "Requests", "an", "api", "key", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/Controller/ApiKeyController.php#L30-L59
train
Ma27/Ma27ApiKeyAuthenticationBundle
Controller/ApiKeyController.php
ApiKeyController.removeSessionAction
public function removeSessionAction(Request $request) { /** @var \Doctrine\Common\Persistence\ObjectManager $om */ $om = $this->get($this->container->getParameter('ma27_api_key_authentication.object_manager')); if (!$header = (string) $request->headers->get($this->container->getParameter('ma27_api_key_authentication.key_header'))) { return new JsonResponse(['message' => 'Missing api key header!'], 400); } $user = $om ->getRepository($this->container->getParameter('ma27_api_key_authentication.model_name')) ->findOneBy([ $this->getPropertyName(ClassMetadata::API_KEY_PROPERTY) => $header, ]); $this->get('ma27_api_key_authentication.auth_handler')->removeSession($user); return new JsonResponse([], 204); }
php
public function removeSessionAction(Request $request) { /** @var \Doctrine\Common\Persistence\ObjectManager $om */ $om = $this->get($this->container->getParameter('ma27_api_key_authentication.object_manager')); if (!$header = (string) $request->headers->get($this->container->getParameter('ma27_api_key_authentication.key_header'))) { return new JsonResponse(['message' => 'Missing api key header!'], 400); } $user = $om ->getRepository($this->container->getParameter('ma27_api_key_authentication.model_name')) ->findOneBy([ $this->getPropertyName(ClassMetadata::API_KEY_PROPERTY) => $header, ]); $this->get('ma27_api_key_authentication.auth_handler')->removeSession($user); return new JsonResponse([], 204); }
[ "public", "function", "removeSessionAction", "(", "Request", "$", "request", ")", "{", "/** @var \\Doctrine\\Common\\Persistence\\ObjectManager $om */", "$", "om", "=", "$", "this", "->", "get", "(", "$", "this", "->", "container", "->", "getParameter", "(", "'ma27_...
Removes an api key. @param Request $request @return JsonResponse
[ "Removes", "an", "api", "key", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/Controller/ApiKeyController.php#L68-L86
train
Ma27/Ma27ApiKeyAuthenticationBundle
Controller/ApiKeyController.php
ApiKeyController.processAuthentication
private function processAuthentication(array $credentials) { /** @var \Ma27\ApiKeyAuthenticationBundle\Service\Auth\AuthenticationHandlerInterface $authenticationHandler */ $authenticationHandler = $this->get('ma27_api_key_authentication.auth_handler'); /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */ $dispatcher = $this->get('event_dispatcher'); try { $user = $authenticationHandler->authenticate($credentials); } catch (CredentialException $ex) { $userOrNull = $user ?? null; $dispatcher->dispatch( Ma27ApiKeyAuthenticationEvents::CREDENTIAL_EXCEPTION_THROWN, new OnCredentialExceptionThrownEvent($ex, $userOrNull) ); return [$userOrNull, $ex]; } return [$user, null]; }
php
private function processAuthentication(array $credentials) { /** @var \Ma27\ApiKeyAuthenticationBundle\Service\Auth\AuthenticationHandlerInterface $authenticationHandler */ $authenticationHandler = $this->get('ma27_api_key_authentication.auth_handler'); /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */ $dispatcher = $this->get('event_dispatcher'); try { $user = $authenticationHandler->authenticate($credentials); } catch (CredentialException $ex) { $userOrNull = $user ?? null; $dispatcher->dispatch( Ma27ApiKeyAuthenticationEvents::CREDENTIAL_EXCEPTION_THROWN, new OnCredentialExceptionThrownEvent($ex, $userOrNull) ); return [$userOrNull, $ex]; } return [$user, null]; }
[ "private", "function", "processAuthentication", "(", "array", "$", "credentials", ")", "{", "/** @var \\Ma27\\ApiKeyAuthenticationBundle\\Service\\Auth\\AuthenticationHandlerInterface $authenticationHandler */", "$", "authenticationHandler", "=", "$", "this", "->", "get", "(", "'...
Internal utility to handle the authentication process based on the credentials. @param array $credentials @return array
[ "Internal", "utility", "to", "handle", "the", "authentication", "process", "based", "on", "the", "credentials", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/Controller/ApiKeyController.php#L95-L115
train
fezfez/codeGenerator
src/CrudGenerator/Metadata/Sources/Oracle/OracleMetaDataDAO.php
OracleMetaDataDAO.hydrateDataObject
private function hydrateDataObject($data) { $dataObject = new MetadataDataObjectOracle( new MetaDataColumnCollection(), new MetaDataRelationCollection() ); $tableName = $data['TABLE_NAME']; $owner = $data['OWNER']; $dataObject->setName($owner . '/' . $tableName); $columnDataObject = new MetaDataColumn(); $statement = $this->pdo->prepare( sprintf( "SELECT COLUMN_NAME as name, NULLABLE as nullable, DATA_TYPE as type, DATA_LENGTH as length FROM SYS.ALL_TAB_COLUMNS WHERE TABLE_NAME = '%s' and OWNER= '%s'", $tableName, $owner ) ); $statement->execute(array()); $allFields = $statement->fetchAll(PDO::FETCH_ASSOC); $identifiers = $this->getIdentifiers($owner, $tableName); foreach ($allFields as $metadata) { $column = clone $columnDataObject; $type = $metadata['type']; if (isset($this->typeConversion[$type]) === true) { $type = $this->typeConversion[$type]; } $column->setName($metadata['name']) ->setType($type) ->setLength( isset($metadata['length']) === true ? $metadata['length'] : null ); if (in_array($metadata['name'], $identifiers) === true) { $column->setPrimaryKey(true); } $dataObject->appendColumn($column); } return $dataObject; }
php
private function hydrateDataObject($data) { $dataObject = new MetadataDataObjectOracle( new MetaDataColumnCollection(), new MetaDataRelationCollection() ); $tableName = $data['TABLE_NAME']; $owner = $data['OWNER']; $dataObject->setName($owner . '/' . $tableName); $columnDataObject = new MetaDataColumn(); $statement = $this->pdo->prepare( sprintf( "SELECT COLUMN_NAME as name, NULLABLE as nullable, DATA_TYPE as type, DATA_LENGTH as length FROM SYS.ALL_TAB_COLUMNS WHERE TABLE_NAME = '%s' and OWNER= '%s'", $tableName, $owner ) ); $statement->execute(array()); $allFields = $statement->fetchAll(PDO::FETCH_ASSOC); $identifiers = $this->getIdentifiers($owner, $tableName); foreach ($allFields as $metadata) { $column = clone $columnDataObject; $type = $metadata['type']; if (isset($this->typeConversion[$type]) === true) { $type = $this->typeConversion[$type]; } $column->setName($metadata['name']) ->setType($type) ->setLength( isset($metadata['length']) === true ? $metadata['length'] : null ); if (in_array($metadata['name'], $identifiers) === true) { $column->setPrimaryKey(true); } $dataObject->appendColumn($column); } return $dataObject; }
[ "private", "function", "hydrateDataObject", "(", "$", "data", ")", "{", "$", "dataObject", "=", "new", "MetadataDataObjectOracle", "(", "new", "MetaDataColumnCollection", "(", ")", ",", "new", "MetaDataRelationCollection", "(", ")", ")", ";", "$", "tableName", "...
Convert PDOmapping to CrudGenerator mapping @return MetadataDataObjectOracle
[ "Convert", "PDOmapping", "to", "CrudGenerator", "mapping" ]
559f22bcc525c3157ecb17fe96818dd7b7ee58c2
https://github.com/fezfez/codeGenerator/blob/559f22bcc525c3157ecb17fe96818dd7b7ee58c2/src/CrudGenerator/Metadata/Sources/Oracle/OracleMetaDataDAO.php#L94-L145
train
fezfez/codeGenerator
src/CrudGenerator/Metadata/Sources/MySQL/MySQLMetaDataDAO.php
MySQLMetaDataDAO.pdoMetadataToGeneratorMetadata
private function pdoMetadataToGeneratorMetadata(array $metadataCollection) { $metaDataCollection = new MetaDataCollection(); foreach ($metadataCollection as $tableName) { $metaDataCollection->append( $this->hydrateDataObject($tableName) ); } return $metaDataCollection; }
php
private function pdoMetadataToGeneratorMetadata(array $metadataCollection) { $metaDataCollection = new MetaDataCollection(); foreach ($metadataCollection as $tableName) { $metaDataCollection->append( $this->hydrateDataObject($tableName) ); } return $metaDataCollection; }
[ "private", "function", "pdoMetadataToGeneratorMetadata", "(", "array", "$", "metadataCollection", ")", "{", "$", "metaDataCollection", "=", "new", "MetaDataCollection", "(", ")", ";", "foreach", "(", "$", "metadataCollection", "as", "$", "tableName", ")", "{", "$"...
Convert MySQL mapping to CrudGenerator mapping @param array $metadataCollection @return \CrudGenerator\Metadata\DataObject\MetaDataCollection
[ "Convert", "MySQL", "mapping", "to", "CrudGenerator", "mapping" ]
559f22bcc525c3157ecb17fe96818dd7b7ee58c2
https://github.com/fezfez/codeGenerator/blob/559f22bcc525c3157ecb17fe96818dd7b7ee58c2/src/CrudGenerator/Metadata/Sources/MySQL/MySQLMetaDataDAO.php#L91-L102
train
fezfez/codeGenerator
src/CrudGenerator/Metadata/Sources/MySQL/MySQLMetaDataDAO.php
MySQLMetaDataDAO.hydrateDataObject
private function hydrateDataObject($tableName, array $parentName = array()) { $dataObject = new MetadataDataObjectMySQL( new MetaDataColumnCollection(), new MetaDataRelationCollection() ); $dataObject->setName($tableName); $statement = $this->pdo->prepare( "SELECT columnTable.column_name, columnTable.table_name, columnTable.data_type, columnTable.column_key, columnTable.is_nullable, k.referenced_table_name, k.referenced_column_name FROM information_schema.columns as columnTable left outer join information_schema.key_column_usage k on k.table_schema=columnTable.table_schema and k.table_name=columnTable.table_name and k.column_name=columnTable.column_name WHERE columnTable.table_name = :tableName AND columnTable.table_schema = :databaseName" ); $statement->execute( array( ':tableName' => $tableName, ':databaseName' => $this->pdoConfig->getResponse('configDatabaseName'), ) ); $allFields = $statement->fetchAll(PDO::FETCH_ASSOC); $columnsAssociation = array(); foreach ($allFields as $index => $metadata) { if ($metadata['referenced_table_name'] !== null && $metadata['referenced_column_name'] !== null) { $columnsAssociation[$index] = $metadata; unset($allFields[$index]); continue; } } return $this->hydrateRelation( $this->hydrateFields($dataObject, $allFields), $columnsAssociation, $parentName ); }
php
private function hydrateDataObject($tableName, array $parentName = array()) { $dataObject = new MetadataDataObjectMySQL( new MetaDataColumnCollection(), new MetaDataRelationCollection() ); $dataObject->setName($tableName); $statement = $this->pdo->prepare( "SELECT columnTable.column_name, columnTable.table_name, columnTable.data_type, columnTable.column_key, columnTable.is_nullable, k.referenced_table_name, k.referenced_column_name FROM information_schema.columns as columnTable left outer join information_schema.key_column_usage k on k.table_schema=columnTable.table_schema and k.table_name=columnTable.table_name and k.column_name=columnTable.column_name WHERE columnTable.table_name = :tableName AND columnTable.table_schema = :databaseName" ); $statement->execute( array( ':tableName' => $tableName, ':databaseName' => $this->pdoConfig->getResponse('configDatabaseName'), ) ); $allFields = $statement->fetchAll(PDO::FETCH_ASSOC); $columnsAssociation = array(); foreach ($allFields as $index => $metadata) { if ($metadata['referenced_table_name'] !== null && $metadata['referenced_column_name'] !== null) { $columnsAssociation[$index] = $metadata; unset($allFields[$index]); continue; } } return $this->hydrateRelation( $this->hydrateFields($dataObject, $allFields), $columnsAssociation, $parentName ); }
[ "private", "function", "hydrateDataObject", "(", "$", "tableName", ",", "array", "$", "parentName", "=", "array", "(", ")", ")", "{", "$", "dataObject", "=", "new", "MetadataDataObjectMySQL", "(", "new", "MetaDataColumnCollection", "(", ")", ",", "new", "MetaD...
Convert MySQL mapping to CodeGenerator mapping @param string $tableName @return MetadataDataObjectMySQL
[ "Convert", "MySQL", "mapping", "to", "CodeGenerator", "mapping" ]
559f22bcc525c3157ecb17fe96818dd7b7ee58c2
https://github.com/fezfez/codeGenerator/blob/559f22bcc525c3157ecb17fe96818dd7b7ee58c2/src/CrudGenerator/Metadata/Sources/MySQL/MySQLMetaDataDAO.php#L109-L156
train
milejko/mmi-cms
src/Cms/Model/Auth.php
Auth.authenticate
public static function authenticate($identity, $credential) { //błędna autoryzacja (brak aktywnego użytkownika) if (null === $record = self::_findUserByIdentity($identity)) { return; } //próby logowania lokalnie i ldap if (!self::_localAuthenticate($record, $credential) && !self::_ldapAuthenticate($record, $credential)) { self::_updateUserFailedLogin($record); return self::_authFailed($identity, 'Invalid password.'); } //poprawna autoryzacja return self::_authSuccess($record); }
php
public static function authenticate($identity, $credential) { //błędna autoryzacja (brak aktywnego użytkownika) if (null === $record = self::_findUserByIdentity($identity)) { return; } //próby logowania lokalnie i ldap if (!self::_localAuthenticate($record, $credential) && !self::_ldapAuthenticate($record, $credential)) { self::_updateUserFailedLogin($record); return self::_authFailed($identity, 'Invalid password.'); } //poprawna autoryzacja return self::_authSuccess($record); }
[ "public", "static", "function", "authenticate", "(", "$", "identity", ",", "$", "credential", ")", "{", "//błędna autoryzacja (brak aktywnego użytkownika)", "if", "(", "null", "===", "$", "record", "=", "self", "::", "_findUserByIdentity", "(", "$", "identity", ")...
Autoryzacja do CMS @param string $identity @param string $credential @return \Mmi\Security\AuthRecord
[ "Autoryzacja", "do", "CMS" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Model/Auth.php#L28-L43
train
milejko/mmi-cms
src/Cms/Model/Auth.php
Auth.idAuthenticate
public static function idAuthenticate($id) { //wyszukiwanie aktywnego użytkownika if (null === $record = self::_findUserByIdentity($id)) { return; } return self::_authSuccess($record); }
php
public static function idAuthenticate($id) { //wyszukiwanie aktywnego użytkownika if (null === $record = self::_findUserByIdentity($id)) { return; } return self::_authSuccess($record); }
[ "public", "static", "function", "idAuthenticate", "(", "$", "id", ")", "{", "//wyszukiwanie aktywnego użytkownika", "if", "(", "null", "===", "$", "record", "=", "self", "::", "_findUserByIdentity", "(", "$", "id", ")", ")", "{", "return", ";", "}", "return"...
Autoryzacja po ID @param integer $id @return boolean
[ "Autoryzacja", "po", "ID" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Model/Auth.php#L50-L57
train
milejko/mmi-cms
src/Cms/Model/Auth.php
Auth._authSuccess
protected static function _authSuccess(CmsAuthRecord $record) { //zapis poprawnego logowania do rekordu $record->lastIp = \Mmi\App\FrontController::getInstance()->getEnvironment()->remoteAddress; $record->lastLog = date('Y-m-d H:i:s'); $record->save(); \Mmi\App\FrontController::getInstance()->getLogger()->info('Logged in: ' . $record->username); //nowy obiekt autoryzacji $authRecord = new \Mmi\Security\AuthRecord; //ustawianie pól rekordu $authRecord->id = $record->id; $authRecord->name = $record->name; $authRecord->username = $record->username; $authRecord->email = $record->email; $authRecord->lang = $record->lang; $authRecord->roles = count($record->getRoles()) ? $record->getRoles() : ['guest']; return $authRecord; }
php
protected static function _authSuccess(CmsAuthRecord $record) { //zapis poprawnego logowania do rekordu $record->lastIp = \Mmi\App\FrontController::getInstance()->getEnvironment()->remoteAddress; $record->lastLog = date('Y-m-d H:i:s'); $record->save(); \Mmi\App\FrontController::getInstance()->getLogger()->info('Logged in: ' . $record->username); //nowy obiekt autoryzacji $authRecord = new \Mmi\Security\AuthRecord; //ustawianie pól rekordu $authRecord->id = $record->id; $authRecord->name = $record->name; $authRecord->username = $record->username; $authRecord->email = $record->email; $authRecord->lang = $record->lang; $authRecord->roles = count($record->getRoles()) ? $record->getRoles() : ['guest']; return $authRecord; }
[ "protected", "static", "function", "_authSuccess", "(", "CmsAuthRecord", "$", "record", ")", "{", "//zapis poprawnego logowania do rekordu", "$", "record", "->", "lastIp", "=", "\\", "Mmi", "\\", "App", "\\", "FrontController", "::", "getInstance", "(", ")", "->",...
Po poprawnej autoryzacji zapis danych i loga zwraca rekord autoryzacji @param CmsAuthRecord $record @return \Mmi\Security\AuthRecord
[ "Po", "poprawnej", "autoryzacji", "zapis", "danych", "i", "loga", "zwraca", "rekord", "autoryzacji" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Model/Auth.php#L121-L138
train
milejko/mmi-cms
src/Cms/Model/ConnectorModel.php
ConnectorModel.importFileMeta
public function importFileMeta(array $files) { //iteracja po plikach (ta sama nazwa "name") foreach ($files as $importData) { //brak id if (!isset($importData['name']) || !isset($importData['id'])) { return; } //sprawdzanie istnienia pliku if (null === $file = (new \Cms\Orm\CmsFileQuery)->findPk($importData['id'])) { $file = new \Cms\Orm\CmsFileRecord; } //identyfikatory niezgodne if ($file->name && $file->name != $importData['name']) { continue; } //ustawienie danych rekordu rekordu $file->setFromArray($importData); //poprawny zapis if (!$file->save()) { return; } } //zwrot ostatniego pliku (potrzebny jest dowolny) return $file; }
php
public function importFileMeta(array $files) { //iteracja po plikach (ta sama nazwa "name") foreach ($files as $importData) { //brak id if (!isset($importData['name']) || !isset($importData['id'])) { return; } //sprawdzanie istnienia pliku if (null === $file = (new \Cms\Orm\CmsFileQuery)->findPk($importData['id'])) { $file = new \Cms\Orm\CmsFileRecord; } //identyfikatory niezgodne if ($file->name && $file->name != $importData['name']) { continue; } //ustawienie danych rekordu rekordu $file->setFromArray($importData); //poprawny zapis if (!$file->save()) { return; } } //zwrot ostatniego pliku (potrzebny jest dowolny) return $file; }
[ "public", "function", "importFileMeta", "(", "array", "$", "files", ")", "{", "//iteracja po plikach (ta sama nazwa \"name\")", "foreach", "(", "$", "files", "as", "$", "importData", ")", "{", "//brak id", "if", "(", "!", "isset", "(", "$", "importData", "[", ...
Importuje meta pliku @param array $ @return \Cms\Orm\CmsFileRecord
[ "Importuje", "meta", "pliku" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Model/ConnectorModel.php#L54-L79
train
beleneglorion/php-bugherd-api
lib/Bugherd/Client.php
Client.decode
public function decode($json) { $decoded = json_decode($json, true); if (null !== $decoded) { return $decoded; } if (JSON_ERROR_NONE === json_last_error()) { return $json; } return self::$json_errors[json_last_error()]; }
php
public function decode($json) { $decoded = json_decode($json, true); if (null !== $decoded) { return $decoded; } if (JSON_ERROR_NONE === json_last_error()) { return $json; } return self::$json_errors[json_last_error()]; }
[ "public", "function", "decode", "(", "$", "json", ")", "{", "$", "decoded", "=", "json_decode", "(", "$", "json", ",", "true", ")", ";", "if", "(", "null", "!==", "$", "decoded", ")", "{", "return", "$", "decoded", ";", "}", "if", "(", "JSON_ERROR_...
Decodes json response @param string $json @return array
[ "Decodes", "json", "response" ]
f0fce97042bd05bc5560fbf37051cd74f802cea1
https://github.com/beleneglorion/php-bugherd-api/blob/f0fce97042bd05bc5560fbf37051cd74f802cea1/lib/Bugherd/Client.php#L147-L158
train
milejko/mmi-cms
src/CmsAdmin/Grid/Column/CustomColumn.php
CustomColumn.renderCell
public function renderCell(\Mmi\Orm\RecordRo $record) { $view = FrontController::getInstance()->getView(); $view->record = $record; return $view->renderDirectly($this->getTemplateCode()); }
php
public function renderCell(\Mmi\Orm\RecordRo $record) { $view = FrontController::getInstance()->getView(); $view->record = $record; return $view->renderDirectly($this->getTemplateCode()); }
[ "public", "function", "renderCell", "(", "\\", "Mmi", "\\", "Orm", "\\", "RecordRo", "$", "record", ")", "{", "$", "view", "=", "FrontController", "::", "getInstance", "(", ")", "->", "getView", "(", ")", ";", "$", "view", "->", "record", "=", "$", "...
Renderuje customowe Columny @param \Mmi\Orm\RecordRo $record @return string
[ "Renderuje", "customowe", "Columny" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/CmsAdmin/Grid/Column/CustomColumn.php#L57-L62
train
stanislav-web/Searcher
src/Searcher/Hydrators/SerializeHydrator.php
SerializeHydrator.extract
public function extract(callable $callback = null) { if ($callback === null) { $result = $this->result->serialize(); } else { $result = $callback($this->result->serialize()); } return $result; }
php
public function extract(callable $callback = null) { if ($callback === null) { $result = $this->result->serialize(); } else { $result = $callback($this->result->serialize()); } return $result; }
[ "public", "function", "extract", "(", "callable", "$", "callback", "=", "null", ")", "{", "if", "(", "$", "callback", "===", "null", ")", "{", "$", "result", "=", "$", "this", "->", "result", "->", "serialize", "(", ")", ";", "}", "else", "{", "$",...
Extract result data to serialize string @param callback|null $callback function to data @return array
[ "Extract", "result", "data", "to", "serialize", "string" ]
bf01156d1a2416ceddef0d238469563b74087d44
https://github.com/stanislav-web/Searcher/blob/bf01156d1a2416ceddef0d238469563b74087d44/src/Searcher/Hydrators/SerializeHydrator.php#L42-L54
train
pscheit/jparser
PLUG/compiler/PHPCompiler.php
PHPCompiler.set_conf
function set_conf( $confname ){ $this->confname = $confname; $this->confdir = PLUG_HOST_DIR.'/'.$confname; if( ! PLUGTool::check_dir($this->confdir) ){ throw new PLUGException('bad conf'); } // parse default plug conf using external parser $confpath = $this->confdir.'/PLUG.conf.php'; $this->conf_vars = array(); $this->conf_consts = array (); $this->load_conf( $confpath ); }
php
function set_conf( $confname ){ $this->confname = $confname; $this->confdir = PLUG_HOST_DIR.'/'.$confname; if( ! PLUGTool::check_dir($this->confdir) ){ throw new PLUGException('bad conf'); } // parse default plug conf using external parser $confpath = $this->confdir.'/PLUG.conf.php'; $this->conf_vars = array(); $this->conf_consts = array (); $this->load_conf( $confpath ); }
[ "function", "set_conf", "(", "$", "confname", ")", "{", "$", "this", "->", "confname", "=", "$", "confname", ";", "$", "this", "->", "confdir", "=", "PLUG_HOST_DIR", ".", "'/'", ".", "$", "confname", ";", "if", "(", "!", "PLUGTool", "::", "check_dir", ...
Set target configuration. @param string name of conf directory @return void
[ "Set", "target", "configuration", "." ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/compiler/PHPCompiler.php#L241-L252
train
pscheit/jparser
PLUG/compiler/PHPCompiler.php
PHPCompiler.load_conf
function load_conf( $confpath ){ if( ! PLUGTool::check_file($confpath) ){ throw new PLUGException('bad conf'); } $e = PLUG::exec_bin( 'parseconf', array($confpath), $s ); if( $e ){ trigger_error('Failed to parse '.basename($confpath), E_USER_NOTICE ); return false; } $a = unserialize( $s ); if( ! is_array($a) ){ trigger_error( "parseconf returned bad serialize string, $s", E_USER_WARNING ); return false; } $this->conf_vars = array_merge( $this->conf_vars, $a[0] ); $this->conf_consts = array_merge( $this->conf_consts, $a[1] ); return true; }
php
function load_conf( $confpath ){ if( ! PLUGTool::check_file($confpath) ){ throw new PLUGException('bad conf'); } $e = PLUG::exec_bin( 'parseconf', array($confpath), $s ); if( $e ){ trigger_error('Failed to parse '.basename($confpath), E_USER_NOTICE ); return false; } $a = unserialize( $s ); if( ! is_array($a) ){ trigger_error( "parseconf returned bad serialize string, $s", E_USER_WARNING ); return false; } $this->conf_vars = array_merge( $this->conf_vars, $a[0] ); $this->conf_consts = array_merge( $this->conf_consts, $a[1] ); return true; }
[ "function", "load_conf", "(", "$", "confpath", ")", "{", "if", "(", "!", "PLUGTool", "::", "check_file", "(", "$", "confpath", ")", ")", "{", "throw", "new", "PLUGException", "(", "'bad conf'", ")", ";", "}", "$", "e", "=", "PLUG", "::", "exec_bin", ...
Parse a given config file and merge values into registry. Currenly only constants in configs are supported by this compiler. @todo should be parse variables, or just constants? @todo use native parser rather than shell out? @param string path to config file @return bool
[ "Parse", "a", "given", "config", "file", "and", "merge", "values", "into", "registry", ".", "Currenly", "only", "constants", "in", "configs", "are", "supported", "by", "this", "compiler", "." ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/compiler/PHPCompiler.php#L265-L282
train
pscheit/jparser
PLUG/compiler/PHPCompiler.php
PHPCompiler.register_include
function register_include( $path ){ if( ! isset($this->incs[$path]) ){ $this->incs[$path] = 1; return false; } else { $this->incs[$path]++; return true; } }
php
function register_include( $path ){ if( ! isset($this->incs[$path]) ){ $this->incs[$path] = 1; return false; } else { $this->incs[$path]++; return true; } }
[ "function", "register_include", "(", "$", "path", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "incs", "[", "$", "path", "]", ")", ")", "{", "$", "this", "->", "incs", "[", "$", "path", "]", "=", "1", ";", "return", "false", ";", ...
Register a file path for inclusion @param string absolute path @return bool whether file has already been included
[ "Register", "a", "file", "path", "for", "inclusion" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/compiler/PHPCompiler.php#L331-L340
train
pscheit/jparser
PLUG/compiler/PHPCompiler.php
PHPCompiler.next_dependency
function next_dependency(){ foreach( $this->dependencies as $path => $done ){ if( ! $done ){ $this->dependencies[$path] = 1; return $path; } } // none return null; }
php
function next_dependency(){ foreach( $this->dependencies as $path => $done ){ if( ! $done ){ $this->dependencies[$path] = 1; return $path; } } // none return null; }
[ "function", "next_dependency", "(", ")", "{", "foreach", "(", "$", "this", "->", "dependencies", "as", "$", "path", "=>", "$", "done", ")", "{", "if", "(", "!", "$", "done", ")", "{", "$", "this", "->", "dependencies", "[", "$", "path", "]", "=", ...
get next dependant file and flag as done @return string
[ "get", "next", "dependant", "file", "and", "flag", "as", "done" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/compiler/PHPCompiler.php#L375-L384
train
pscheit/jparser
PLUG/compiler/PHPCompiler.php
PHPCompiler.open_php
private function open_php( &$src ){ if( ! $this->inphp ){ $this->inphp = true; // this may result in back to back tags, which we can avoid with a bit of string manipulation. $makenice = $this->opt(COMPILER_OPTION_NICE_TAGS); if( $makenice && substr( $src, -2 ) === '?>' ){ // trim trailing close tag, so no need to open one $src = substr_replace( $src, '', -2 ); } else { $ws = $this->opt(COMPILER_OPTION_WHITESPACE) ? "\n" : ' '; $src .= '<?php'.$ws; } } return $src; }
php
private function open_php( &$src ){ if( ! $this->inphp ){ $this->inphp = true; // this may result in back to back tags, which we can avoid with a bit of string manipulation. $makenice = $this->opt(COMPILER_OPTION_NICE_TAGS); if( $makenice && substr( $src, -2 ) === '?>' ){ // trim trailing close tag, so no need to open one $src = substr_replace( $src, '', -2 ); } else { $ws = $this->opt(COMPILER_OPTION_WHITESPACE) ? "\n" : ' '; $src .= '<?php'.$ws; } } return $src; }
[ "private", "function", "open_php", "(", "&", "$", "src", ")", "{", "if", "(", "!", "$", "this", "->", "inphp", ")", "{", "$", "this", "->", "inphp", "=", "true", ";", "// this may result in back to back tags, which we can avoid with a bit of string manipulation.", ...
Open php tag if required. @usage <code>$src = $this->open_php( $src );</code> @param string current php source to modify @return void
[ "Open", "php", "tag", "if", "required", "." ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/compiler/PHPCompiler.php#L866-L883
train
pscheit/jparser
PLUG/compiler/PHPCompiler.php
PHPCompiler.close_php
private function close_php( &$src ){ if( $this->inphp ){ $this->inphp = false; // this may result in back to back tags, which we can avoid with a bit of string manipulation. $makenice = $this->opt(COMPILER_OPTION_NICE_TAGS); if( $makenice && substr( $src, -5 ) === '<?php' ){ // trim trailing open tag, so no need to close $src = substr_replace( $src, '', -5 ); } else { $src .= ' ?>'; } } return $src; }
php
private function close_php( &$src ){ if( $this->inphp ){ $this->inphp = false; // this may result in back to back tags, which we can avoid with a bit of string manipulation. $makenice = $this->opt(COMPILER_OPTION_NICE_TAGS); if( $makenice && substr( $src, -5 ) === '<?php' ){ // trim trailing open tag, so no need to close $src = substr_replace( $src, '', -5 ); } else { $src .= ' ?>'; } } return $src; }
[ "private", "function", "close_php", "(", "&", "$", "src", ")", "{", "if", "(", "$", "this", "->", "inphp", ")", "{", "$", "this", "->", "inphp", "=", "false", ";", "// this may result in back to back tags, which we can avoid with a bit of string manipulation.", "$",...
Close php tag if required. @usage <code>$src = $this->close_php( $src );</code> @param string current php source to modify @return void
[ "Close", "php", "tag", "if", "required", "." ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/compiler/PHPCompiler.php#L893-L909
train
pscheit/jparser
PLUG/session/PLUGSessionObject.php
PLUGSessionObject.session_lifespan
function session_lifespan( $ttl = null, $hibernate = null ){ $current = $this->sess_ttl; if( $ttl !== null ){ $this->sess_ttl = $ttl; } if( $hibernate !== null ){ $this->sess_hibernate = $hibernate; } return $current; }
php
function session_lifespan( $ttl = null, $hibernate = null ){ $current = $this->sess_ttl; if( $ttl !== null ){ $this->sess_ttl = $ttl; } if( $hibernate !== null ){ $this->sess_hibernate = $hibernate; } return $current; }
[ "function", "session_lifespan", "(", "$", "ttl", "=", "null", ",", "$", "hibernate", "=", "null", ")", "{", "$", "current", "=", "$", "this", "->", "sess_ttl", ";", "if", "(", "$", "ttl", "!==", "null", ")", "{", "$", "this", "->", "sess_ttl", "=",...
Define how many times object can be deserialized from session before it is dead @param int objects time-to-live @param bool optional hibernation flag, freezes lifespan when class definition not available @return int previous lifespan
[ "Define", "how", "many", "times", "object", "can", "be", "deserialized", "from", "session", "before", "it", "is", "dead" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/session/PLUGSessionObject.php#L54-L63
train
pscheit/jparser
PLUG/core/PLUG.php
PLUG.raise_error
static function raise_error( $code, $message, $type, array $trace = null ){ if( error_reporting() === 0 ){ // suppressed with `@' operator return; } self::clear_error_handlers(); if( is_null($trace) ){ $trace = debug_backtrace(); array_shift( $trace ); } $callee = current( $trace ); $Err = new PLUGError( $code, $type, $message, $callee['file'], $callee['line'], $trace ); $Err->raise(); self::set_error_handlers(); return $Err; }
php
static function raise_error( $code, $message, $type, array $trace = null ){ if( error_reporting() === 0 ){ // suppressed with `@' operator return; } self::clear_error_handlers(); if( is_null($trace) ){ $trace = debug_backtrace(); array_shift( $trace ); } $callee = current( $trace ); $Err = new PLUGError( $code, $type, $message, $callee['file'], $callee['line'], $trace ); $Err->raise(); self::set_error_handlers(); return $Err; }
[ "static", "function", "raise_error", "(", "$", "code", ",", "$", "message", ",", "$", "type", ",", "array", "$", "trace", "=", "null", ")", "{", "if", "(", "error_reporting", "(", ")", "===", "0", ")", "{", "// suppressed with `@' operator", "return", ";...
Force the raising of an error @internal @param string error message @param int error code @param int php error type constant @param array backtrace @return PLUGError reference to raised error
[ "Force", "the", "raising", "of", "an", "error" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/core/PLUG.php#L198-L213
train
pscheit/jparser
PLUG/core/PLUG.php
PLUG.raise_exception
static function raise_exception( Exception $Ex, $type ){ if( error_reporting() === 0 ){ // suppressed with `@' operator return; } PLUG::clear_error_handlers(); $code = $Ex->getCode() or $code = PLUG_EXCEPTION_STD; $Err = new PLUGError( $code, $type, $Ex->getMessage(), $Ex->getFile(), $Ex->getLine(), $Ex->getTrace() ); $Err->raise(); PLUG::set_error_handlers(); return $Err; }
php
static function raise_exception( Exception $Ex, $type ){ if( error_reporting() === 0 ){ // suppressed with `@' operator return; } PLUG::clear_error_handlers(); $code = $Ex->getCode() or $code = PLUG_EXCEPTION_STD; $Err = new PLUGError( $code, $type, $Ex->getMessage(), $Ex->getFile(), $Ex->getLine(), $Ex->getTrace() ); $Err->raise(); PLUG::set_error_handlers(); return $Err; }
[ "static", "function", "raise_exception", "(", "Exception", "$", "Ex", ",", "$", "type", ")", "{", "if", "(", "error_reporting", "(", ")", "===", "0", ")", "{", "// suppressed with `@' operator", "return", ";", "}", "PLUG", "::", "clear_error_handlers", "(", ...
Raise an error from an Exception @param Exception @param int php error type constant @return PLUGError
[ "Raise", "an", "error", "from", "an", "Exception" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/core/PLUG.php#L224-L235
train
pscheit/jparser
PLUG/core/PLUG.php
PLUG.dump_errors
static function dump_errors( $emask = PLUG_ERROR_REPORTING ){ $errs = PLUGError::get_errors( $emask ); foreach( $errs as $Err ){ $s = $Err->__toString(). "\n"; if( PLUG_CLI ){ PLUGCli::stderr( $s ); } else { echo $s; } } }
php
static function dump_errors( $emask = PLUG_ERROR_REPORTING ){ $errs = PLUGError::get_errors( $emask ); foreach( $errs as $Err ){ $s = $Err->__toString(). "\n"; if( PLUG_CLI ){ PLUGCli::stderr( $s ); } else { echo $s; } } }
[ "static", "function", "dump_errors", "(", "$", "emask", "=", "PLUG_ERROR_REPORTING", ")", "{", "$", "errs", "=", "PLUGError", "::", "get_errors", "(", "$", "emask", ")", ";", "foreach", "(", "$", "errs", "as", "$", "Err", ")", "{", "$", "s", "=", "$"...
Dump all raised errors to output @param int php error level constant @return Void
[ "Dump", "all", "raised", "errors", "to", "output" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/core/PLUG.php#L245-L256
train
pscheit/jparser
PLUG/core/PLUG.php
PLUG.set_error_display
static function set_error_display( $handler ){ if( ! is_callable($handler) ){ trigger_error( 'Error display handler is not callable ('.var_export($handler,1).')', E_USER_WARNING ); return false; } PLUGError::$displayfunc = $handler; return true; }
php
static function set_error_display( $handler ){ if( ! is_callable($handler) ){ trigger_error( 'Error display handler is not callable ('.var_export($handler,1).')', E_USER_WARNING ); return false; } PLUGError::$displayfunc = $handler; return true; }
[ "static", "function", "set_error_display", "(", "$", "handler", ")", "{", "if", "(", "!", "is_callable", "(", "$", "handler", ")", ")", "{", "trigger_error", "(", "'Error display handler is not callable ('", ".", "var_export", "(", "$", "handler", ",", "1", ")...
Register error display function. @param string | array handler callable with call_user_func @return bool
[ "Register", "error", "display", "function", "." ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/core/PLUG.php#L300-L307
train
pscheit/jparser
PLUG/core/PLUG.php
PLUG.set_error_logger
static function set_error_logger( $handler ){ if( ! is_callable($handler) ){ trigger_error( 'Error logging handler is not callable ('.var_export($handler,1).')', E_USER_WARNING ); return false; } PLUGError::$logfunc = $handler; return true; }
php
static function set_error_logger( $handler ){ if( ! is_callable($handler) ){ trigger_error( 'Error logging handler is not callable ('.var_export($handler,1).')', E_USER_WARNING ); return false; } PLUGError::$logfunc = $handler; return true; }
[ "static", "function", "set_error_logger", "(", "$", "handler", ")", "{", "if", "(", "!", "is_callable", "(", "$", "handler", ")", ")", "{", "trigger_error", "(", "'Error logging handler is not callable ('", ".", "var_export", "(", "$", "handler", ",", "1", ")"...
Register error logging function. @param string | array handler callable with call_user_func @return bool
[ "Register", "error", "logging", "function", "." ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/core/PLUG.php#L315-L322
train
pscheit/jparser
PLUG/core/PLUG.php
PLUG.set_error_terminator
static function set_error_terminator( $handler ){ if( ! is_callable($handler) ){ trigger_error( 'Fatal error handler is not callable ('.var_export($handler,1).')', E_USER_WARNING ); return false; } PLUGError::$deathfunc = $handler; return true; }
php
static function set_error_terminator( $handler ){ if( ! is_callable($handler) ){ trigger_error( 'Fatal error handler is not callable ('.var_export($handler,1).')', E_USER_WARNING ); return false; } PLUGError::$deathfunc = $handler; return true; }
[ "static", "function", "set_error_terminator", "(", "$", "handler", ")", "{", "if", "(", "!", "is_callable", "(", "$", "handler", ")", ")", "{", "trigger_error", "(", "'Fatal error handler is not callable ('", ".", "var_export", "(", "$", "handler", ",", "1", "...
Register script termination function @param string | array handler callable with call_user_func @return bool
[ "Register", "script", "termination", "function" ]
f9de77171c0d37d237e0e9a918ed7bff19e12095
https://github.com/pscheit/jparser/blob/f9de77171c0d37d237e0e9a918ed7bff19e12095/PLUG/core/PLUG.php#L330-L337
train
Ma27/Ma27ApiKeyAuthenticationBundle
EventListener/UpdateLastActionFieldListener.php
UpdateLastActionFieldListener.onFirewallLogin
public function onFirewallLogin(OnFirewallAuthenticationEvent $event) { $this->doModify($event); $this->om->persist($event->getUser()); $this->om->flush(); }
php
public function onFirewallLogin(OnFirewallAuthenticationEvent $event) { $this->doModify($event); $this->om->persist($event->getUser()); $this->om->flush(); }
[ "public", "function", "onFirewallLogin", "(", "OnFirewallAuthenticationEvent", "$", "event", ")", "{", "$", "this", "->", "doModify", "(", "$", "event", ")", ";", "$", "this", "->", "om", "->", "persist", "(", "$", "event", "->", "getUser", "(", ")", ")"...
Modifies the last action property on firewall authentication. @param OnFirewallAuthenticationEvent $event
[ "Modifies", "the", "last", "action", "property", "on", "firewall", "authentication", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/EventListener/UpdateLastActionFieldListener.php#L74-L80
train
Ma27/Ma27ApiKeyAuthenticationBundle
EventListener/UpdateLastActionFieldListener.php
UpdateLastActionFieldListener.doModify
private function doModify(AbstractUserEvent $event) { $this->classMetadata->modifyProperty( $event->getUser(), new \DateTime(sprintf('@%s', $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME'))), ClassMetadata::LAST_ACTION_PROPERTY ); }
php
private function doModify(AbstractUserEvent $event) { $this->classMetadata->modifyProperty( $event->getUser(), new \DateTime(sprintf('@%s', $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME'))), ClassMetadata::LAST_ACTION_PROPERTY ); }
[ "private", "function", "doModify", "(", "AbstractUserEvent", "$", "event", ")", "{", "$", "this", "->", "classMetadata", "->", "modifyProperty", "(", "$", "event", "->", "getUser", "(", ")", ",", "new", "\\", "DateTime", "(", "sprintf", "(", "'@%s'", ",", ...
Modifies the last action property of a user object. @param AbstractUserEvent $event
[ "Modifies", "the", "last", "action", "property", "of", "a", "user", "object", "." ]
3f1e2ea6eacefac0db41b2ad964c8ef262f0e408
https://github.com/Ma27/Ma27ApiKeyAuthenticationBundle/blob/3f1e2ea6eacefac0db41b2ad964c8ef262f0e408/EventListener/UpdateLastActionFieldListener.php#L87-L94
train
milejko/mmi-cms
src/Cms/Model/Acl.php
Acl.setupAcl
public static function setupAcl() { $acl = new \Mmi\Security\Acl; $aclData = (new CmsAclQuery) ->join('cms_role')->on('cms_role_id') ->find(); foreach ($aclData as $aclRule) { /* @var $aclData \Cms\Orm\CmsAclRecord */ $resource = ''; if ($aclRule->module) { $resource .= $aclRule->module . ':'; } if ($aclRule->controller) { $resource .= $aclRule->controller . ':'; } if ($aclRule->action) { $resource .= $aclRule->action . ':'; } $access = $aclRule->access; if ($access == 'allow' || $access == 'deny') { $acl->$access($aclRule->getJoined('cms_role')->name, trim($resource, ':')); } } return $acl; }
php
public static function setupAcl() { $acl = new \Mmi\Security\Acl; $aclData = (new CmsAclQuery) ->join('cms_role')->on('cms_role_id') ->find(); foreach ($aclData as $aclRule) { /* @var $aclData \Cms\Orm\CmsAclRecord */ $resource = ''; if ($aclRule->module) { $resource .= $aclRule->module . ':'; } if ($aclRule->controller) { $resource .= $aclRule->controller . ':'; } if ($aclRule->action) { $resource .= $aclRule->action . ':'; } $access = $aclRule->access; if ($access == 'allow' || $access == 'deny') { $acl->$access($aclRule->getJoined('cms_role')->name, trim($resource, ':')); } } return $acl; }
[ "public", "static", "function", "setupAcl", "(", ")", "{", "$", "acl", "=", "new", "\\", "Mmi", "\\", "Security", "\\", "Acl", ";", "$", "aclData", "=", "(", "new", "CmsAclQuery", ")", "->", "join", "(", "'cms_role'", ")", "->", "on", "(", "'cms_role...
Ustawianie ACL'a @return \Mmi\Security\Acl
[ "Ustawianie", "ACL", "a" ]
95483b08f25136b8d6bcf787ec4ecc3e8bdffb38
https://github.com/milejko/mmi-cms/blob/95483b08f25136b8d6bcf787ec4ecc3e8bdffb38/src/Cms/Model/Acl.php#L22-L45
train
Erdiko/users
src/models/user/event/Log.php
Log.create
public function create($userId=null, $eventLog=null, $eventData=null) { if(is_null($userId)) throw new \Exception('User ID is required.'); if(is_null($eventLog)) throw new \Exception('Event Log is required.'); if(!is_numeric($userId)) throw new \Exception("Invalid User ID."); $id = $this->save($this->generateEntity(intval($userId), $eventLog, $eventData)); return $id; }
php
public function create($userId=null, $eventLog=null, $eventData=null) { if(is_null($userId)) throw new \Exception('User ID is required.'); if(is_null($eventLog)) throw new \Exception('Event Log is required.'); if(!is_numeric($userId)) throw new \Exception("Invalid User ID."); $id = $this->save($this->generateEntity(intval($userId), $eventLog, $eventData)); return $id; }
[ "public", "function", "create", "(", "$", "userId", "=", "null", ",", "$", "eventLog", "=", "null", ",", "$", "eventData", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "userId", ")", ")", "throw", "new", "\\", "Exception", "(", "'User ID is...
Create user log entry @param int $userId @param string $eventLog @param string $eventData @return int $id
[ "Create", "user", "log", "entry" ]
a063e0c61ceccdbfeaf7750e92bac8c3565c39a9
https://github.com/Erdiko/users/blob/a063e0c61ceccdbfeaf7750e92bac8c3565c39a9/src/models/user/event/Log.php#L203-L211
train
mapbender/fom
src/FOM/ManagerBundle/Routing/AnnotatedRouteControllerLoader.php
AnnotatedRouteControllerLoader.configureRoute
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot) { parent::configureRoute($route, $class, $method, $annot); if(is_a($annot, 'FOM\ManagerBundle\Configuration\Route')) { $route->setPath($this->prefix . $route->getPath()); } }
php
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot) { parent::configureRoute($route, $class, $method, $annot); if(is_a($annot, 'FOM\ManagerBundle\Configuration\Route')) { $route->setPath($this->prefix . $route->getPath()); } }
[ "protected", "function", "configureRoute", "(", "Route", "$", "route", ",", "\\", "ReflectionClass", "$", "class", ",", "\\", "ReflectionMethod", "$", "method", ",", "$", "annot", ")", "{", "parent", "::", "configureRoute", "(", "$", "route", ",", "$", "cl...
For all route annotations using FOM\ManagerBundle\Configuration\Route, this adds the configured prefix. @inheritdoc
[ "For", "all", "route", "annotations", "using", "FOM", "\\", "ManagerBundle", "\\", "Configuration", "\\", "Route", "this", "adds", "the", "configured", "prefix", "." ]
6dea943121f3c3f9b1b4b14dc2a8e8640a120675
https://github.com/mapbender/fom/blob/6dea943121f3c3f9b1b4b14dc2a8e8640a120675/src/FOM/ManagerBundle/Routing/AnnotatedRouteControllerLoader.php#L36-L42
train
paypayue/paypay-soap
src/PayPayWebservice.php
PayPayWebservice.checkIntegrationState
public function checkIntegrationState() { $this->response = parent::checkIntegrationState($this->entity); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response)) { throw new Exception\IntegrationState($this->response); } return $this->response; }
php
public function checkIntegrationState() { $this->response = parent::checkIntegrationState($this->entity); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response)) { throw new Exception\IntegrationState($this->response); } return $this->response; }
[ "public", "function", "checkIntegrationState", "(", ")", "{", "$", "this", "->", "response", "=", "parent", "::", "checkIntegrationState", "(", "$", "this", "->", "entity", ")", ";", "/**\n * Checks the state of the platform integration.\n */", "if", "("...
Checks the current entity integration state @return ResponseIntegrationState
[ "Checks", "the", "current", "entity", "integration", "state" ]
ab01d5c041bbf1032fa5725abef5a6b19af746e4
https://github.com/paypayue/paypay-soap/blob/ab01d5c041bbf1032fa5725abef5a6b19af746e4/src/PayPayWebservice.php#L151-L163
train
paypayue/paypay-soap
src/PayPayWebservice.php
PayPayWebservice.subscribeToWebhook
public function subscribeToWebhook(Structure\RequestWebhook $requestWebhook) { $this->response = parent::subscribeToWebhook($this->entity, $requestWebhook); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->integrationState)) { throw new Exception\IntegrationState($this->response->integrationState); } /** * Caso ocorra algum erro específico do método. */ if ($this->response->integrationState->state == 0) { throw new Exception\IntegrationResponse( $this->response->integrationState->message, $this->response->integrationState->code ); } return $this->response; }
php
public function subscribeToWebhook(Structure\RequestWebhook $requestWebhook) { $this->response = parent::subscribeToWebhook($this->entity, $requestWebhook); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->integrationState)) { throw new Exception\IntegrationState($this->response->integrationState); } /** * Caso ocorra algum erro específico do método. */ if ($this->response->integrationState->state == 0) { throw new Exception\IntegrationResponse( $this->response->integrationState->message, $this->response->integrationState->code ); } return $this->response; }
[ "public", "function", "subscribeToWebhook", "(", "Structure", "\\", "RequestWebhook", "$", "requestWebhook", ")", "{", "$", "this", "->", "response", "=", "parent", "::", "subscribeToWebhook", "(", "$", "this", "->", "entity", ",", "$", "requestWebhook", ")", ...
Subscribe to a webhook to receive callbacks from events ocurred at PayPay. @param Structure\RequestWebhook $requestWebhook @return Structure\ResponseWebhook
[ "Subscribe", "to", "a", "webhook", "to", "receive", "callbacks", "from", "events", "ocurred", "at", "PayPay", "." ]
ab01d5c041bbf1032fa5725abef5a6b19af746e4
https://github.com/paypayue/paypay-soap/blob/ab01d5c041bbf1032fa5725abef5a6b19af746e4/src/PayPayWebservice.php#L172-L194
train
paypayue/paypay-soap
src/PayPayWebservice.php
PayPayWebservice.createPaymentReference
public function createPaymentReference(Structure\RequestReferenceDetails $paymentData) { $this->response = parent::createPaymentReference($this->entity, $paymentData); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->integrationState)) { throw new Exception\IntegrationState($this->response->integrationState); } /** * In case an error code is returned not related to the integration state. * (eg.: maximum daily amount exceeded, maximum reference amount, etc.) */ if ($this->response->state == 0) { throw new Exception\IntegrationResponse( $this->response->err_msg, $this->response->err_code ); } return $this->response; }
php
public function createPaymentReference(Structure\RequestReferenceDetails $paymentData) { $this->response = parent::createPaymentReference($this->entity, $paymentData); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->integrationState)) { throw new Exception\IntegrationState($this->response->integrationState); } /** * In case an error code is returned not related to the integration state. * (eg.: maximum daily amount exceeded, maximum reference amount, etc.) */ if ($this->response->state == 0) { throw new Exception\IntegrationResponse( $this->response->err_msg, $this->response->err_code ); } return $this->response; }
[ "public", "function", "createPaymentReference", "(", "Structure", "\\", "RequestReferenceDetails", "$", "paymentData", ")", "{", "$", "this", "->", "response", "=", "parent", "::", "createPaymentReference", "(", "$", "this", "->", "entity", ",", "$", "paymentData"...
Creates a new payment reference via PayPay. @param array $paymentData Payment information ex: amount @return ResponseGetPayment $result Webservice response
[ "Creates", "a", "new", "payment", "reference", "via", "PayPay", "." ]
ab01d5c041bbf1032fa5725abef5a6b19af746e4
https://github.com/paypayue/paypay-soap/blob/ab01d5c041bbf1032fa5725abef5a6b19af746e4/src/PayPayWebservice.php#L202-L225
train
paypayue/paypay-soap
src/PayPayWebservice.php
PayPayWebservice.validatePaymentReference
public function validatePaymentReference(Structure\RequestReferenceDetails $paymentData) { $this->response = parent::validatePaymentReference($this->entity, $paymentData); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->integrationState)) { throw new Exception\IntegrationState($this->response->integrationState); } /** * In case an error code is returned not related to the integration state. * (eg.: maximum daily amount exceeded, maximum reference amount, etc.) */ if (!empty($this->response->err_code)) { throw new Exception\IntegrationResponse( $this->response->err_msg, $this->response->err_code ); } return $this->response; }
php
public function validatePaymentReference(Structure\RequestReferenceDetails $paymentData) { $this->response = parent::validatePaymentReference($this->entity, $paymentData); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->integrationState)) { throw new Exception\IntegrationState($this->response->integrationState); } /** * In case an error code is returned not related to the integration state. * (eg.: maximum daily amount exceeded, maximum reference amount, etc.) */ if (!empty($this->response->err_code)) { throw new Exception\IntegrationResponse( $this->response->err_msg, $this->response->err_code ); } return $this->response; }
[ "public", "function", "validatePaymentReference", "(", "Structure", "\\", "RequestReferenceDetails", "$", "paymentData", ")", "{", "$", "this", "->", "response", "=", "parent", "::", "validatePaymentReference", "(", "$", "this", "->", "entity", ",", "$", "paymentD...
Validates a new payment reference via PayPay. @param array $paymentData Payment information ex: amount @return ResponseValidatePayment $result Webservice response
[ "Validates", "a", "new", "payment", "reference", "via", "PayPay", "." ]
ab01d5c041bbf1032fa5725abef5a6b19af746e4
https://github.com/paypayue/paypay-soap/blob/ab01d5c041bbf1032fa5725abef5a6b19af746e4/src/PayPayWebservice.php#L233-L256
train
paypayue/paypay-soap
src/PayPayWebservice.php
PayPayWebservice.doWebPayment
public function doWebPayment($requestWebPayment) { $this->response = parent::doWebPayment($this->entity, $requestWebPayment); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->requestState)) { throw new Exception\IntegrationState($this->response->requestState); } /** * Se a resposta retornar algum erro previsto. */ if ($this->response->requestState->state == 0) { throw new Exception\IntegrationResponse( $this->response->requestState->message, $this->response->requestState->code ); } return $this->response; }
php
public function doWebPayment($requestWebPayment) { $this->response = parent::doWebPayment($this->entity, $requestWebPayment); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->requestState)) { throw new Exception\IntegrationState($this->response->requestState); } /** * Se a resposta retornar algum erro previsto. */ if ($this->response->requestState->state == 0) { throw new Exception\IntegrationResponse( $this->response->requestState->message, $this->response->requestState->code ); } return $this->response; }
[ "public", "function", "doWebPayment", "(", "$", "requestWebPayment", ")", "{", "$", "this", "->", "response", "=", "parent", "::", "doWebPayment", "(", "$", "this", "->", "entity", ",", "$", "requestWebPayment", ")", ";", "/**\n * Checks the state of the p...
Calls PayPay Webservice to request a payment via PayPay redirect. @param RequestCreditCardPayment $requestWebPayment @return ResponseCreditCardPayment The webservice response containing the relevant payment data.
[ "Calls", "PayPay", "Webservice", "to", "request", "a", "payment", "via", "PayPay", "redirect", "." ]
ab01d5c041bbf1032fa5725abef5a6b19af746e4
https://github.com/paypayue/paypay-soap/blob/ab01d5c041bbf1032fa5725abef5a6b19af746e4/src/PayPayWebservice.php#L264-L286
train
paypayue/paypay-soap
src/PayPayWebservice.php
PayPayWebservice.checkWebPayment
public function checkWebPayment($token, $transactionId) { $requestPayment = new Structure\RequestPaymentDetails($token, $transactionId); $this->response = parent::checkWebPayment($this->entity, $requestPayment); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->requestState)) { throw new Exception\IntegrationState($this->response->requestState); } if ($this->response->requestState->state == 0) { throw new Exception\IntegrationResponse( $this->response->requestState->message, $this->response->requestState->code ); } return $this->response; }
php
public function checkWebPayment($token, $transactionId) { $requestPayment = new Structure\RequestPaymentDetails($token, $transactionId); $this->response = parent::checkWebPayment($this->entity, $requestPayment); /** * Checks the state of the platform integration. */ if (Exception\IntegrationState::check($this->response->requestState)) { throw new Exception\IntegrationState($this->response->requestState); } if ($this->response->requestState->state == 0) { throw new Exception\IntegrationResponse( $this->response->requestState->message, $this->response->requestState->code ); } return $this->response; }
[ "public", "function", "checkWebPayment", "(", "$", "token", ",", "$", "transactionId", ")", "{", "$", "requestPayment", "=", "new", "Structure", "\\", "RequestPaymentDetails", "(", "$", "token", ",", "$", "transactionId", ")", ";", "$", "this", "->", "respon...
Calls PayPay Webservice to check the payment state. @param RequestPaymentDetails $paymentDetails Request payment @return ResponsePaymentDetails Response payment details
[ "Calls", "PayPay", "Webservice", "to", "check", "the", "payment", "state", "." ]
ab01d5c041bbf1032fa5725abef5a6b19af746e4
https://github.com/paypayue/paypay-soap/blob/ab01d5c041bbf1032fa5725abef5a6b19af746e4/src/PayPayWebservice.php#L294-L315
train