repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
dms-org/package.blog | src/Infrastructure/Persistence/BlogArticleMapper.php | BlogArticleMapper.define | protected function define(MapperDefinition $map)
{
$map->type(BlogArticle::class);
$map->toTable('articles');
$map->idToPrimaryKey('id');
$map->column($map->getOrm()->getNamespace() . 'author_id')->asUnsignedInt();
$map->relation(BlogArticle::AUTHOR)
->to(BlogA... | php | protected function define(MapperDefinition $map)
{
$map->type(BlogArticle::class);
$map->toTable('articles');
$map->idToPrimaryKey('id');
$map->column($map->getOrm()->getNamespace() . 'author_id')->asUnsignedInt();
$map->relation(BlogArticle::AUTHOR)
->to(BlogA... | [
"protected",
"function",
"define",
"(",
"MapperDefinition",
"$",
"map",
")",
"{",
"$",
"map",
"->",
"type",
"(",
"BlogArticle",
"::",
"class",
")",
";",
"$",
"map",
"->",
"toTable",
"(",
"'articles'",
")",
";",
"$",
"map",
"->",
"idToPrimaryKey",
"(",
... | Defines the entity mapper
@param MapperDefinition $map
@return void | [
"Defines",
"the",
"entity",
"mapper"
] | train | https://github.com/dms-org/package.blog/blob/1500f6fad20d81289a0dfa617fc1c54699f01e16/src/Infrastructure/Persistence/BlogArticleMapper.php#L42-L99 |
milkyway-multimedia/ss-mwm-formfields | src/Composite/HasOneCompositeField.php | HasOneCompositeField.saveInto | public function saveInto(DataObjectInterface $parent)
{
$record = $this->record;
$parent->flushCache(false); // Flush session cache in case a relation id was changed during form->saveInto
if (!$record) {
$relName = substr($this->name, -2) == 'ID' ? substr($this->name, -2, 2) : ... | php | public function saveInto(DataObjectInterface $parent)
{
$record = $this->record;
$parent->flushCache(false); // Flush session cache in case a relation id was changed during form->saveInto
if (!$record) {
$relName = substr($this->name, -2) == 'ID' ? substr($this->name, -2, 2) : ... | [
"public",
"function",
"saveInto",
"(",
"DataObjectInterface",
"$",
"parent",
")",
"{",
"$",
"record",
"=",
"$",
"this",
"->",
"record",
";",
"$",
"parent",
"->",
"flushCache",
"(",
"false",
")",
";",
"// Flush session cache in case a relation id was changed during f... | This method takes care of saving all the form data
@param DataObjectInterface $parent | [
"This",
"method",
"takes",
"care",
"of",
"saving",
"all",
"the",
"form",
"data"
] | train | https://github.com/milkyway-multimedia/ss-mwm-formfields/blob/b98d84d494c92d6881dcea50c9c8334e5f487e1d/src/Composite/HasOneCompositeField.php#L268-L349 |
seeruo/framework | src/Command/ServerCommand.php | ServerCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
try {
$port = $this->config['port'] ?: 9001;
$public = $this->config['public'] ?: 'Public';
$output->writeln([
'<bg=red;>=================================</>',
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
try {
$port = $this->config['port'] ?: 9001;
$public = $this->config['public'] ?: 'Public';
$output->writeln([
'<bg=red;>=================================</>',
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"try",
"{",
"$",
"port",
"=",
"$",
"this",
"->",
"config",
"[",
"'port'",
"]",
"?",
":",
"9001",
";",
"$",
"public",
"=",
"$",
"... | [执行命令]
@DateTime 2018-12-13
@param InputInterface $input 输入对象
@param OutputInterface $output 输出对象 | [
"[",
"执行命令",
"]"
] | train | https://github.com/seeruo/framework/blob/689c6e95bc95fe2ae037e056d8228820dd08d7e9/src/Command/ServerCommand.php#L45-L73 |
joomla-framework/crypt | src/Cipher/Crypto.php | Crypto.decrypt | public function decrypt($data, Key $key)
{
// Validate key.
if ($key->getType() !== 'crypto')
{
throw new InvalidKeyTypeException('crypto', $key->getType());
}
// Decrypt the data.
try
{
return DefuseCrypto::decrypt($data, DefuseKey::loadFromAsciiSafeString($key->getPrivate()));
}
catch (Wrong... | php | public function decrypt($data, Key $key)
{
// Validate key.
if ($key->getType() !== 'crypto')
{
throw new InvalidKeyTypeException('crypto', $key->getType());
}
// Decrypt the data.
try
{
return DefuseCrypto::decrypt($data, DefuseKey::loadFromAsciiSafeString($key->getPrivate()));
}
catch (Wrong... | [
"public",
"function",
"decrypt",
"(",
"$",
"data",
",",
"Key",
"$",
"key",
")",
"{",
"// Validate key.",
"if",
"(",
"$",
"key",
"->",
"getType",
"(",
")",
"!==",
"'crypto'",
")",
"{",
"throw",
"new",
"InvalidKeyTypeException",
"(",
"'crypto'",
",",
"$",
... | Method to decrypt a data string.
@param string $data The encrypted string to decrypt.
@param Key $key The key object to use for decryption.
@return string The decrypted data string.
@since __DEPLOY_VERSION__
@throws \InvalidArgumentException
@throws \RuntimeException | [
"Method",
"to",
"decrypt",
"a",
"data",
"string",
"."
] | train | https://github.com/joomla-framework/crypt/blob/5b24370bd5f07d2b305f66e62294c6d10a3f619d/src/Cipher/Crypto.php#L39-L60 |
joomla-framework/crypt | src/Cipher/Crypto.php | Crypto.encrypt | public function encrypt($data, Key $key)
{
// Validate key.
if ($key->getType() !== 'crypto')
{
throw new InvalidKeyTypeException('crypto', $key->getType());
}
// Encrypt the data.
try
{
return DefuseCrypto::encrypt($data, DefuseKey::loadFromAsciiSafeString($key->getPrivate()));
}
catch (Envir... | php | public function encrypt($data, Key $key)
{
// Validate key.
if ($key->getType() !== 'crypto')
{
throw new InvalidKeyTypeException('crypto', $key->getType());
}
// Encrypt the data.
try
{
return DefuseCrypto::encrypt($data, DefuseKey::loadFromAsciiSafeString($key->getPrivate()));
}
catch (Envir... | [
"public",
"function",
"encrypt",
"(",
"$",
"data",
",",
"Key",
"$",
"key",
")",
"{",
"// Validate key.",
"if",
"(",
"$",
"key",
"->",
"getType",
"(",
")",
"!==",
"'crypto'",
")",
"{",
"throw",
"new",
"InvalidKeyTypeException",
"(",
"'crypto'",
",",
"$",
... | Method to encrypt a data string.
@param string $data The data string to encrypt.
@param Key $key The key object to use for encryption.
@return string The encrypted data string.
@since __DEPLOY_VERSION__
@throws \InvalidArgumentException
@throws \RuntimeException | [
"Method",
"to",
"encrypt",
"a",
"data",
"string",
"."
] | train | https://github.com/joomla-framework/crypt/blob/5b24370bd5f07d2b305f66e62294c6d10a3f619d/src/Cipher/Crypto.php#L74-L91 |
joomla-framework/crypt | src/Cipher/Crypto.php | Crypto.generateKey | public function generateKey(array $options = [])
{
// Generate the encryption key.
try
{
$public = DefuseKey::createNewRandomKey();
}
catch (EnvironmentIsBrokenException $ex)
{
throw new \RuntimeException('Cannot safely create a key', $ex->getCode(), $ex);
}
// Create the new encryption key obje... | php | public function generateKey(array $options = [])
{
// Generate the encryption key.
try
{
$public = DefuseKey::createNewRandomKey();
}
catch (EnvironmentIsBrokenException $ex)
{
throw new \RuntimeException('Cannot safely create a key', $ex->getCode(), $ex);
}
// Create the new encryption key obje... | [
"public",
"function",
"generateKey",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"// Generate the encryption key.",
"try",
"{",
"$",
"public",
"=",
"DefuseKey",
"::",
"createNewRandomKey",
"(",
")",
";",
"}",
"catch",
"(",
"EnvironmentIsBrokenExceptio... | Method to generate a new encryption key object.
@param array $options Key generation options.
@return Key
@since __DEPLOY_VERSION__
@throws \RuntimeException | [
"Method",
"to",
"generate",
"a",
"new",
"encryption",
"key",
"object",
"."
] | train | https://github.com/joomla-framework/crypt/blob/5b24370bd5f07d2b305f66e62294c6d10a3f619d/src/Cipher/Crypto.php#L103-L117 |
ClanCats/Core | src/bundles/Session/Manager/File.php | Manager_File.read | public function read( $id )
{
if ( $this->has( $id ) )
{
return unserialize( \CCFile::read( $this->file_path( $id ) ) );
}
return array();
} | php | public function read( $id )
{
if ( $this->has( $id ) )
{
return unserialize( \CCFile::read( $this->file_path( $id ) ) );
}
return array();
} | [
"public",
"function",
"read",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"return",
"unserialize",
"(",
"\\",
"CCFile",
"::",
"read",
"(",
"$",
"this",
"->",
"file_path",
"(",
"$",
"id",
")",
")... | Read data from the session dirver
@param string $id The session id key.
@return array | [
"Read",
"data",
"from",
"the",
"session",
"dirver"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/File.php#L20-L28 |
ClanCats/Core | src/bundles/Session/Manager/File.php | Manager_File.write | public function write( $id, $data )
{
if ( !\CCFile::write( $this->file_path( $id ), serialize( $data ) ) )
{
\CCError::exception( new Exception( 'Could not write session file.' ) );
}
return true;
} | php | public function write( $id, $data )
{
if ( !\CCFile::write( $this->file_path( $id ), serialize( $data ) ) )
{
\CCError::exception( new Exception( 'Could not write session file.' ) );
}
return true;
} | [
"public",
"function",
"write",
"(",
"$",
"id",
",",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"\\",
"CCFile",
"::",
"write",
"(",
"$",
"this",
"->",
"file_path",
"(",
"$",
"id",
")",
",",
"serialize",
"(",
"$",
"data",
")",
")",
")",
"{",
"\\",
... | Check if a session with the given key already exists
@param string $id The session id key.
@param array $data
@return bool | [
"Check",
"if",
"a",
"session",
"with",
"the",
"given",
"key",
"already",
"exists"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/File.php#L48-L55 |
ClanCats/Core | src/bundles/Session/Manager/File.php | Manager_File.gc | public function gc( $time )
{
foreach( \CCFile::ls( \CCStorage::path( 'sessions/*' ) ) as $file )
{
if ( ( filemtime( $file ) - ( time() - $time ) ) < 0 )
{
if ( !\CCFile::delete( $file ) )
{
throw new Exception( "Manager_File::gc - cannot delete session file." );
}
}
}
} | php | public function gc( $time )
{
foreach( \CCFile::ls( \CCStorage::path( 'sessions/*' ) ) as $file )
{
if ( ( filemtime( $file ) - ( time() - $time ) ) < 0 )
{
if ( !\CCFile::delete( $file ) )
{
throw new Exception( "Manager_File::gc - cannot delete session file." );
}
}
}
} | [
"public",
"function",
"gc",
"(",
"$",
"time",
")",
"{",
"foreach",
"(",
"\\",
"CCFile",
"::",
"ls",
"(",
"\\",
"CCStorage",
"::",
"path",
"(",
"'sessions/*'",
")",
")",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"(",
"filemtime",
"(",
"$",
"file",
"... | Delete session that are older than the given time in secounds
@param int $time
@return void | [
"Delete",
"session",
"that",
"are",
"older",
"than",
"the",
"given",
"time",
"in",
"secounds"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/File.php#L63-L75 |
phpmob/changmin | src/PhpMob/Sylius/Grid/FieldType/SprintfFieldType.php | SprintfFieldType.render | public function render(Field $field, $data, array $options)
{
$value = $this->dataExtractor->get($field, $data);
$field->setOptions($options);
return sprintf($options['format'], is_string($value) ? htmlspecialchars($value) : $value);
} | php | public function render(Field $field, $data, array $options)
{
$value = $this->dataExtractor->get($field, $data);
$field->setOptions($options);
return sprintf($options['format'], is_string($value) ? htmlspecialchars($value) : $value);
} | [
"public",
"function",
"render",
"(",
"Field",
"$",
"field",
",",
"$",
"data",
",",
"array",
"$",
"options",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"dataExtractor",
"->",
"get",
"(",
"$",
"field",
",",
"$",
"data",
")",
";",
"$",
"field",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/Sylius/Grid/FieldType/SprintfFieldType.php#L42-L48 |
xinix-technology/norm | src/Norm/Connection/MongoConnection.php | MongoConnection.marshall | public function marshall($object)
{
if ($object instanceof NDateTime
|| $object instanceof DT
|| $object instanceof NDate) {
return new MongoDate($object->getTimestamp());
} elseif ($object instanceof NormArray) {
return $object->toArray();
}... | php | public function marshall($object)
{
if ($object instanceof NDateTime
|| $object instanceof DT
|| $object instanceof NDate) {
return new MongoDate($object->getTimestamp());
} elseif ($object instanceof NormArray) {
return $object->toArray();
}... | [
"public",
"function",
"marshall",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"NDateTime",
"||",
"$",
"object",
"instanceof",
"DT",
"||",
"$",
"object",
"instanceof",
"NDate",
")",
"{",
"return",
"new",
"MongoDate",
"(",
"$",
"o... | {@inheritDoc} | [
"{"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Connection/MongoConnection.php#L189-L202 |
titon/db | src/Titon/Db/Driver/ResultSet/PdoResultSet.php | PdoResultSet.count | public function count() {
$this->execute();
$count = (int) $this->_statement->fetchColumn();
$this->close();
return $count;
} | php | public function count() {
$this->execute();
$count = (int) $this->_statement->fetchColumn();
$this->close();
return $count;
} | [
"public",
"function",
"count",
"(",
")",
"{",
"$",
"this",
"->",
"execute",
"(",
")",
";",
"$",
"count",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"_statement",
"->",
"fetchColumn",
"(",
")",
";",
"$",
"this",
"->",
"close",
"(",
")",
";",
"return... | {@inheritdoc} | [
"{"
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/ResultSet/PdoResultSet.php#L56-L64 |
titon/db | src/Titon/Db/Driver/ResultSet/PdoResultSet.php | PdoResultSet.execute | public function execute() {
if ($this->hasExecuted()) {
return $this;
}
$startTime = microtime();
if ($this->_statement->execute()) {
if (preg_match('/^(update|insert|delete)/i', $this->_statement->queryString)) {
$this->_count = $this->_statemen... | php | public function execute() {
if ($this->hasExecuted()) {
return $this;
}
$startTime = microtime();
if ($this->_statement->execute()) {
if (preg_match('/^(update|insert|delete)/i', $this->_statement->queryString)) {
$this->_count = $this->_statemen... | [
"public",
"function",
"execute",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasExecuted",
"(",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"startTime",
"=",
"microtime",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_statement",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/ResultSet/PdoResultSet.php#L69-L90 |
titon/db | src/Titon/Db/Driver/ResultSet/PdoResultSet.php | PdoResultSet.find | public function find() {
$this->execute();
$statement = $this->_statement;
$columnMeta = [];
$columnCount = $statement->columnCount();
if ($columnCount) {
foreach (range(0, $columnCount - 1) as $index) {
try {
$columnMeta[] = $sta... | php | public function find() {
$this->execute();
$statement = $this->_statement;
$columnMeta = [];
$columnCount = $statement->columnCount();
if ($columnCount) {
foreach (range(0, $columnCount - 1) as $index) {
try {
$columnMeta[] = $sta... | [
"public",
"function",
"find",
"(",
")",
"{",
"$",
"this",
"->",
"execute",
"(",
")",
";",
"$",
"statement",
"=",
"$",
"this",
"->",
"_statement",
";",
"$",
"columnMeta",
"=",
"[",
"]",
";",
"$",
"columnCount",
"=",
"$",
"statement",
"->",
"columnCoun... | {@inheritdoc} | [
"{"
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/ResultSet/PdoResultSet.php#L95-L176 |
titon/db | src/Titon/Db/Driver/ResultSet/PdoResultSet.php | PdoResultSet.getStatement | public function getStatement() {
return $this->cache(__METHOD__, function() {
$statement = preg_replace("/ {2,}/", " ", $this->_statement->queryString); // Trim spaces
foreach ($this->getParams() as $param) {
switch ($param[1]) {
case PDO::PARAM_NULL:... | php | public function getStatement() {
return $this->cache(__METHOD__, function() {
$statement = preg_replace("/ {2,}/", " ", $this->_statement->queryString); // Trim spaces
foreach ($this->getParams() as $param) {
switch ($param[1]) {
case PDO::PARAM_NULL:... | [
"public",
"function",
"getStatement",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"cache",
"(",
"__METHOD__",
",",
"function",
"(",
")",
"{",
"$",
"statement",
"=",
"preg_replace",
"(",
"\"/ {2,}/\"",
",",
"\" \"",
",",
"$",
"this",
"->",
"_statement",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/ResultSet/PdoResultSet.php#L181-L198 |
titon/db | src/Titon/Db/Driver/ResultSet/PdoResultSet.php | PdoResultSet._mapAliases | protected function _mapAliases() {
return $this->cache(__METHOD__, function() {
$query = $this->getQuery();
if (!$query) {
return [];
}
$alias = $query->getAlias();
$map = [
$query->getTable() => $alias,
... | php | protected function _mapAliases() {
return $this->cache(__METHOD__, function() {
$query = $this->getQuery();
if (!$query) {
return [];
}
$alias = $query->getAlias();
$map = [
$query->getTable() => $alias,
... | [
"protected",
"function",
"_mapAliases",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"cache",
"(",
"__METHOD__",
",",
"function",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"getQuery",
"(",
")",
";",
"if",
"(",
"!",
"$",
"query",
")",
"{",... | Return a mapping of table to alias for the primary table and joins.
@return array | [
"Return",
"a",
"mapping",
"of",
"table",
"to",
"alias",
"for",
"the",
"primary",
"table",
"and",
"joins",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/ResultSet/PdoResultSet.php#L218-L241 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/OrmManagerServiceProvider.php | OrmManagerServiceProvider.register | public function register()
{
$this->mergeConfigFrom(__DIR__.'/Config/orm.php', 'orm');
$this->app->singleton('orm.database', function ($app) {
return new DatabaseConnection($app['db']);
});
$this->app->singleton('orm.manager', function ($app) {
return new Mo... | php | public function register()
{
$this->mergeConfigFrom(__DIR__.'/Config/orm.php', 'orm');
$this->app->singleton('orm.database', function ($app) {
return new DatabaseConnection($app['db']);
});
$this->app->singleton('orm.manager', function ($app) {
return new Mo... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"__DIR__",
".",
"'/Config/orm.php'",
",",
"'orm'",
")",
";",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'orm.database'",
",",
"function",
"(",
"$",
"app",
... | Register any application services. | [
"Register",
"any",
"application",
"services",
"."
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/OrmManagerServiceProvider.php#L22-L41 |
shiftio/safestream-php-sdk | src/Video/VideoClient.php | VideoClient.create | public function create(Video $video, $waitForIngest = 0) {
if(is_null($video)) {
throw new VideoClientException("No video provided");
}
if(is_null($video->sourceUrl) || !filter_var($video->sourceUrl, FILTER_VALIDATE_URL)) {
throw new VideoClientException("Invalid source ... | php | public function create(Video $video, $waitForIngest = 0) {
if(is_null($video)) {
throw new VideoClientException("No video provided");
}
if(is_null($video->sourceUrl) || !filter_var($video->sourceUrl, FILTER_VALIDATE_URL)) {
throw new VideoClientException("Invalid source ... | [
"public",
"function",
"create",
"(",
"Video",
"$",
"video",
",",
"$",
"waitForIngest",
"=",
"0",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"video",
")",
")",
"{",
"throw",
"new",
"VideoClientException",
"(",
"\"No video provided\"",
")",
";",
"}",
"if",
... | Creates a new video allowing a specific timeout while waiting for the video to downloaded
and encoded. If not timeout is set then the function will return immediately, before the
ingest is complete. The video cannot be watermarked until it has been ingested at which
point the video status will be INGESTED.
This will b... | [
"Creates",
"a",
"new",
"video",
"allowing",
"a",
"specific",
"timeout",
"while",
"waiting",
"for",
"the",
"video",
"to",
"downloaded",
"and",
"encoded",
".",
"If",
"not",
"timeout",
"is",
"set",
"then",
"the",
"function",
"will",
"return",
"immediately",
"be... | train | https://github.com/shiftio/safestream-php-sdk/blob/1957cd5574725b24da1bbff9059aa30a9ca123c2/src/Video/VideoClient.php#L77-L114 |
shiftio/safestream-php-sdk | src/Video/VideoClient.php | VideoClient.find | public function find($videoKey) {
if(is_null($videoKey) || empty($videoKey)) {
throw new VideoClientException("A key is needed to fnd a video");
}
try {
// Request the video from the SafeStream REST API
$videos = $this->get(sprintf("%s?key=%s", $this->apiReso... | php | public function find($videoKey) {
if(is_null($videoKey) || empty($videoKey)) {
throw new VideoClientException("A key is needed to fnd a video");
}
try {
// Request the video from the SafeStream REST API
$videos = $this->get(sprintf("%s?key=%s", $this->apiReso... | [
"public",
"function",
"find",
"(",
"$",
"videoKey",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"videoKey",
")",
"||",
"empty",
"(",
"$",
"videoKey",
")",
")",
"{",
"throw",
"new",
"VideoClientException",
"(",
"\"A key is needed to fnd a video\"",
")",
";",
... | Gets an existing video by it's key.
@param $videoKey: If no key was passed in when creating the video then the key will be the
source URL of the video
@return mixed: An existing video {@link Video}
@throws VideoClientException | [
"Gets",
"an",
"existing",
"video",
"by",
"it",
"s",
"key",
"."
] | train | https://github.com/shiftio/safestream-php-sdk/blob/1957cd5574725b24da1bbff9059aa30a9ca123c2/src/Video/VideoClient.php#L124-L137 |
zodream/thirdparty | src/ALi/BaseALi.php | BaseALi.getRsa | public function getRsa() {
$rsa = new Rsa();
$rsa->setPrivateKey(empty($this->getPrivateKeyFile())
|| !$this->getPrivateKeyFile()->exist() ? $this->privateKey : $this->getPrivateKeyFile())
->setPublicKey(empty($this->getPublicKeyFile())
|| !$this->getPublicKeyFile... | php | public function getRsa() {
$rsa = new Rsa();
$rsa->setPrivateKey(empty($this->getPrivateKeyFile())
|| !$this->getPrivateKeyFile()->exist() ? $this->privateKey : $this->getPrivateKeyFile())
->setPublicKey(empty($this->getPublicKeyFile())
|| !$this->getPublicKeyFile... | [
"public",
"function",
"getRsa",
"(",
")",
"{",
"$",
"rsa",
"=",
"new",
"Rsa",
"(",
")",
";",
"$",
"rsa",
"->",
"setPrivateKey",
"(",
"empty",
"(",
"$",
"this",
"->",
"getPrivateKeyFile",
"(",
")",
")",
"||",
"!",
"$",
"this",
"->",
"getPrivateKeyFile... | 获取rsa | [
"获取rsa"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/ALi/BaseALi.php#L139-L148 |
zodream/thirdparty | src/ALi/BaseALi.php | BaseALi.encodeContent | protected function encodeContent(array $args) {
$data = [];
foreach ($args as $key => $item) {
$data[] = sprintf('"%s":"%s"', $key, $item);
}
$arg = '{'.implode(',', $data).'}';
if (!empty($this->encryptKey)
&& $this->encryptType == self::AES) {
... | php | protected function encodeContent(array $args) {
$data = [];
foreach ($args as $key => $item) {
$data[] = sprintf('"%s":"%s"', $key, $item);
}
$arg = '{'.implode(',', $data).'}';
if (!empty($this->encryptKey)
&& $this->encryptType == self::AES) {
... | [
"protected",
"function",
"encodeContent",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"data",
"[",
"]",
"=",
"sprintf",
"(",
"'\"%s\":\"%s\"'... | 合并biz_content
@param array $args
@return string | [
"合并biz_content"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/ALi/BaseALi.php#L163-L174 |
zodream/thirdparty | src/ALi/BaseALi.php | BaseALi.sign | public function sign($content) {
if (is_array($content)) {
$this->ignoreKeys = ['sign'];
$content = $this->getSignContent($content);
}
if ($this->getSignType() == self::MD5) {
return md5($content.$this->key);
}
return $this->getRsa()->sign($con... | php | public function sign($content) {
if (is_array($content)) {
$this->ignoreKeys = ['sign'];
$content = $this->getSignContent($content);
}
if ($this->getSignType() == self::MD5) {
return md5($content.$this->key);
}
return $this->getRsa()->sign($con... | [
"public",
"function",
"sign",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"content",
")",
")",
"{",
"$",
"this",
"->",
"ignoreKeys",
"=",
"[",
"'sign'",
"]",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"getSignContent",
"(",
"$... | 签名 签名必须包括sign_type
@param array|string $content
@return string
@throws \Exception | [
"签名",
"签名必须包括sign_type"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/ALi/BaseALi.php#L183-L192 |
zodream/thirdparty | src/ALi/BaseALi.php | BaseALi.verify | public function verify($params, $sign = null) {
list($content, $sign) = $this->getSignAndSource($params, $sign);
$result = $this->verifyContent($content, $sign);
if (!$result && strpos($content, '\\/') > 0) {
$content = str_replace('\\/', '/', $content);
return $this->ver... | php | public function verify($params, $sign = null) {
list($content, $sign) = $this->getSignAndSource($params, $sign);
$result = $this->verifyContent($content, $sign);
if (!$result && strpos($content, '\\/') > 0) {
$content = str_replace('\\/', '/', $content);
return $this->ver... | [
"public",
"function",
"verify",
"(",
"$",
"params",
",",
"$",
"sign",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"content",
",",
"$",
"sign",
")",
"=",
"$",
"this",
"->",
"getSignAndSource",
"(",
"$",
"params",
",",
"$",
"sign",
")",
";",
"$",
"res... | 验签 验签不包括 sign_type
@param array $params
@param string $sign
@return bool
@throws \Exception | [
"验签",
"验签不包括",
"sign_type"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/ALi/BaseALi.php#L216-L224 |
shrink0r/workflux | src/State/StateTrait.php | StateTrait.execute | public function execute(InputInterface $input): OutputInterface
{
$this->validator->validateInput($this, $input);
$output = $this->generateOutput($input);
$this->validator->validateOutput($this, $output);
return $output;
} | php | public function execute(InputInterface $input): OutputInterface
{
$this->validator->validateInput($this, $input);
$output = $this->generateOutput($input);
$this->validator->validateOutput($this, $output);
return $output;
} | [
"public",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
")",
":",
"OutputInterface",
"{",
"$",
"this",
"->",
"validator",
"->",
"validateInput",
"(",
"$",
"this",
",",
"$",
"input",
")",
";",
"$",
"output",
"=",
"$",
"this",
"->",
"generate... | @param InputInterface $input
@return OutputInterface | [
"@param",
"InputInterface",
"$input"
] | train | https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/State/StateTrait.php#L63-L69 |
shrink0r/workflux | src/State/StateTrait.php | StateTrait.generateOutput | private function generateOutput(InputInterface $input): OutputInterface
{
return new Output(
$this->name,
array_merge(
$this->evaluateInputExports($input),
$this->generateOutputParams($input)
)
);
} | php | private function generateOutput(InputInterface $input): OutputInterface
{
return new Output(
$this->name,
array_merge(
$this->evaluateInputExports($input),
$this->generateOutputParams($input)
)
);
} | [
"private",
"function",
"generateOutput",
"(",
"InputInterface",
"$",
"input",
")",
":",
"OutputInterface",
"{",
"return",
"new",
"Output",
"(",
"$",
"this",
"->",
"name",
",",
"array_merge",
"(",
"$",
"this",
"->",
"evaluateInputExports",
"(",
"$",
"input",
... | @param InputInterface $input
@return OutputInterface | [
"@param",
"InputInterface",
"$input"
] | train | https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/State/StateTrait.php#L135-L144 |
shrink0r/workflux | src/State/StateTrait.php | StateTrait.evaluateInputExports | private function evaluateInputExports(InputInterface $input): array
{
$exports = [];
foreach ($this->getSetting('_output', []) as $key => $value) {
$exports[$key] = $this->expression_engine->evaluate($value, [ 'input' => $input ]);
}
return $exports;
} | php | private function evaluateInputExports(InputInterface $input): array
{
$exports = [];
foreach ($this->getSetting('_output', []) as $key => $value) {
$exports[$key] = $this->expression_engine->evaluate($value, [ 'input' => $input ]);
}
return $exports;
} | [
"private",
"function",
"evaluateInputExports",
"(",
"InputInterface",
"$",
"input",
")",
":",
"array",
"{",
"$",
"exports",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getSetting",
"(",
"'_output'",
",",
"[",
"]",
")",
"as",
"$",
"key",
"=>... | @param InputInterface $input
@return mixed[] | [
"@param",
"InputInterface",
"$input"
] | train | https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/State/StateTrait.php#L151-L158 |
webforge-labs/psc-cms | lib/Psc/TPL/ContentStream/Converter.php | Converter.shiftFirstEntry | public function shiftFirstEntry(ContentStream $cs, $type, \Closure $withFilter = NULL) {
if (($entry = $cs->findFirst($type, $withFilter)) != NULL) {
$vars = $this->convertEntryTemplateVariables($entry, $cs);
$cs->removeEntry($entry);
return $vars;
}
return NULL;
} | php | public function shiftFirstEntry(ContentStream $cs, $type, \Closure $withFilter = NULL) {
if (($entry = $cs->findFirst($type, $withFilter)) != NULL) {
$vars = $this->convertEntryTemplateVariables($entry, $cs);
$cs->removeEntry($entry);
return $vars;
}
return NULL;
} | [
"public",
"function",
"shiftFirstEntry",
"(",
"ContentStream",
"$",
"cs",
",",
"$",
"type",
",",
"\\",
"Closure",
"$",
"withFilter",
"=",
"NULL",
")",
"{",
"if",
"(",
"(",
"$",
"entry",
"=",
"$",
"cs",
"->",
"findFirst",
"(",
"$",
"type",
",",
"$",
... | Finds the first occurence of the entry, removes it and returns the template Variables for it
if nothing is found NULL is returned
if entry is found it will be removed from content stream and its variables will be returned
if $withFilter is given the function has to return true to find the entry
@param Closure $withFil... | [
"Finds",
"the",
"first",
"occurence",
"of",
"the",
"entry",
"removes",
"it",
"and",
"returns",
"the",
"template",
"Variables",
"for",
"it"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/TPL/ContentStream/Converter.php#L139-L148 |
webforge-labs/psc-cms | lib/Psc/TPL/ContentStream/Converter.php | Converter.convertSerialized | public function convertSerialized(ContentStream $cs) {
$serialized = array();
foreach ($cs->getEntries() as $entry) {
if ($entry instanceof ContextAware) {
$entry->setContext($this->context);
}
$serialized[] = $this->serializeEntry($entry);
}
return $serialize... | php | public function convertSerialized(ContentStream $cs) {
$serialized = array();
foreach ($cs->getEntries() as $entry) {
if ($entry instanceof ContextAware) {
$entry->setContext($this->context);
}
$serialized[] = $this->serializeEntry($entry);
}
return $serialize... | [
"public",
"function",
"convertSerialized",
"(",
"ContentStream",
"$",
"cs",
")",
"{",
"$",
"serialized",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"cs",
"->",
"getEntries",
"(",
")",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"$",
"entry",
"ins... | Konvertiert den ContentStream in eine Repräsenation die nur aus einem Array besteht
der Javascript LayoutManager kann dies mit unserialize() lesen und daraus widgets erstellen
@return array | [
"Konvertiert",
"den",
"ContentStream",
"in",
"eine",
"Repräsenation",
"die",
"nur",
"aus",
"einem",
"Array",
"besteht"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/TPL/ContentStream/Converter.php#L156-L169 |
webforge-labs/psc-cms | lib/Psc/TPL/ContentStream/Converter.php | Converter.convertUnserialized | public function convertUnserialized(Array $serialized, ContentStream $contentStream = NULL) {
if (isset($contentStream)) {
foreach ($serialized as $serializedEntry) {
$entry = $this->unserializeEntry((object) $serializedEntry);
$entry->setContentStream($contentStream);
}
return $co... | php | public function convertUnserialized(Array $serialized, ContentStream $contentStream = NULL) {
if (isset($contentStream)) {
foreach ($serialized as $serializedEntry) {
$entry = $this->unserializeEntry((object) $serializedEntry);
$entry->setContentStream($contentStream);
}
return $co... | [
"public",
"function",
"convertUnserialized",
"(",
"Array",
"$",
"serialized",
",",
"ContentStream",
"$",
"contentStream",
"=",
"NULL",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"contentStream",
")",
")",
"{",
"foreach",
"(",
"$",
"serialized",
"as",
"$",
"se... | Convertes an serialized ContentStream to the real object structure | [
"Convertes",
"an",
"serialized",
"ContentStream",
"to",
"the",
"real",
"object",
"structure"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/TPL/ContentStream/Converter.php#L183-L198 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php | ObjectService.getContentManager | public function getContentManager()
{
if ($this->contentManager != null) {
return $this->contentManager;
}
$this->contentManager = new ContentManager($this->options, $this->getContentService(), $this->getContentTypeService(), $this->getLocationService(), $this->getLocationManage... | php | public function getContentManager()
{
if ($this->contentManager != null) {
return $this->contentManager;
}
$this->contentManager = new ContentManager($this->options, $this->getContentService(), $this->getContentTypeService(), $this->getLocationService(), $this->getLocationManage... | [
"public",
"function",
"getContentManager",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"contentManager",
"!=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"contentManager",
";",
"}",
"$",
"this",
"->",
"contentManager",
"=",
"new",
"ContentManager",
"(... | Returns content manager.
@return ContentManager | [
"Returns",
"content",
"manager",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php#L79-L92 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php | ObjectService.getLocationManager | public function getLocationManager()
{
if ($this->locationManager != null) {
return $this->locationManager;
}
$this->locationManager = new LocationManager($this->getLocationService(), $this->getContentService());
if ($this->logger) {
$this->locationManager->... | php | public function getLocationManager()
{
if ($this->locationManager != null) {
return $this->locationManager;
}
$this->locationManager = new LocationManager($this->getLocationService(), $this->getContentService());
if ($this->logger) {
$this->locationManager->... | [
"public",
"function",
"getLocationManager",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"locationManager",
"!=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"locationManager",
";",
"}",
"$",
"this",
"->",
"locationManager",
"=",
"new",
"LocationManager",... | Returns location manager.
@return LocationManager | [
"Returns",
"location",
"manager",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php#L99-L112 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php | ObjectService.getContentTypeManager | public function getContentTypeManager()
{
if ($this->contentTypeManager != null) {
return $this->contentTypeManager;
}
$this->contentTypeManager = new ContentTypeManager($this->getContentTypeService(), $this->getLanguageManager(), $this->getFieldDefinitionSubManager(), $this->ge... | php | public function getContentTypeManager()
{
if ($this->contentTypeManager != null) {
return $this->contentTypeManager;
}
$this->contentTypeManager = new ContentTypeManager($this->getContentTypeService(), $this->getLanguageManager(), $this->getFieldDefinitionSubManager(), $this->ge... | [
"public",
"function",
"getContentTypeManager",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"contentTypeManager",
"!=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"contentTypeManager",
";",
"}",
"$",
"this",
"->",
"contentTypeManager",
"=",
"new",
"Conte... | Returns contenttype manager.
@return ContentTypeManager | [
"Returns",
"contenttype",
"manager",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php#L119-L132 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php | ObjectService.getLanguageManager | public function getLanguageManager()
{
if ($this->languageManager != null) {
return $this->languageManager;
}
$this->languageManager = new LanguageManager($this->getLanguageService());
if ($this->logger) {
$this->languageManager->setLogger($this->logger);
... | php | public function getLanguageManager()
{
if ($this->languageManager != null) {
return $this->languageManager;
}
$this->languageManager = new LanguageManager($this->getLanguageService());
if ($this->logger) {
$this->languageManager->setLogger($this->logger);
... | [
"public",
"function",
"getLanguageManager",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"languageManager",
"!=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"languageManager",
";",
"}",
"$",
"this",
"->",
"languageManager",
"=",
"new",
"LanguageManager",... | Returns language manager.
@return LanguageManager | [
"Returns",
"language",
"manager",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php#L139-L152 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php | ObjectService.getUserGroupManager | public function getUserGroupManager()
{
if ($this->userGroupManager != null) {
return $this->userGroupManager;
}
$this->userGroupManager = new UserGroupManager($this->options, $this->getUserService(), $this->getContentService(), $this->getContentTypeService());
if ($thi... | php | public function getUserGroupManager()
{
if ($this->userGroupManager != null) {
return $this->userGroupManager;
}
$this->userGroupManager = new UserGroupManager($this->options, $this->getUserService(), $this->getContentService(), $this->getContentTypeService());
if ($thi... | [
"public",
"function",
"getUserGroupManager",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"userGroupManager",
"!=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"userGroupManager",
";",
"}",
"$",
"this",
"->",
"userGroupManager",
"=",
"new",
"UserGroupMana... | Returns user group manager.
@return UserGroupManager | [
"Returns",
"user",
"group",
"manager",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php#L159-L172 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php | ObjectService.getUserManager | public function getUserManager()
{
if ($this->userManager != null) {
return $this->userManager;
}
$this->userManager = new UserManager($this->options, $this->getUserService(), $this->getContentTypeService(), $this->getUserGroupManager());
if ($this->logger) {
... | php | public function getUserManager()
{
if ($this->userManager != null) {
return $this->userManager;
}
$this->userManager = new UserManager($this->options, $this->getUserService(), $this->getContentTypeService(), $this->getUserGroupManager());
if ($this->logger) {
... | [
"public",
"function",
"getUserManager",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"userManager",
"!=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"userManager",
";",
"}",
"$",
"this",
"->",
"userManager",
"=",
"new",
"UserManager",
"(",
"$",
"th... | Returns user manager.
@return UserManager | [
"Returns",
"user",
"manager",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php#L179-L192 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php | ObjectService.createOrUpdate | public function createOrUpdate($object)
{
foreach ($this->getManagerMapping() as $class => $callable) {
if ($object instanceof $class) {
/** @var UpdaterInterface $manager */
$manager = call_user_func($callable);
return $manager->createOrUpdate($o... | php | public function createOrUpdate($object)
{
foreach ($this->getManagerMapping() as $class => $callable) {
if ($object instanceof $class) {
/** @var UpdaterInterface $manager */
$manager = call_user_func($callable);
return $manager->createOrUpdate($o... | [
"public",
"function",
"createOrUpdate",
"(",
"$",
"object",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getManagerMapping",
"(",
")",
"as",
"$",
"class",
"=>",
"$",
"callable",
")",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"$",
"class",
")",
"{",... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php#L245-L257 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php | ObjectService.remove | public function remove($object)
{
foreach ($this->getManagerMapping() as $class => $callable) {
if ($object instanceof $class) {
/** @var RemoverInterface $manager */
$manager = call_user_func($callable);
return $manager->remove($object);
... | php | public function remove($object)
{
foreach ($this->getManagerMapping() as $class => $callable) {
if ($object instanceof $class) {
/** @var RemoverInterface $manager */
$manager = call_user_func($callable);
return $manager->remove($object);
... | [
"public",
"function",
"remove",
"(",
"$",
"object",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getManagerMapping",
"(",
")",
"as",
"$",
"class",
"=>",
"$",
"callable",
")",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"$",
"class",
")",
"{",
"/** ... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/Core/ObjectService.php#L262-L274 |
OwlyCode/StreamingBird | src/Oauth.php | Oauth.getAuthorizationHeader | public function getAuthorizationHeader($url, array $params, array $overrides = [])
{
$headers = $this->prepareHeaders('POST', $url, $params, $overrides);
$headers = implode(',', array_map(function($name, $value){
return sprintf('%s="%s"', $name, $value);
}, array_keys($headers),... | php | public function getAuthorizationHeader($url, array $params, array $overrides = [])
{
$headers = $this->prepareHeaders('POST', $url, $params, $overrides);
$headers = implode(',', array_map(function($name, $value){
return sprintf('%s="%s"', $name, $value);
}, array_keys($headers),... | [
"public",
"function",
"getAuthorizationHeader",
"(",
"$",
"url",
",",
"array",
"$",
"params",
",",
"array",
"$",
"overrides",
"=",
"[",
"]",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"prepareHeaders",
"(",
"'POST'",
",",
"$",
"url",
",",
"$",
... | @param string $url
@param array $params
@return string | [
"@param",
"string",
"$url",
"@param",
"array",
"$params"
] | train | https://github.com/OwlyCode/StreamingBird/blob/177fc8a9dc8f911865a5abd9ac8d4ef85cef4003/src/Oauth.php#L47-L56 |
OwlyCode/StreamingBird | src/Oauth.php | Oauth.prepareHeaders | protected function prepareHeaders($method, $url, array $params, array $overrides = [])
{
$oauth = array_merge([
'oauth_consumer_key' => $this->consumerKey,
'oauth_nonce' => md5(uniqid(rand(), true)),
'oauth_signature_method' => 'HMAC-SHA1',
'oau... | php | protected function prepareHeaders($method, $url, array $params, array $overrides = [])
{
$oauth = array_merge([
'oauth_consumer_key' => $this->consumerKey,
'oauth_nonce' => md5(uniqid(rand(), true)),
'oauth_signature_method' => 'HMAC-SHA1',
'oau... | [
"protected",
"function",
"prepareHeaders",
"(",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"params",
",",
"array",
"$",
"overrides",
"=",
"[",
"]",
")",
"{",
"$",
"oauth",
"=",
"array_merge",
"(",
"[",
"'oauth_consumer_key'",
"=>",
"$",
"this",
... | Prepares oauth headers for a given request.
@param string $method
@param string $url
@param array $params
@return array | [
"Prepares",
"oauth",
"headers",
"for",
"a",
"given",
"request",
"."
] | train | https://github.com/OwlyCode/StreamingBird/blob/177fc8a9dc8f911865a5abd9ac8d4ef85cef4003/src/Oauth.php#L67-L92 |
OwlyCode/StreamingBird | src/Oauth.php | Oauth.generateSignature | protected function generateSignature($method, $url, array $params)
{
$concat = implode('&', array_map(function($name, $value){
return sprintf('%s=%s', $name, $value);
}, array_keys($params), $params));
$concatenatedParams = rawurlencode($concat);
// normalize url
... | php | protected function generateSignature($method, $url, array $params)
{
$concat = implode('&', array_map(function($name, $value){
return sprintf('%s=%s', $name, $value);
}, array_keys($params), $params));
$concatenatedParams = rawurlencode($concat);
// normalize url
... | [
"protected",
"function",
"generateSignature",
"(",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"params",
")",
"{",
"$",
"concat",
"=",
"implode",
"(",
"'&'",
",",
"array_map",
"(",
"function",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"re... | See https://dev.twitter.com/oauth/overview/creating-signatures
@param string $method
@param string $url
@param array $params
@return string | [
"See",
"https",
":",
"//",
"dev",
".",
"twitter",
".",
"com",
"/",
"oauth",
"/",
"overview",
"/",
"creating",
"-",
"signatures"
] | train | https://github.com/OwlyCode/StreamingBird/blob/177fc8a9dc8f911865a5abd9ac8d4ef85cef4003/src/Oauth.php#L103-L134 |
CakeCMS/Core | src/View/Widget/MaterializeCss/CheckboxWidget.php | CheckboxWidget.render | public function render(array $data, ContextInterface $context)
{
$data += ['class' => ''];
$data['class'] .= ' filled-in ';
$data['class'] = trim($data['class']);
return parent::render($data, $context);
} | php | public function render(array $data, ContextInterface $context)
{
$data += ['class' => ''];
$data['class'] .= ' filled-in ';
$data['class'] = trim($data['class']);
return parent::render($data, $context);
} | [
"public",
"function",
"render",
"(",
"array",
"$",
"data",
",",
"ContextInterface",
"$",
"context",
")",
"{",
"$",
"data",
"+=",
"[",
"'class'",
"=>",
"''",
"]",
";",
"$",
"data",
"[",
"'class'",
"]",
".=",
"' filled-in '",
";",
"$",
"data",
"[",
"'c... | Render a checkbox element.
@param array $data The data to create a checkbox with.
@param \Cake\View\Form\ContextInterface $context The current form context.
@return string Generated HTML string. | [
"Render",
"a",
"checkbox",
"element",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Widget/MaterializeCss/CheckboxWidget.php#L36-L43 |
aedart/laravel-helpers | src/Traits/Auth/PasswordBrokerFactoryTrait.php | PasswordBrokerFactoryTrait.getPasswordBrokerFactory | public function getPasswordBrokerFactory(): ?PasswordBrokerFactory
{
if (!$this->hasPasswordBrokerFactory()) {
$this->setPasswordBrokerFactory($this->getDefaultPasswordBrokerFactory());
}
return $this->passwordBrokerFactory;
} | php | public function getPasswordBrokerFactory(): ?PasswordBrokerFactory
{
if (!$this->hasPasswordBrokerFactory()) {
$this->setPasswordBrokerFactory($this->getDefaultPasswordBrokerFactory());
}
return $this->passwordBrokerFactory;
} | [
"public",
"function",
"getPasswordBrokerFactory",
"(",
")",
":",
"?",
"PasswordBrokerFactory",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasPasswordBrokerFactory",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setPasswordBrokerFactory",
"(",
"$",
"this",
"->",
"getDe... | Get password broker factory
If no password broker factory has been set, this method will
set and return a default password broker factory, if any such
value is available
@see getDefaultPasswordBrokerFactory()
@return PasswordBrokerFactory|null password broker factory or null if none password broker factory has been ... | [
"Get",
"password",
"broker",
"factory"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Auth/PasswordBrokerFactoryTrait.php#L53-L59 |
mle86/php-wq | src/WQ/WorkServerAdapter/AffixAdapter.php | AffixAdapter.getNextQueueEntry | public function getNextQueueEntry($workQueue, int $timeout = self::DEFAULT_TIMEOUT): ?QueueEntry
{
$workQueue = (array)$workQueue;
foreach ($workQueue as &$wq) {
$wq = $this->fixQueueName($wq);
}
unset($wq);
return $this->server->getNextQueueEntry($workQueue, $ti... | php | public function getNextQueueEntry($workQueue, int $timeout = self::DEFAULT_TIMEOUT): ?QueueEntry
{
$workQueue = (array)$workQueue;
foreach ($workQueue as &$wq) {
$wq = $this->fixQueueName($wq);
}
unset($wq);
return $this->server->getNextQueueEntry($workQueue, $ti... | [
"public",
"function",
"getNextQueueEntry",
"(",
"$",
"workQueue",
",",
"int",
"$",
"timeout",
"=",
"self",
"::",
"DEFAULT_TIMEOUT",
")",
":",
"?",
"QueueEntry",
"{",
"$",
"workQueue",
"=",
"(",
"array",
")",
"$",
"workQueue",
";",
"foreach",
"(",
"$",
"w... | Proxy methods: ///////////////////////////////////////////////////////// | [
"Proxy",
"methods",
":",
"/////////////////////////////////////////////////////////"
] | train | https://github.com/mle86/php-wq/blob/e1ca1dcfd3d40edb0085f6dfa83d90db74253de4/src/WQ/WorkServerAdapter/AffixAdapter.php#L77-L86 |
aedart/laravel-helpers | src/Traits/Broadcasting/BroadcastTrait.php | BroadcastTrait.getBroadcast | public function getBroadcast(): ?Broadcaster
{
if (!$this->hasBroadcast()) {
$this->setBroadcast($this->getDefaultBroadcast());
}
return $this->broadcast;
} | php | public function getBroadcast(): ?Broadcaster
{
if (!$this->hasBroadcast()) {
$this->setBroadcast($this->getDefaultBroadcast());
}
return $this->broadcast;
} | [
"public",
"function",
"getBroadcast",
"(",
")",
":",
"?",
"Broadcaster",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasBroadcast",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setBroadcast",
"(",
"$",
"this",
"->",
"getDefaultBroadcast",
"(",
")",
")",
";",
... | Get broadcast
If no broadcast has been set, this method will
set and return a default broadcast, if any such
value is available
@see getDefaultBroadcast()
@return Broadcaster|null broadcast or null if none broadcast has been set | [
"Get",
"broadcast"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Broadcasting/BroadcastTrait.php#L53-L59 |
aedart/laravel-helpers | src/Traits/Broadcasting/BroadcastTrait.php | BroadcastTrait.getDefaultBroadcast | public function getDefaultBroadcast(): ?Broadcaster
{
// By default, the Broadcast Facade does not return the
// any actual broadcaster, but rather an
// instance of a manager.
// Therefore, we make sure only to obtain its
// "broadcaster", to make sure that its only the
... | php | public function getDefaultBroadcast(): ?Broadcaster
{
// By default, the Broadcast Facade does not return the
// any actual broadcaster, but rather an
// instance of a manager.
// Therefore, we make sure only to obtain its
// "broadcaster", to make sure that its only the
... | [
"public",
"function",
"getDefaultBroadcast",
"(",
")",
":",
"?",
"Broadcaster",
"{",
"// By default, the Broadcast Facade does not return the",
"// any actual broadcaster, but rather an",
"// instance of a manager.",
"// Therefore, we make sure only to obtain its",
"// \"broadcaster\", to ... | Get a default broadcast value, if any is available
@return Broadcaster|null A default broadcast value or Null if no default value is available | [
"Get",
"a",
"default",
"broadcast",
"value",
"if",
"any",
"is",
"available"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Broadcasting/BroadcastTrait.php#L76-L89 |
Chill-project/Main | Export/ExportManager.php | ExportManager.getExports | public function getExports($whereUserIsGranted = true)
{
foreach ($this->exports as $alias => $export) {
if ($whereUserIsGranted) {
if ($this->isGrantedForElement($export, null, null)) {
yield $alias => $export;
}
} else {
... | php | public function getExports($whereUserIsGranted = true)
{
foreach ($this->exports as $alias => $export) {
if ($whereUserIsGranted) {
if ($this->isGrantedForElement($export, null, null)) {
yield $alias => $export;
}
} else {
... | [
"public",
"function",
"getExports",
"(",
"$",
"whereUserIsGranted",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"exports",
"as",
"$",
"alias",
"=>",
"$",
"export",
")",
"{",
"if",
"(",
"$",
"whereUserIsGranted",
")",
"{",
"if",
"(",
"$",
... | Return all exports. The exports's alias are the array's keys.
@param boolean $whereUserIsGranted if true (default), restrict to user which are granted the right to execute the export
@return ExportInterface[] an array where export's alias are keys | [
"Return",
"all",
"exports",
".",
"The",
"exports",
"s",
"alias",
"are",
"the",
"array",
"s",
"keys",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L194-L205 |
Chill-project/Main | Export/ExportManager.php | ExportManager.getExport | public function getExport($alias)
{
if (!array_key_exists($alias, $this->exports)) {
throw new \RuntimeException("The export with alias $alias is not known.");
}
return $this->exports[$alias];
} | php | public function getExport($alias)
{
if (!array_key_exists($alias, $this->exports)) {
throw new \RuntimeException("The export with alias $alias is not known.");
}
return $this->exports[$alias];
} | [
"public",
"function",
"getExport",
"(",
"$",
"alias",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"alias",
",",
"$",
"this",
"->",
"exports",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"The export with alias $alias is not known... | Return an export by his alias
@param string $alias
@return ExportInterface
@throws \RuntimeException | [
"Return",
"an",
"export",
"by",
"his",
"alias"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L214-L221 |
Chill-project/Main | Export/ExportManager.php | ExportManager.& | public function &getFiltersApplyingOn(ExportInterface $export, array $centers = null)
{
foreach ($this->filters as $alias => $filter) {
if (in_array($filter->applyOn(), $export->supportsModifiers())
&& $this->isGrantedForElement($filter, $export, $centers)) {
... | php | public function &getFiltersApplyingOn(ExportInterface $export, array $centers = null)
{
foreach ($this->filters as $alias => $filter) {
if (in_array($filter->applyOn(), $export->supportsModifiers())
&& $this->isGrantedForElement($filter, $export, $centers)) {
... | [
"public",
"function",
"&",
"getFiltersApplyingOn",
"(",
"ExportInterface",
"$",
"export",
",",
"array",
"$",
"centers",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"filters",
"as",
"$",
"alias",
"=>",
"$",
"filter",
")",
"{",
"if",
"(",
"... | Return a \Generator containing filter which support type. If `$centers` is
not null, restrict the given filters to the center the user have access to.
if $centers is null, the function will returns all filters where the user
has access in every centers he can reach (if the user can use the filter F in
center A, but no... | [
"Return",
"a",
"\\",
"Generator",
"containing",
"filter",
"which",
"support",
"type",
".",
"If",
"$centers",
"is",
"not",
"null",
"restrict",
"the",
"given",
"filters",
"to",
"the",
"center",
"the",
"user",
"have",
"access",
"to",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L297-L305 |
Chill-project/Main | Export/ExportManager.php | ExportManager.isGrantedForElement | public function isGrantedForElement(ExportElementInterface $element, ExportInterface $export = NULL, array $centers = null)
{
if ($element instanceof ExportInterface) {
$role = $element->requiredRole();
} elseif ($element instanceof ModifierInterface ) {
if (is_null($element-... | php | public function isGrantedForElement(ExportElementInterface $element, ExportInterface $export = NULL, array $centers = null)
{
if ($element instanceof ExportInterface) {
$role = $element->requiredRole();
} elseif ($element instanceof ModifierInterface ) {
if (is_null($element-... | [
"public",
"function",
"isGrantedForElement",
"(",
"ExportElementInterface",
"$",
"element",
",",
"ExportInterface",
"$",
"export",
"=",
"NULL",
",",
"array",
"$",
"centers",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"element",
"instanceof",
"ExportInterface",
")",
... | Return true if the current user has access to the ExportElement for every
center, false if the user hasn't access to element for at least one center.
@param \Chill\MainBundle\Export\ExportElementInterface $element
@param array|null $centers, if null, the function take into account all the reachables centers for the cu... | [
"Return",
"true",
"if",
"the",
"current",
"user",
"has",
"access",
"to",
"the",
"ExportElement",
"for",
"every",
"center",
"false",
"if",
"the",
"user",
"hasn",
"t",
"access",
"to",
"element",
"for",
"at",
"least",
"one",
"center",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L315-L358 |
Chill-project/Main | Export/ExportManager.php | ExportManager.& | public function &getAggregatorsApplyingOn(ExportInterface $export, array $centers = null)
{
foreach ($this->aggregators as $alias => $aggregator) {
if (in_array($aggregator->applyOn(), $export->supportsModifiers()) &&
$this->isGrantedForElement($aggregator, $export, $centers... | php | public function &getAggregatorsApplyingOn(ExportInterface $export, array $centers = null)
{
foreach ($this->aggregators as $alias => $aggregator) {
if (in_array($aggregator->applyOn(), $export->supportsModifiers()) &&
$this->isGrantedForElement($aggregator, $export, $centers... | [
"public",
"function",
"&",
"getAggregatorsApplyingOn",
"(",
"ExportInterface",
"$",
"export",
",",
"array",
"$",
"centers",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"aggregators",
"as",
"$",
"alias",
"=>",
"$",
"aggregator",
")",
"{",
"if"... | Return a \Generator containing aggregators which support type
@return AggregatorInterface[] a \Generator that contains aggretagors. The key is the filter's alias | [
"Return",
"a",
"\\",
"Generator",
"containing",
"aggregators",
"which",
"support",
"type"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L365-L373 |
Chill-project/Main | Export/ExportManager.php | ExportManager.generate | public function generate($exportAlias, array $pickedCentersData, array $data, array $formatterData)
{
$export = $this->getExport($exportAlias);
//$qb = $this->em->createQueryBuilder();
$centers = $this->getPickedCenters($pickedCentersData);
$query = $export->initiateQuery(
... | php | public function generate($exportAlias, array $pickedCentersData, array $data, array $formatterData)
{
$export = $this->getExport($exportAlias);
//$qb = $this->em->createQueryBuilder();
$centers = $this->getPickedCenters($pickedCentersData);
$query = $export->initiateQuery(
... | [
"public",
"function",
"generate",
"(",
"$",
"exportAlias",
",",
"array",
"$",
"pickedCentersData",
",",
"array",
"$",
"data",
",",
"array",
"$",
"formatterData",
")",
"{",
"$",
"export",
"=",
"$",
"this",
"->",
"getExport",
"(",
"$",
"exportAlias",
")",
... | Generate a response which contains the requested data.
@param string $exportAlias
@param mixed[] $data
@return Response | [
"Generate",
"a",
"response",
"which",
"contains",
"the",
"requested",
"data",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L382-L450 |
Chill-project/Main | Export/ExportManager.php | ExportManager.buildCenterReachableScopes | private function buildCenterReachableScopes(array $centers, ExportElementInterface $element) {
$r = array();
foreach($centers as $center) {
$r[] = array(
'center' => $center,
'circles' => $this->authorizationHelper->getReachableScopes($this->user,
... | php | private function buildCenterReachableScopes(array $centers, ExportElementInterface $element) {
$r = array();
foreach($centers as $center) {
$r[] = array(
'center' => $center,
'circles' => $this->authorizationHelper->getReachableScopes($this->user,
... | [
"private",
"function",
"buildCenterReachableScopes",
"(",
"array",
"$",
"centers",
",",
"ExportElementInterface",
"$",
"element",
")",
"{",
"$",
"r",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"centers",
"as",
"$",
"center",
")",
"{",
"$",
"r",
"[... | build the array required for defining centers and circles in the initiate
queries of ExportElementsInterfaces
@param \Chill\MainBundle\Entity\Center[] $centers | [
"build",
"the",
"array",
"required",
"for",
"defining",
"centers",
"and",
"circles",
"in",
"the",
"initiate",
"queries",
"of",
"ExportElementsInterfaces"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L458-L470 |
Chill-project/Main | Export/ExportManager.php | ExportManager.getUsedAggregatorsAliases | public function getUsedAggregatorsAliases(array $data)
{
$aggregators = $this->retrieveUsedAggregators($data[ExportType::AGGREGATOR_KEY]);
return array_keys(iterator_to_array($aggregators));
} | php | public function getUsedAggregatorsAliases(array $data)
{
$aggregators = $this->retrieveUsedAggregators($data[ExportType::AGGREGATOR_KEY]);
return array_keys(iterator_to_array($aggregators));
} | [
"public",
"function",
"getUsedAggregatorsAliases",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"aggregators",
"=",
"$",
"this",
"->",
"retrieveUsedAggregators",
"(",
"$",
"data",
"[",
"ExportType",
"::",
"AGGREGATOR_KEY",
"]",
")",
";",
"return",
"array_keys",
"... | get the aggregators typse used in the form export data
@param array $data the data from the export form
@return string[] | [
"get",
"the",
"aggregators",
"typse",
"used",
"in",
"the",
"form",
"export",
"data"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L478-L483 |
Chill-project/Main | Export/ExportManager.php | ExportManager.retrieveUsedModifiers | private function retrieveUsedModifiers($data)
{
$usedTypes = array_merge(
$this->retrieveUsedFiltersType($data[ExportType::FILTER_KEY]),
$this->retrieveUsedAggregatorsType($data[ExportType::AGGREGATOR_KEY])
);
$this->logger->debug('Required ty... | php | private function retrieveUsedModifiers($data)
{
$usedTypes = array_merge(
$this->retrieveUsedFiltersType($data[ExportType::FILTER_KEY]),
$this->retrieveUsedAggregatorsType($data[ExportType::AGGREGATOR_KEY])
);
$this->logger->debug('Required ty... | [
"private",
"function",
"retrieveUsedModifiers",
"(",
"$",
"data",
")",
"{",
"$",
"usedTypes",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"retrieveUsedFiltersType",
"(",
"$",
"data",
"[",
"ExportType",
"::",
"FILTER_KEY",
"]",
")",
",",
"$",
"this",
"->",
... | parse the data to retrieve the used filters and aggregators
@param mixed $data
@return string[] | [
"parse",
"the",
"data",
"to",
"retrieve",
"the",
"used",
"filters",
"and",
"aggregators"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L514-L525 |
Chill-project/Main | Export/ExportManager.php | ExportManager.retrieveUsedFiltersType | private function retrieveUsedFiltersType($data)
{
$usedTypes = array();
foreach($data as $alias => $filterData) {
if ($filterData['enabled'] == true){
$filter = $this->getFilter($alias);
if (!in_array($filter->applyOn(), $usedTypes)) {
... | php | private function retrieveUsedFiltersType($data)
{
$usedTypes = array();
foreach($data as $alias => $filterData) {
if ($filterData['enabled'] == true){
$filter = $this->getFilter($alias);
if (!in_array($filter->applyOn(), $usedTypes)) {
... | [
"private",
"function",
"retrieveUsedFiltersType",
"(",
"$",
"data",
")",
"{",
"$",
"usedTypes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"alias",
"=>",
"$",
"filterData",
")",
"{",
"if",
"(",
"$",
"filterData",
"[",
"'enable... | Retrieve the filter used in this export.
@param mixed $data the data from the `filters` key of the ExportType
@return array an array with types | [
"Retrieve",
"the",
"filter",
"used",
"in",
"this",
"export",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L533-L546 |
Chill-project/Main | Export/ExportManager.php | ExportManager.handleFilters | private function handleFilters(
ExportInterface $export,
QueryBuilder $qb,
$data,
array $centers)
{
$filters = $this->retrieveUsedFilters($data);
foreach($filters as $alias => $filter) {
if ($this->isGrantedForElement($f... | php | private function handleFilters(
ExportInterface $export,
QueryBuilder $qb,
$data,
array $centers)
{
$filters = $this->retrieveUsedFilters($data);
foreach($filters as $alias => $filter) {
if ($this->isGrantedForElement($f... | [
"private",
"function",
"handleFilters",
"(",
"ExportInterface",
"$",
"export",
",",
"QueryBuilder",
"$",
"qb",
",",
"$",
"data",
",",
"array",
"$",
"centers",
")",
"{",
"$",
"filters",
"=",
"$",
"this",
"->",
"retrieveUsedFilters",
"(",
"$",
"data",
")",
... | alter the query with selected filters.
This function check the acl.
@param ExportInterface $export
@param QueryBuilder $qb
@param mixed $data the data under the initial 'filters' data
@param \Chill\MainBundle\Entity\Center[] $centers the picked centers
@throw UnauthorizedHttpException if the user is not authorized | [
"alter",
"the",
"query",
"with",
"selected",
"filters",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L603-L625 |
Chill-project/Main | Export/ExportManager.php | ExportManager.handleAggregators | private function handleAggregators(
ExportInterface $export,
QueryBuilder $qb,
$data,
array $center)
{
$aggregators = $this->retrieveUsedAggregators($data);
foreach ($aggregators as $alias => $aggregator) {
$formData = $data[$al... | php | private function handleAggregators(
ExportInterface $export,
QueryBuilder $qb,
$data,
array $center)
{
$aggregators = $this->retrieveUsedAggregators($data);
foreach ($aggregators as $alias => $aggregator) {
$formData = $data[$al... | [
"private",
"function",
"handleAggregators",
"(",
"ExportInterface",
"$",
"export",
",",
"QueryBuilder",
"$",
"qb",
",",
"$",
"data",
",",
"array",
"$",
"center",
")",
"{",
"$",
"aggregators",
"=",
"$",
"this",
"->",
"retrieveUsedAggregators",
"(",
"$",
"data... | Alter the query with selected aggregators
Check for acl. If an user is not authorized to see an aggregator, throw an
UnauthorizedException.
@param ExportInterface $export
@param QueryBuilder $qb
@param type $data
@param \Chill\MainBundle\Entity\Center[] $centers the picked centers
@throw UnauthorizedHttpException if ... | [
"Alter",
"the",
"query",
"with",
"selected",
"aggregators"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/ExportManager.php#L639-L651 |
2amigos/yiifoundation | helpers/Nav.php | Nav.side | public static function side($items, $htmlOptions = array())
{
ArrayHelper::addValue('class', Enum::NAV_SIDE, $htmlOptions);
ob_start();
echo \CHtml::openTag('ul', $htmlOptions);
foreach ($items as $item) {
if (is_string($item)) // treat as divider
echo \CHtml... | php | public static function side($items, $htmlOptions = array())
{
ArrayHelper::addValue('class', Enum::NAV_SIDE, $htmlOptions);
ob_start();
echo \CHtml::openTag('ul', $htmlOptions);
foreach ($items as $item) {
if (is_string($item)) // treat as divider
echo \CHtml... | [
"public",
"static",
"function",
"side",
"(",
"$",
"items",
",",
"$",
"htmlOptions",
"=",
"array",
"(",
")",
")",
"{",
"ArrayHelper",
"::",
"addValue",
"(",
"'class'",
",",
"Enum",
"::",
"NAV_SIDE",
",",
"$",
"htmlOptions",
")",
";",
"ob_start",
"(",
")... | Generates a side nav
@param array $items the link items to display as a side nav. The items have the following format:
<pre>
array('label'=>'Item', 'url'=>'#', 'linkOptions'=>array(), 'itemOptions'=>array())
</pre>
@param array $htmlOptions
@return string
@see http://foundation.zurb.com/docs/components/side-nav.html | [
"Generates",
"a",
"side",
"nav"
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Nav.php#L33-L56 |
2amigos/yiifoundation | helpers/Nav.php | Nav.sub | public static function sub($items, $htmlOptions = array())
{
ArrayHelper::addValue('class', Enum::NAV_SUB, $htmlOptions);
ob_start();
echo \CHtml::openTag('dl', $htmlOptions);
foreach ($items as $item) {
$itemOptions = ArrayHelper::getValue($item, 'itemOptions', array());... | php | public static function sub($items, $htmlOptions = array())
{
ArrayHelper::addValue('class', Enum::NAV_SUB, $htmlOptions);
ob_start();
echo \CHtml::openTag('dl', $htmlOptions);
foreach ($items as $item) {
$itemOptions = ArrayHelper::getValue($item, 'itemOptions', array());... | [
"public",
"static",
"function",
"sub",
"(",
"$",
"items",
",",
"$",
"htmlOptions",
"=",
"array",
"(",
")",
")",
"{",
"ArrayHelper",
"::",
"addValue",
"(",
"'class'",
",",
"Enum",
"::",
"NAV_SUB",
",",
"$",
"htmlOptions",
")",
";",
"ob_start",
"(",
")",... | Generates a foundation sub nav
@param array $items the link items to display as a side nav. The items have the following format:
<pre>
array('label'=>'Item', 'url'=>'#', 'linkOptions'=>array(), 'itemOptions'=>array())
</pre>
@param array $htmlOptions
@return string
@see http://foundation.zurb.com/docs/components/sub-n... | [
"Generates",
"a",
"foundation",
"sub",
"nav"
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Nav.php#L69-L86 |
2amigos/yiifoundation | helpers/Nav.php | Nav.dropdown | public static function dropdown($items, $encodeLabels = true)
{
$li = array();
foreach ($items as $item) {
if (is_string($item)) {
$li[] = $item;
continue;
}
if (!isset($item['label'])) {
throw new InvalidConfigExcep... | php | public static function dropdown($items, $encodeLabels = true)
{
$li = array();
foreach ($items as $item) {
if (is_string($item)) {
$li[] = $item;
continue;
}
if (!isset($item['label'])) {
throw new InvalidConfigExcep... | [
"public",
"static",
"function",
"dropdown",
"(",
"$",
"items",
",",
"$",
"encodeLabels",
"=",
"true",
")",
"{",
"$",
"li",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"... | Renders menu items. It differs from [[Dropdown]] widget as it is factorial to render multi-level dropdown menus.
@param array $items the items to render
@param bool $encodeLabels whether to encode link labels or not
@return string the resulting dropdown element.
@throws \foundation\exception\InvalidConfigException | [
"Renders",
"menu",
"items",
".",
"It",
"differs",
"from",
"[[",
"Dropdown",
"]]",
"widget",
"as",
"it",
"is",
"factorial",
"to",
"render",
"multi",
"-",
"level",
"dropdown",
"menus",
"."
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Nav.php#L95-L126 |
JeanWolf/yii2-jrbac | controllers/PermissionController.php | PermissionController.actionIndex | public function actionIndex()
{
$auth = \Yii::$app->getAuthManager();
$items = $auth->getPermissions();
$dataProvider = new ArrayDataProvider();
$dataProvider->setModels($items);
$lockFile = \Yii::getAlias('@runtime/jrbac-permission-init.lock');
if (file_exists($lockF... | php | public function actionIndex()
{
$auth = \Yii::$app->getAuthManager();
$items = $auth->getPermissions();
$dataProvider = new ArrayDataProvider();
$dataProvider->setModels($items);
$lockFile = \Yii::getAlias('@runtime/jrbac-permission-init.lock');
if (file_exists($lockF... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"auth",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getAuthManager",
"(",
")",
";",
"$",
"items",
"=",
"$",
"auth",
"->",
"getPermissions",
"(",
")",
";",
"$",
"dataProvider",
"=",
"new",
"Array... | 查看资源列表 | [
"查看资源列表"
] | train | https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/PermissionController.php#L18-L36 |
JeanWolf/yii2-jrbac | controllers/PermissionController.php | PermissionController.actionCreate | public function actionCreate()
{
$model = new PermissionForm();
$model->isNewRecord = true;
if($model->load(\Yii::$app->getRequest()->post())) {
$model->name = trim($model->name);
if (!$model->name) {
$model->addError('name', '资源标识不可为空');
}... | php | public function actionCreate()
{
$model = new PermissionForm();
$model->isNewRecord = true;
if($model->load(\Yii::$app->getRequest()->post())) {
$model->name = trim($model->name);
if (!$model->name) {
$model->addError('name', '资源标识不可为空');
}... | [
"public",
"function",
"actionCreate",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"PermissionForm",
"(",
")",
";",
"$",
"model",
"->",
"isNewRecord",
"=",
"true",
";",
"if",
"(",
"$",
"model",
"->",
"load",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"g... | 添加权限资源 | [
"添加权限资源"
] | train | https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/PermissionController.php#L39-L67 |
JeanWolf/yii2-jrbac | controllers/PermissionController.php | PermissionController.actionDelete | public function actionDelete($id='')
{
$name = $id;
if (\Yii::$app->getRequest()->getIsPost()) {
$auth = \Yii::$app->getAuthManager();
if($name) {
$item = $auth->getPermission($name);
if($item) $auth->remove($item);
} else {
... | php | public function actionDelete($id='')
{
$name = $id;
if (\Yii::$app->getRequest()->getIsPost()) {
$auth = \Yii::$app->getAuthManager();
if($name) {
$item = $auth->getPermission($name);
if($item) $auth->remove($item);
} else {
... | [
"public",
"function",
"actionDelete",
"(",
"$",
"id",
"=",
"''",
")",
"{",
"$",
"name",
"=",
"$",
"id",
";",
"if",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getIsPost",
"(",
")",
")",
"{",
"$",
"auth",
"=",
"\\",
... | 删除权限资源 | [
"删除权限资源"
] | train | https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/PermissionController.php#L70-L93 |
JeanWolf/yii2-jrbac | controllers/PermissionController.php | PermissionController.actionUpdate | public function actionUpdate($id)
{
$name = $id;
$model = new PermissionForm();
$model->isNewRecord = false;
$auth = \Yii::$app->getAuthManager();
$item = $auth->getPermission($name);
if($model->load(\Yii::$app->getRequest()->post())) {
$model->name = tri... | php | public function actionUpdate($id)
{
$name = $id;
$model = new PermissionForm();
$model->isNewRecord = false;
$auth = \Yii::$app->getAuthManager();
$item = $auth->getPermission($name);
if($model->load(\Yii::$app->getRequest()->post())) {
$model->name = tri... | [
"public",
"function",
"actionUpdate",
"(",
"$",
"id",
")",
"{",
"$",
"name",
"=",
"$",
"id",
";",
"$",
"model",
"=",
"new",
"PermissionForm",
"(",
")",
";",
"$",
"model",
"->",
"isNewRecord",
"=",
"false",
";",
"$",
"auth",
"=",
"\\",
"Yii",
"::",
... | 编辑权限资源 | [
"编辑权限资源"
] | train | https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/PermissionController.php#L96-L128 |
JeanWolf/yii2-jrbac | controllers/PermissionController.php | PermissionController.actionView | public function actionView($id)
{
$name = $id;
$auth = \Yii::$app->getAuthManager();
$item = $auth->getPermission($name);
$subItems = $auth->getChildren($name);
return $this->render('view',[
'item' => $item,
'subItems' => $subItems
]);
} | php | public function actionView($id)
{
$name = $id;
$auth = \Yii::$app->getAuthManager();
$item = $auth->getPermission($name);
$subItems = $auth->getChildren($name);
return $this->render('view',[
'item' => $item,
'subItems' => $subItems
]);
} | [
"public",
"function",
"actionView",
"(",
"$",
"id",
")",
"{",
"$",
"name",
"=",
"$",
"id",
";",
"$",
"auth",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getAuthManager",
"(",
")",
";",
"$",
"item",
"=",
"$",
"auth",
"->",
"getPermission",
"(",
"$"... | 查看权限资源信息 | [
"查看权限资源信息"
] | train | https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/PermissionController.php#L131-L141 |
JeanWolf/yii2-jrbac | controllers/PermissionController.php | PermissionController.actionSubindex | public function actionSubindex($id)
{
$auth = \Yii::$app->getAuthManager();
$permission = $auth->getPermission($id);
$allItems = $auth->getPermissions();
$subItems = $auth->getChildren($id);
$dataProvider = new ArrayDataProvider();
$dataProvider->setModels($allItems);... | php | public function actionSubindex($id)
{
$auth = \Yii::$app->getAuthManager();
$permission = $auth->getPermission($id);
$allItems = $auth->getPermissions();
$subItems = $auth->getChildren($id);
$dataProvider = new ArrayDataProvider();
$dataProvider->setModels($allItems);... | [
"public",
"function",
"actionSubindex",
"(",
"$",
"id",
")",
"{",
"$",
"auth",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getAuthManager",
"(",
")",
";",
"$",
"permission",
"=",
"$",
"auth",
"->",
"getPermission",
"(",
"$",
"id",
")",
";",
"$",
"al... | 子权限列表 | [
"子权限列表"
] | train | https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/PermissionController.php#L144-L158 |
JeanWolf/yii2-jrbac | controllers/PermissionController.php | PermissionController.actionSetsub | public function actionSetsub($name)
{
if (\Yii::$app->getRequest()->getIsPost() && isset($_POST['act'],$_POST['val'])) {
$auth = \Yii::$app->getAuthManager();
$permission = $auth->getPermission($name);
$sub = $auth->getPermission($_POST['val']);
try {
... | php | public function actionSetsub($name)
{
if (\Yii::$app->getRequest()->getIsPost() && isset($_POST['act'],$_POST['val'])) {
$auth = \Yii::$app->getAuthManager();
$permission = $auth->getPermission($name);
$sub = $auth->getPermission($_POST['val']);
try {
... | [
"public",
"function",
"actionSetsub",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getIsPost",
"(",
")",
"&&",
"isset",
"(",
"$",
"_POST",
"[",
"'act'",
"]",
",",
"$",
"_POST",
"[",
"'... | 子权限关联设置 | [
"子权限关联设置"
] | train | https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/PermissionController.php#L161-L182 |
JeanWolf/yii2-jrbac | controllers/PermissionController.php | PermissionController.actionInit | public function actionInit()
{
if (\Yii::$app->getRequest()->getIsPost() && \Yii::$app->getRequest()->getIsAjax()) {
$clearExistPermissions = false;//是否清理现有资源列表
//为true时 会清理以 / 开头的 无有效path匹配的资源
$permissionList = [];
//默认模块控制器权限列表 -- Start
$modu... | php | public function actionInit()
{
if (\Yii::$app->getRequest()->getIsPost() && \Yii::$app->getRequest()->getIsAjax()) {
$clearExistPermissions = false;//是否清理现有资源列表
//为true时 会清理以 / 开头的 无有效path匹配的资源
$permissionList = [];
//默认模块控制器权限列表 -- Start
$modu... | [
"public",
"function",
"actionInit",
"(",
")",
"{",
"if",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getIsPost",
"(",
")",
"&&",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getIsAjax",
"(",
")",
... | 自动扫描并初始化权限资源列表 | [
"自动扫描并初始化权限资源列表"
] | train | https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/PermissionController.php#L186-L268 |
webtown-php/KunstmaanExtensionBundle | src/Form/PageParts/GalleryPagePartAdminType.php | GalleryPagePartAdminType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('folder', 'entity', [
'required' => true,
'label' => 'wt_kuma_extension.gallery.form.folder.label',
'class' => 'KunstmaanMediaBundle:Fo... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('folder', 'entity', [
'required' => true,
'label' => 'wt_kuma_extension.gallery.form.folder.label',
'class' => 'KunstmaanMediaBundle:Fo... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"parent",
"::",
"buildForm",
"(",
"$",
"builder",
",",
"$",
"options",
")",
";",
"$",
"builder",
"->",
"add",
"(",
"'folder'",
",",
"'... | Builds the form.
This method is called for each type in the hierarchy starting form the
top most type. Type extensions can further modify the form.
@param FormBuilderInterface $builder The form builder
@param array $options The options
@see FormTypeExtensionInterface::buildForm() | [
"Builds",
"the",
"form",
"."
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Form/PageParts/GalleryPagePartAdminType.php#L27-L45 |
aedart/laravel-helpers | src/Traits/View/ViewTrait.php | ViewTrait.getView | public function getView(): ?Factory
{
if (!$this->hasView()) {
$this->setView($this->getDefaultView());
}
return $this->view;
} | php | public function getView(): ?Factory
{
if (!$this->hasView()) {
$this->setView($this->getDefaultView());
}
return $this->view;
} | [
"public",
"function",
"getView",
"(",
")",
":",
"?",
"Factory",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasView",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setView",
"(",
"$",
"this",
"->",
"getDefaultView",
"(",
")",
")",
";",
"}",
"return",
"$",... | Get view
If no view has been set, this method will
set and return a default view, if any such
value is available
@see getDefaultView()
@return Factory|null view or null if none view has been set | [
"Get",
"view"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/View/ViewTrait.php#L53-L59 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.boot | public function boot()
{
if (!$this->booted) {
foreach ($this->container->getProviders() as $provider) {
$provider->boot($this);
}
$this->booted = true;
}
} | php | public function boot()
{
if (!$this->booted) {
foreach ($this->container->getProviders() as $provider) {
$provider->boot($this);
}
$this->booted = true;
}
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"booted",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"container",
"->",
"getProviders",
"(",
")",
"as",
"$",
"provider",
")",
"{",
"$",
"provider",
"->",
"boot",
"(",... | Boots of the all providers of the application
@access public
@return void | [
"Boots",
"of",
"the",
"all",
"providers",
"of",
"the",
"application"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L81-L90 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.getAppDir | public function getAppDir()
{
if (null === $this->container->getAppDir()) {
$r = new \ReflectionObject($this);
$this->container->setAppDir(str_replace('\\', '/', dirname($r->getFileName())));
}
return $this->container->getAppDir();
} | php | public function getAppDir()
{
if (null === $this->container->getAppDir()) {
$r = new \ReflectionObject($this);
$this->container->setAppDir(str_replace('\\', '/', dirname($r->getFileName())));
}
return $this->container->getAppDir();
} | [
"public",
"function",
"getAppDir",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"container",
"->",
"getAppDir",
"(",
")",
")",
"{",
"$",
"r",
"=",
"new",
"\\",
"ReflectionObject",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"conta... | Get Application Dir
@return string Application Dir | [
"Get",
"Application",
"Dir"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L139-L147 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.getInstance | public static function getInstance(array $userSettings = array())
{
if (!self::$instance) {
self::$instance = new self($userSettings);
}
return self::$instance;
} | php | public static function getInstance(array $userSettings = array())
{
if (!self::$instance) {
self::$instance = new self($userSettings);
}
return self::$instance;
} | [
"public",
"static",
"function",
"getInstance",
"(",
"array",
"$",
"userSettings",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"instance",
")",
"{",
"self",
"::",
"$",
"instance",
"=",
"new",
"self",
"(",
"$",
"userSettings",
... | Get instance of MVC
@param array $userSettings
@return MVC | [
"Get",
"instance",
"of",
"MVC"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L192-L199 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.initRoutes | final protected function initRoutes()
{
$routes = $this->setRoutes();
foreach ($routes as $currentRoutes) {
foreach ($currentRoutes as $route) {
$this->container->addRoute($route);
}
}
return $this;
} | php | final protected function initRoutes()
{
$routes = $this->setRoutes();
foreach ($routes as $currentRoutes) {
foreach ($currentRoutes as $route) {
$this->container->addRoute($route);
}
}
return $this;
} | [
"final",
"protected",
"function",
"initRoutes",
"(",
")",
"{",
"$",
"routes",
"=",
"$",
"this",
"->",
"setRoutes",
"(",
")",
";",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"currentRoutes",
")",
"{",
"foreach",
"(",
"$",
"currentRoutes",
"as",
"$",
"rou... | Initialize Routes
@return MVC
@throws \LogicException | [
"Initialize",
"Routes"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L307-L317 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.group | public function group()
{
$args = func_get_args();
$route = array_shift($args);
$callable = array_pop($args);
if (is_string($route) && is_callable($callable)) {
call_user_func($callable, $route);
}
} | php | public function group()
{
$args = func_get_args();
$route = array_shift($args);
$callable = array_pop($args);
if (is_string($route) && is_callable($callable)) {
call_user_func($callable, $route);
}
} | [
"public",
"function",
"group",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"route",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"$",
"callable",
"=",
"array_pop",
"(",
"$",
"args",
")",
";",
"if",
"(",
"is_string",
"("... | Add Group routes
@access public
@return void | [
"Add",
"Group",
"routes"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L325-L333 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.ajax | public function ajax($patternUri, $action, $name)
{
$route = new Route("ajax", $patternUri, $action, $name);
$this->container->addRoute($route);
return $route;
} | php | public function ajax($patternUri, $action, $name)
{
$route = new Route("ajax", $patternUri, $action, $name);
$this->container->addRoute($route);
return $route;
} | [
"public",
"function",
"ajax",
"(",
"$",
"patternUri",
",",
"$",
"action",
",",
"$",
"name",
")",
"{",
"$",
"route",
"=",
"new",
"Route",
"(",
"\"ajax\"",
",",
"$",
"patternUri",
",",
"$",
"action",
",",
"$",
"name",
")",
";",
"$",
"this",
"->",
"... | Add AJAX route
@access public
@param string $patternUri
@param string|\callable $action
@paran string $name
@return Route | [
"Add",
"AJAX",
"route"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L344-L349 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.registerProvider | public function registerProvider(Provider $provider)
{
$provider->register($this);
$this->container->addProvider($provider);
return $this;
} | php | public function registerProvider(Provider $provider)
{
$provider->register($this);
$this->container->addProvider($provider);
return $this;
} | [
"public",
"function",
"registerProvider",
"(",
"Provider",
"$",
"provider",
")",
"{",
"$",
"provider",
"->",
"register",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"container",
"->",
"addProvider",
"(",
"$",
"provider",
")",
";",
"return",
"$",
"this... | Register the providers
@access public
@param Provider $provider
@return MVC | [
"Register",
"the",
"providers"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L499-L506 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.setRoutes | public function setRoutes()
{
$routesJsonFile = $this->getAppDir() . '/config/routes.json';
$routesPhpFile = $this->getAppDir() . '/config/routes.php';
$routes = array();
if (file_exists($routesJsonFile)) {
$routes[] = json_decode(file_get_contents($routesJsonFile), true... | php | public function setRoutes()
{
$routesJsonFile = $this->getAppDir() . '/config/routes.json';
$routesPhpFile = $this->getAppDir() . '/config/routes.php';
$routes = array();
if (file_exists($routesJsonFile)) {
$routes[] = json_decode(file_get_contents($routesJsonFile), true... | [
"public",
"function",
"setRoutes",
"(",
")",
"{",
"$",
"routesJsonFile",
"=",
"$",
"this",
"->",
"getAppDir",
"(",
")",
".",
"'/config/routes.json'",
";",
"$",
"routesPhpFile",
"=",
"$",
"this",
"->",
"getAppDir",
"(",
")",
".",
"'/config/routes.php'",
";",
... | Set Routes from JSON|PHP File
@return Route[] | [
"Set",
"Routes",
"from",
"JSON|PHP",
"File"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L547-L567 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.share | public static function share($callable)
{
if (!is_object($callable) || !method_exists($callable, '__invoke')) {
throw new InvalidArgumentException('Callable is not a Closure or invokable object.');
}
return function ($c) use ($callable) {
static $object;
... | php | public static function share($callable)
{
if (!is_object($callable) || !method_exists($callable, '__invoke')) {
throw new InvalidArgumentException('Callable is not a Closure or invokable object.');
}
return function ($c) use ($callable) {
static $object;
... | [
"public",
"static",
"function",
"share",
"(",
"$",
"callable",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"callable",
")",
"||",
"!",
"method_exists",
"(",
"$",
"callable",
",",
"'__invoke'",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",... | Share a clousure object or callback object
@access public
@param $callable
@return callable
@throws InvalidArgumentException | [
"Share",
"a",
"clousure",
"object",
"or",
"callback",
"object"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L577-L592 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.urlFor | public function urlFor($path, $type_name = 'asset', array $params = array())
{
switch ($type_name) {
case 'asset':
return $this->container->getRequest()->getRootUri() . $path;
break;
case 'route':
$routeUrl = $this->container->getReques... | php | public function urlFor($path, $type_name = 'asset', array $params = array())
{
switch ($type_name) {
case 'asset':
return $this->container->getRequest()->getRootUri() . $path;
break;
case 'route':
$routeUrl = $this->container->getReques... | [
"public",
"function",
"urlFor",
"(",
"$",
"path",
",",
"$",
"type_name",
"=",
"'asset'",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"switch",
"(",
"$",
"type_name",
")",
"{",
"case",
"'asset'",
":",
"return",
"$",
"this",
"->",
... | Return the url for the path given
@param string $path Path url path or Route name if type_name is not uri
@param string $type_name Url type uri|route
@param array $params Array params route
@return string | [
"Return",
"the",
"url",
"for",
"the",
"path",
"given"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L620-L631 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.notFound | public function notFound($action = null)
{
$methods = array("get", "post", "put", "delete", "ajax", "options", "head", "mobile");
$route = new Route($methods, '*', $action, 'notFound');
$this->container->addRoute($route);
return $route;
} | php | public function notFound($action = null)
{
$methods = array("get", "post", "put", "delete", "ajax", "options", "head", "mobile");
$route = new Route($methods, '*', $action, 'notFound');
$this->container->addRoute($route);
return $route;
} | [
"public",
"function",
"notFound",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"methods",
"=",
"array",
"(",
"\"get\"",
",",
"\"post\"",
",",
"\"put\"",
",",
"\"delete\"",
",",
"\"ajax\"",
",",
"\"options\"",
",",
"\"head\"",
",",
"\"mobile\"",
")",
"... | Not Found Handler
@access public
@param string|\callable $action Anything that returns true for is_callable()
@return Route | [
"Not",
"Found",
"Handler"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L652-L658 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.data | public function data($json = false)
{
return ($json) ? $this->container->getRequest()->data->JSON : $this->container->getRequest()->data;
} | php | public function data($json = false)
{
return ($json) ? $this->container->getRequest()->data->JSON : $this->container->getRequest()->data;
} | [
"public",
"function",
"data",
"(",
"$",
"json",
"=",
"false",
")",
"{",
"return",
"(",
"$",
"json",
")",
"?",
"$",
"this",
"->",
"container",
"->",
"getRequest",
"(",
")",
"->",
"data",
"->",
"JSON",
":",
"$",
"this",
"->",
"container",
"->",
"getR... | Get the data of request
@access public
@return \stdClass | [
"Get",
"the",
"data",
"of",
"request"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L677-L680 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.render | public function render($template, $data = array(), $status = null)
{
if (!is_null($status) && headers_sent() === false) {
header($this->container->getResponse()->_convert_status($status));
}
$this->container->getView()->display($template, $data);
} | php | public function render($template, $data = array(), $status = null)
{
if (!is_null($status) && headers_sent() === false) {
header($this->container->getResponse()->_convert_status($status));
}
$this->container->getView()->display($template, $data);
} | [
"public",
"function",
"render",
"(",
"$",
"template",
",",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"status",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"status",
")",
"&&",
"headers_sent",
"(",
")",
"===",
"false",
")",
"{... | Render the template
@access public
@param string $template
@param array $data
@param int $status
@return void | [
"Render",
"the",
"template"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L724-L730 |
simple-php-mvc/simple-php-mvc | src/MVC/MVC.php | MVC.run | public function run(HttpRequest $request = null)
{
if (!$this->container->getSetting('debug')) {
error_reporting(0);
} else {
error_reporting(E_ALL);
}
if (!$request) {
$request = $this->container->getRequest();
}
... | php | public function run(HttpRequest $request = null)
{
if (!$this->container->getSetting('debug')) {
error_reporting(0);
} else {
error_reporting(E_ALL);
}
if (!$request) {
$request = $this->container->getRequest();
}
... | [
"public",
"function",
"run",
"(",
"HttpRequest",
"$",
"request",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"getSetting",
"(",
"'debug'",
")",
")",
"{",
"error_reporting",
"(",
"0",
")",
";",
"}",
"else",
"{",
"error... | Run the aplication
@access public
@return void | [
"Run",
"the",
"aplication"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/MVC.php#L738-L809 |
nguyenanhung/nusoap | src/nusoap_client_mime.php | nusoap_client_mime.addAttachment | function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = FALSE)
{
if (!$cid) {
$cid = md5(uniqid(time()));
}
$info['data'] = $data;
$info['filename'] = $filename;
$info['contenttype'] = $contenttype;
... | php | function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = FALSE)
{
if (!$cid) {
$cid = md5(uniqid(time()));
}
$info['data'] = $data;
$info['filename'] = $filename;
$info['contenttype'] = $contenttype;
... | [
"function",
"addAttachment",
"(",
"$",
"data",
",",
"$",
"filename",
"=",
"''",
",",
"$",
"contenttype",
"=",
"'application/octet-stream'",
",",
"$",
"cid",
"=",
"FALSE",
")",
"{",
"if",
"(",
"!",
"$",
"cid",
")",
"{",
"$",
"cid",
"=",
"md5",
"(",
... | adds a MIME attachment to the current request.
If the $data parameter contains an empty string, this method will read
the contents of the file named by the $filename parameter.
If the $cid parameter is false, this method will generate the cid.
@param string $data The data of the attachment
@param string $file... | [
"adds",
"a",
"MIME",
"attachment",
"to",
"the",
"current",
"request",
"."
] | train | https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src/nusoap_client_mime.php#L93-L107 |
nguyenanhung/nusoap | src/nusoap_client_mime.php | nusoap_server_mime.parseRequest | function parseRequest($headers, $data)
{
$this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
$this->requestAttachments = [];
if (strstr($headers['content-type'], 'multipart/related')) {
$this->debug('De... | php | function parseRequest($headers, $data)
{
$this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
$this->requestAttachments = [];
if (strstr($headers['content-type'], 'multipart/related')) {
$this->debug('De... | [
"function",
"parseRequest",
"(",
"$",
"headers",
",",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"debug",
"(",
"'Entering parseRequest() for payload of length '",
".",
"strlen",
"(",
"$",
"data",
")",
".",
"' and type of '",
".",
"$",
"headers",
"[",
"'content-... | processes SOAP message received from client
@param array $headers The HTTP headers
@param string $data unprocessed request data from client
@return mixed value of the message, decoded into a PHP type
@access private | [
"processes",
"SOAP",
"message",
"received",
"from",
"client"
] | train | https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src/nusoap_client_mime.php#L485-L527 |
miisieq/InfaktClient | src/Infakt/Mapper/InvoiceMapper.php | InvoiceMapper.map | public function map($data): Invoice
{
$services = [];
foreach ($data['services'] as $service) {
$services[] = (new Invoice\Service())
->setId((int) $service['id'])
->setName($service['name'])
->setTaxSymbol($service['tax_symbol'])
... | php | public function map($data): Invoice
{
$services = [];
foreach ($data['services'] as $service) {
$services[] = (new Invoice\Service())
->setId((int) $service['id'])
->setName($service['name'])
->setTaxSymbol($service['tax_symbol'])
... | [
"public",
"function",
"map",
"(",
"$",
"data",
")",
":",
"Invoice",
"{",
"$",
"services",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"[",
"'services'",
"]",
"as",
"$",
"service",
")",
"{",
"$",
"services",
"[",
"]",
"=",
"(",
"new",
"Invoic... | Map array to Invoice object.
@param $data
@return Invoice | [
"Map",
"array",
"to",
"Invoice",
"object",
"."
] | train | https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Mapper/InvoiceMapper.php#L22-L86 |
miisieq/InfaktClient | src/Infakt/Mapper/InvoiceMapper.php | InvoiceMapper.reverseMap | public function reverseMap(EntityInterface $entity): array
{
/** @var $entity Invoice */
$services = [];
foreach ($entity->getServices() as $service) {
$services[] = [
'id' => $service->getId(),
'name' => $service->getName(),
'tax_... | php | public function reverseMap(EntityInterface $entity): array
{
/** @var $entity Invoice */
$services = [];
foreach ($entity->getServices() as $service) {
$services[] = [
'id' => $service->getId(),
'name' => $service->getName(),
'tax_... | [
"public",
"function",
"reverseMap",
"(",
"EntityInterface",
"$",
"entity",
")",
":",
"array",
"{",
"/** @var $entity Invoice */",
"$",
"services",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"entity",
"->",
"getServices",
"(",
")",
"as",
"$",
"service",
")",
... | @param EntityInterface $entity
@return array | [
"@param",
"EntityInterface",
"$entity"
] | train | https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Mapper/InvoiceMapper.php#L93-L148 |
spiral-modules/auth | source/Auth/Middlewares/Firewalls/HttpAuthFirewall.php | HttpAuthFirewall.withRealm | public function withRealm(string $realm): self
{
$middleware = clone $this;
$middleware->realm = $realm;
return $middleware;
} | php | public function withRealm(string $realm): self
{
$middleware = clone $this;
$middleware->realm = $realm;
return $middleware;
} | [
"public",
"function",
"withRealm",
"(",
"string",
"$",
"realm",
")",
":",
"self",
"{",
"$",
"middleware",
"=",
"clone",
"$",
"this",
";",
"$",
"middleware",
"->",
"realm",
"=",
"$",
"realm",
";",
"return",
"$",
"middleware",
";",
"}"
] | @param string $realm
@return HttpAuthFirewall | [
"@param",
"string",
"$realm"
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Middlewares/Firewalls/HttpAuthFirewall.php#L35-L41 |
spiral-modules/auth | source/Auth/Middlewares/Firewalls/HttpAuthFirewall.php | HttpAuthFirewall.denyAccess | public function denyAccess(Request $request, Response $response, callable $next)
{
return $response->withStatus(401)->withHeader(
'WWW-Authenticate',
sprintf('Basic realm="%s"', $this->realm)
);
} | php | public function denyAccess(Request $request, Response $response, callable $next)
{
return $response->withStatus(401)->withHeader(
'WWW-Authenticate',
sprintf('Basic realm="%s"', $this->realm)
);
} | [
"public",
"function",
"denyAccess",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"callable",
"$",
"next",
")",
"{",
"return",
"$",
"response",
"->",
"withStatus",
"(",
"401",
")",
"->",
"withHeader",
"(",
"'WWW-Authenticate'",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Middlewares/Firewalls/HttpAuthFirewall.php#L46-L52 |
sparwelt/imgix-lib | src/ImgixServiceFactory.php | ImgixServiceFactory.createFromConfiguration | public static function createFromConfiguration(array $cdnConfiguration, array $filtersConfigurations = [])
{
$cdnSelector = new CdnSelector(...CdnConfigurationParser::parseArray($cdnConfiguration));
$urlGenerator = new ImgixUrlGenerator($cdnSelector);
$attributeGenerator = new AttributeGener... | php | public static function createFromConfiguration(array $cdnConfiguration, array $filtersConfigurations = [])
{
$cdnSelector = new CdnSelector(...CdnConfigurationParser::parseArray($cdnConfiguration));
$urlGenerator = new ImgixUrlGenerator($cdnSelector);
$attributeGenerator = new AttributeGener... | [
"public",
"static",
"function",
"createFromConfiguration",
"(",
"array",
"$",
"cdnConfiguration",
",",
"array",
"$",
"filtersConfigurations",
"=",
"[",
"]",
")",
"{",
"$",
"cdnSelector",
"=",
"new",
"CdnSelector",
"(",
"...",
"CdnConfigurationParser",
"::",
"parse... | @param array $cdnConfiguration
@param array $filtersConfigurations
@return ImgixService | [
"@param",
"array",
"$cdnConfiguration",
"@param",
"array",
"$filtersConfigurations"
] | train | https://github.com/sparwelt/imgix-lib/blob/330e1db2bed71bc283e5a2da6246528f240939ec/src/ImgixServiceFactory.php#L27-L39 |
phpmob/changmin | src/PhpMob/CmsBundle/LocaleLoader/DatabaseLoader.php | DatabaseLoader.load | public function load($resource, $localeCode, $domain = 'messages')
{
$catalogue = new MessageCatalogue($localeCode);
/** @var LocaleInterface $locale */
try {
if (!$locale = $this->localeRepository->findOneBy(['code' => $localeCode])) {
return $catalogue;
... | php | public function load($resource, $localeCode, $domain = 'messages')
{
$catalogue = new MessageCatalogue($localeCode);
/** @var LocaleInterface $locale */
try {
if (!$locale = $this->localeRepository->findOneBy(['code' => $localeCode])) {
return $catalogue;
... | [
"public",
"function",
"load",
"(",
"$",
"resource",
",",
"$",
"localeCode",
",",
"$",
"domain",
"=",
"'messages'",
")",
"{",
"$",
"catalogue",
"=",
"new",
"MessageCatalogue",
"(",
"$",
"localeCode",
")",
";",
"/** @var LocaleInterface $locale */",
"try",
"{",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CmsBundle/LocaleLoader/DatabaseLoader.php#L39-L67 |
rayrutjes/domain-foundation | src/Command/Handler/Registry/InMemoryCommandHandlerRegistry.php | InMemoryCommandHandlerRegistry.findCommandHandlerFor | public function findCommandHandlerFor(Command $command)
{
if (!isset($this->subscriptions[$command->commandName()])) {
throw new CommandHandlerNotFoundException(sprintf('No handler was found for command %s', $command->commandName()));
}
return $this->subscriptions[$command->comm... | php | public function findCommandHandlerFor(Command $command)
{
if (!isset($this->subscriptions[$command->commandName()])) {
throw new CommandHandlerNotFoundException(sprintf('No handler was found for command %s', $command->commandName()));
}
return $this->subscriptions[$command->comm... | [
"public",
"function",
"findCommandHandlerFor",
"(",
"Command",
"$",
"command",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"subscriptions",
"[",
"$",
"command",
"->",
"commandName",
"(",
")",
"]",
")",
")",
"{",
"throw",
"new",
"CommandHan... | @param Command $command
@return CommandHandler
@throws CommandHandlerNotFoundException | [
"@param",
"Command",
"$command"
] | train | https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Command/Handler/Registry/InMemoryCommandHandlerRegistry.php#L22-L29 |
devture/form | src/Devture/Component/Form/Validator/EmailValidator.php | EmailValidator.isValid | static public function isValid($email): bool {
$atIndex = strrpos($email, '@');
if ($atIndex === false) {
return false;
}
$domain = substr($email, $atIndex + 1);
$local = substr($email, 0, $atIndex);
$localLen = strlen($local);
if ($localLen < 1 || $localLen > 64) {
// local part length exceeded
... | php | static public function isValid($email): bool {
$atIndex = strrpos($email, '@');
if ($atIndex === false) {
return false;
}
$domain = substr($email, $atIndex + 1);
$local = substr($email, 0, $atIndex);
$localLen = strlen($local);
if ($localLen < 1 || $localLen > 64) {
// local part length exceeded
... | [
"static",
"public",
"function",
"isValid",
"(",
"$",
"email",
")",
":",
"bool",
"{",
"$",
"atIndex",
"=",
"strrpos",
"(",
"$",
"email",
",",
"'@'",
")",
";",
"if",
"(",
"$",
"atIndex",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"... | Checks whether the specified email looks legit.
It first checks whether the email format is valid, and then uses some DNS checks
to ensure the specified domain has an MX or an A record (both are considered valid).
- May cause slowdown, because of DNS checks
- Will report an email as invalid if the DNS system fails
- Re... | [
"Checks",
"whether",
"the",
"specified",
"email",
"looks",
"legit",
".",
"It",
"first",
"checks",
"whether",
"the",
"email",
"format",
"is",
"valid",
"and",
"then",
"uses",
"some",
"DNS",
"checks",
"to",
"ensure",
"the",
"specified",
"domain",
"has",
"an",
... | train | https://github.com/devture/form/blob/ecdba7a35ce76237965fef96bb4a960b855a7b36/src/Devture/Component/Form/Validator/EmailValidator.php#L17-L91 |
kevintweber/phpunit-markup-validators | src/Kevintweber/PhpunitMarkupValidators/Connector/Connector.php | Connector.execute | public function execute($type)
{
switch (strtolower($type)) {
case 'markup':
$curlOptArray = $this->getMarkupOpts();
break;
case 'file':
$curlOptArray = $this->getFileOpts();
break;
case 'url':
$curlOptArray = $this->getUr... | php | public function execute($type)
{
switch (strtolower($type)) {
case 'markup':
$curlOptArray = $this->getMarkupOpts();
break;
case 'file':
$curlOptArray = $this->getFileOpts();
break;
case 'url':
$curlOptArray = $this->getUr... | [
"public",
"function",
"execute",
"(",
"$",
"type",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"type",
")",
")",
"{",
"case",
"'markup'",
":",
"$",
"curlOptArray",
"=",
"$",
"this",
"->",
"getMarkupOpts",
"(",
")",
";",
"break",
";",
"case",
"'f... | Will execute a cURL request.
@param string $type The type of input.
@return mixed The response from the web service. | [
"Will",
"execute",
"a",
"cURL",
"request",
"."
] | train | https://github.com/kevintweber/phpunit-markup-validators/blob/bee48f48c7c1c9e811d1a4bedeca8f413d049cb3/src/Kevintweber/PhpunitMarkupValidators/Connector/Connector.php#L29-L66 |
kevintweber/phpunit-markup-validators | src/Kevintweber/PhpunitMarkupValidators/Connector/Connector.php | Connector.setUrl | public function setUrl($value)
{
if (filter_var($value, FILTER_VALIDATE_URL) === false) {
throw new \PHPUnit_Framework_Exception("Url is not valid.\n");
}
$this->url = $value;
} | php | public function setUrl($value)
{
if (filter_var($value, FILTER_VALIDATE_URL) === false) {
throw new \PHPUnit_Framework_Exception("Url is not valid.\n");
}
$this->url = $value;
} | [
"public",
"function",
"setUrl",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"value",
",",
"FILTER_VALIDATE_URL",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"PHPUnit_Framework_Exception",
"(",
"\"Url is not valid.\\n\"",
")",
";",
... | Setter for 'url'.
@param string $value The new value of 'url' | [
"Setter",
"for",
"url",
"."
] | train | https://github.com/kevintweber/phpunit-markup-validators/blob/bee48f48c7c1c9e811d1a4bedeca8f413d049cb3/src/Kevintweber/PhpunitMarkupValidators/Connector/Connector.php#L148-L155 |
boekkooi/tactician-amqp | src/Middleware/EnvelopeTransformerMiddleware.php | EnvelopeTransformerMiddleware.execute | public function execute($command, callable $next)
{
if ($command instanceof Command) {
$command = $this->transformer->transformEnvelopeToCommand($command->getEnvelope());
} elseif ($command instanceof \AMQPEnvelope) {
$command = $this->transformer->transformEnvelopeToCommand(... | php | public function execute($command, callable $next)
{
if ($command instanceof Command) {
$command = $this->transformer->transformEnvelopeToCommand($command->getEnvelope());
} elseif ($command instanceof \AMQPEnvelope) {
$command = $this->transformer->transformEnvelopeToCommand(... | [
"public",
"function",
"execute",
"(",
"$",
"command",
",",
"callable",
"$",
"next",
")",
"{",
"if",
"(",
"$",
"command",
"instanceof",
"Command",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"transformer",
"->",
"transformEnvelopeToCommand",
"(",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/boekkooi/tactician-amqp/blob/55cbb8b9e20aab7891e6a6090b248377c599360e/src/Middleware/EnvelopeTransformerMiddleware.php#L29-L38 |
terion-name/package-installer | src/Terion/PackageInstaller/PackageInstallerServiceProvider.php | PackageInstallerServiceProvider.bindInstallCommand | protected function bindInstallCommand()
{
$this->app['package.install'] = $this->app->share(function ($app) {
return $app->make('Terion\PackageInstaller\PackageInstallCommand');
});
$this->app['package.process'] = $this->app->share(function ($app) {
return $app->make(... | php | protected function bindInstallCommand()
{
$this->app['package.install'] = $this->app->share(function ($app) {
return $app->make('Terion\PackageInstaller\PackageInstallCommand');
});
$this->app['package.process'] = $this->app->share(function ($app) {
return $app->make(... | [
"protected",
"function",
"bindInstallCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'package.install'",
"]",
"=",
"$",
"this",
"->",
"app",
"->",
"share",
"(",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"$",
"app",
"->",
"make",
"(",
... | Bind command to IoC | [
"Bind",
"command",
"to",
"IoC"
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallerServiceProvider.php#L67-L75 |
spiral-modules/scaffolder | source/Scaffolder/Declarations/RequestDeclaration.php | RequestDeclaration.declareField | public function declareField(string $field, string $type, string $source, string $origin = null)
{
$schema = $this->constant('SCHEMA')->getValue();
$setters = $this->constant('SETTERS')->getValue();
$validates = $this->constant('VALIDATES')->getValue();
if (!isset($this->mapping[$ty... | php | public function declareField(string $field, string $type, string $source, string $origin = null)
{
$schema = $this->constant('SCHEMA')->getValue();
$setters = $this->constant('SETTERS')->getValue();
$validates = $this->constant('VALIDATES')->getValue();
if (!isset($this->mapping[$ty... | [
"public",
"function",
"declareField",
"(",
"string",
"$",
"field",
",",
"string",
"$",
"type",
",",
"string",
"$",
"source",
",",
"string",
"$",
"origin",
"=",
"null",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"constant",
"(",
"'SCHEMA'",
")",
... | Add new field to request and generate default filters and validations if type presented in
mapping.
@param string $field
@param string $type
@param string $source
@param string $origin | [
"Add",
"new",
"field",
"to",
"request",
"and",
"generate",
"default",
"filters",
"and",
"validations",
"if",
"type",
"presented",
"in",
"mapping",
"."
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Declarations/RequestDeclaration.php#L50-L83 |
spiral-modules/scaffolder | source/Scaffolder/Declarations/RequestDeclaration.php | RequestDeclaration.declareStructure | protected function declareStructure()
{
$this->constant('SCHEMA')->setValue([]);
$this->constant('SETTERS')->setValue([]);
$this->constant('VALIDATES')->setValue([]);
} | php | protected function declareStructure()
{
$this->constant('SCHEMA')->setValue([]);
$this->constant('SETTERS')->setValue([]);
$this->constant('VALIDATES')->setValue([]);
} | [
"protected",
"function",
"declareStructure",
"(",
")",
"{",
"$",
"this",
"->",
"constant",
"(",
"'SCHEMA'",
")",
"->",
"setValue",
"(",
"[",
"]",
")",
";",
"$",
"this",
"->",
"constant",
"(",
"'SETTERS'",
")",
"->",
"setValue",
"(",
"[",
"]",
")",
";... | Declare record entity structure. | [
"Declare",
"record",
"entity",
"structure",
"."
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Declarations/RequestDeclaration.php#L88-L93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.