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 |
|---|---|---|---|---|---|---|---|---|---|---|
heidelpay/PhpDoc | src/phpDocumentor/Descriptor/ConstantDescriptor.php | ConstantDescriptor.getTypes | public function getTypes()
{
if ($this->types === null) {
$this->types = new Collection();
/** @var VarDescriptor $var */
$var = $this->getVar()->get(0);
if ($var) {
$this->types = $var->getTypes();
}
}
return $thi... | php | public function getTypes()
{
if ($this->types === null) {
$this->types = new Collection();
/** @var VarDescriptor $var */
$var = $this->getVar()->get(0);
if ($var) {
$this->types = $var->getTypes();
}
}
return $thi... | [
"public",
"function",
"getTypes",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"types",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"types",
"=",
"new",
"Collection",
"(",
")",
";",
"/** @var VarDescriptor $var */",
"$",
"var",
"=",
"$",
"this",
"->",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/ConstantDescriptor.php#L73-L86 |
kenphp/ken | src/Utils/ArrayDot.php | ArrayDot.get | public function get($key, $defaultValue = null)
{
$keys = explode('.', $key);
$config = $this->_arr;
foreach ($keys as $value) {
if (is_array($config)) {
if (array_key_exists($value, $config)) {
$config = $config[$value];
} els... | php | public function get($key, $defaultValue = null)
{
$keys = explode('.', $key);
$config = $this->_arr;
foreach ($keys as $value) {
if (is_array($config)) {
if (array_key_exists($value, $config)) {
$config = $config[$value];
} els... | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"defaultValue",
"=",
"null",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"_arr",
";",
"foreach",
"(",
"$",
"keys",
... | Gets config value based on key.
To access a sub-array you can use a dot separated key.
For example, given this configuration array :
array(
'basePath' => 'somepath',
'params' => array(
'somekey' => 'value of key'
)
);
To access the value of 'somekey', you can call the method like this :
echo $config->get('params.so... | [
"Gets",
"config",
"value",
"based",
"on",
"key",
"."
] | train | https://github.com/kenphp/ken/blob/c454a86f0ab55c52c88e9bff5bc6fb4e7bd9e0eb/src/Utils/ArrayDot.php#L58-L76 |
kenphp/ken | src/Utils/ArrayDot.php | ArrayDot.set | public function set($key, $value)
{
$keys = explode('.', $key);
$config = &$this->_arr;
foreach ($keys as $val) {
$config = &$config[$val];
}
$config = $value;
} | php | public function set($key, $value)
{
$keys = explode('.', $key);
$config = &$this->_arr;
foreach ($keys as $val) {
$config = &$config[$val];
}
$config = $value;
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"config",
"=",
"&",
"$",
"this",
"->",
"_arr",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"v... | Sets config value based on key.
To set a sub-array configuration, you can use a dot separated key.
For example, given this configuration array :
array(
'basePath' => 'somepath',
'params' => array(
'somekey' => 'value of key'
)
);
To set the value of 'somekey' to 'another value of key', you can call the method like t... | [
"Sets",
"config",
"value",
"based",
"on",
"key",
"."
] | train | https://github.com/kenphp/ken/blob/c454a86f0ab55c52c88e9bff5bc6fb4e7bd9e0eb/src/Utils/ArrayDot.php#L98-L108 |
kenphp/ken | src/Utils/ArrayDot.php | ArrayDot.remove | public function remove($key)
{
$keys = explode('.', $key);
$cKeys = count($keys);
$config = &$this->_arr;
for ($i = 0; $i < $cKeys; ++$i) {
if ($i === ($cKeys - 1)) {
unset($config[$keys[$i]]);
} elseif (is_array($config)) {
... | php | public function remove($key)
{
$keys = explode('.', $key);
$cKeys = count($keys);
$config = &$this->_arr;
for ($i = 0; $i < $cKeys; ++$i) {
if ($i === ($cKeys - 1)) {
unset($config[$keys[$i]]);
} elseif (is_array($config)) {
... | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"cKeys",
"=",
"count",
"(",
"$",
"keys",
")",
";",
"$",
"config",
"=",
"&",
"$",
"this",
"->",
"_arr",
";",
"f... | Removes config value based on key.
To unset a sub-array configuration, you can use a dot separated key.
For example, given this configuration array :
array(
'basePath' => 'somepath',
'params' => array(
'somekey' => 'value of key'
)
);
To unset the value of 'somekey', you can call the method like this :
$config->uns... | [
"Removes",
"config",
"value",
"based",
"on",
"key",
"."
] | train | https://github.com/kenphp/ken/blob/c454a86f0ab55c52c88e9bff5bc6fb4e7bd9e0eb/src/Utils/ArrayDot.php#L129-L146 |
kenphp/ken | src/Utils/ArrayDot.php | ArrayDot.has | public function has($key)
{
$keys = explode('.', $key);
$cKeys = count($keys);
$config = $this->_arr;
for ($i = 0; $i < $cKeys; ++$i) {
if (is_array($config)) {
if (array_key_exists($keys[$i], $config)) {
$config = $config[$keys[$i]];
... | php | public function has($key)
{
$keys = explode('.', $key);
$cKeys = count($keys);
$config = $this->_arr;
for ($i = 0; $i < $cKeys; ++$i) {
if (is_array($config)) {
if (array_key_exists($keys[$i], $config)) {
$config = $config[$keys[$i]];
... | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"cKeys",
"=",
"count",
"(",
"$",
"keys",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"_arr",
";",
"for",
"("... | Checks whether config has a certain key.
@param string $key Dot-separated string of key
@return bool | [
"Checks",
"whether",
"config",
"has",
"a",
"certain",
"key",
"."
] | train | https://github.com/kenphp/ken/blob/c454a86f0ab55c52c88e9bff5bc6fb4e7bd9e0eb/src/Utils/ArrayDot.php#L155-L174 |
nabab/bbn | src/bbn/file/pdf.php | pdf.add_fonts | public function add_fonts(array $fonts){
if ( !\defined('BBN_LIB_PATH') ){
die('You must define BBN_LIB_PATH!');
}
if ( !is_dir(BBN_LIB_PATH . 'mpdf/mpdf/ttfonts/') ){
die("You don't have the mpdf/mpdf/ttfonts directory.");
}
foreach ($fonts as $f => $fs) {
// add to available font... | php | public function add_fonts(array $fonts){
if ( !\defined('BBN_LIB_PATH') ){
die('You must define BBN_LIB_PATH!');
}
if ( !is_dir(BBN_LIB_PATH . 'mpdf/mpdf/ttfonts/') ){
die("You don't have the mpdf/mpdf/ttfonts directory.");
}
foreach ($fonts as $f => $fs) {
// add to available font... | [
"public",
"function",
"add_fonts",
"(",
"array",
"$",
"fonts",
")",
"{",
"if",
"(",
"!",
"\\",
"defined",
"(",
"'BBN_LIB_PATH'",
")",
")",
"{",
"die",
"(",
"'You must define BBN_LIB_PATH!'",
")",
";",
"}",
"if",
"(",
"!",
"is_dir",
"(",
"BBN_LIB_PATH",
"... | Adds custom fonts
$pdf->add_fonts([
'dawningofanewday' => [
'R' => BBN_DATA_PATH.'files/DawningofaNewDay.ttf'
]
]);
@param array $fonts | [
"Adds",
"custom",
"fonts"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/pdf.php#L239-L270 |
cirrusidentity/simplesamlphp-test-utils | src/SanityChecker.php | SanityChecker.confirmAspectMockConfigured | static public function confirmAspectMockConfigured() {
// Ensure mocks are configured for SSP classes
$httpDouble = test::double('SimpleSAML\Utils\HTTP', [
'getAcceptLanguage' => ['some-lang']
]);
if ( ['some-lang'] !== \SimpleSAML\Utils\HTTP::getAcceptLanguage()) {
... | php | static public function confirmAspectMockConfigured() {
// Ensure mocks are configured for SSP classes
$httpDouble = test::double('SimpleSAML\Utils\HTTP', [
'getAcceptLanguage' => ['some-lang']
]);
if ( ['some-lang'] !== \SimpleSAML\Utils\HTTP::getAcceptLanguage()) {
... | [
"static",
"public",
"function",
"confirmAspectMockConfigured",
"(",
")",
"{",
"// Ensure mocks are configured for SSP classes",
"$",
"httpDouble",
"=",
"test",
"::",
"double",
"(",
"'SimpleSAML\\Utils\\HTTP'",
",",
"[",
"'getAcceptLanguage'",
"=>",
"[",
"'some-lang'",
"]"... | Checks that AspectMock is configured and can override HTTP Util methods
@return \AspectMock\Proxy\ClassProxy|\AspectMock\Proxy\InstanceProxy|\AspectMock\Proxy\Verifier
@throws \Exception | [
"Checks",
"that",
"AspectMock",
"is",
"configured",
"and",
"can",
"override",
"HTTP",
"Util",
"methods"
] | train | https://github.com/cirrusidentity/simplesamlphp-test-utils/blob/79150efb8bca89c180b604dc1d6194f819ebe2b2/src/SanityChecker.php#L18-L30 |
php-lug/lug | src/Bundle/LocaleBundle/DependencyInjection/Compiler/RegisterValidationMetadataPass.php | RegisterValidationMetadataPass.process | public function process(ContainerBuilder $container)
{
$driver = $this->getLocaleDriver($container->getDefinition('lug.resource.locale'));
if ($driver === null) {
return;
}
$builder = $container->getDefinition('validator.builder');
$path = realpath(__DIR__.'/../... | php | public function process(ContainerBuilder $container)
{
$driver = $this->getLocaleDriver($container->getDefinition('lug.resource.locale'));
if ($driver === null) {
return;
}
$builder = $container->getDefinition('validator.builder');
$path = realpath(__DIR__.'/../... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"driver",
"=",
"$",
"this",
"->",
"getLocaleDriver",
"(",
"$",
"container",
"->",
"getDefinition",
"(",
"'lug.resource.locale'",
")",
")",
";",
"if",
"(",
"$",
"driver... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/LocaleBundle/DependencyInjection/Compiler/RegisterValidationMetadataPass.php#L27-L43 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Database/src/handlers/mssql.php | ezcDbHandlerMssql.setupConnection | private function setupConnection()
{
$requiredMode = $this->options->quoteIdentifier;
if ( $requiredMode == ezcDbMssqlOptions::QUOTES_GUESS )
{
$result = parent::query( "SELECT sessionproperty('QUOTED_IDENTIFIER')" );
$rows = $result->fetchAll();
$mode = (... | php | private function setupConnection()
{
$requiredMode = $this->options->quoteIdentifier;
if ( $requiredMode == ezcDbMssqlOptions::QUOTES_GUESS )
{
$result = parent::query( "SELECT sessionproperty('QUOTED_IDENTIFIER')" );
$rows = $result->fetchAll();
$mode = (... | [
"private",
"function",
"setupConnection",
"(",
")",
"{",
"$",
"requiredMode",
"=",
"$",
"this",
"->",
"options",
"->",
"quoteIdentifier",
";",
"if",
"(",
"$",
"requiredMode",
"==",
"ezcDbMssqlOptions",
"::",
"QUOTES_GUESS",
")",
"{",
"$",
"result",
"=",
"par... | Sets up opened connection according to options. | [
"Sets",
"up",
"opened",
"connection",
"according",
"to",
"options",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/handlers/mssql.php#L92-L119 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Database/src/handlers/mssql.php | ezcDbHandlerMssql.beginTransaction | public function beginTransaction()
{
$retval = true;
if ( $this->transactionNestingLevel == 0 )
{
$retval = $this->exec( "BEGIN TRANSACTION" );
}
// else NOP
$this->transactionNestingLevel++;
return $retval;
} | php | public function beginTransaction()
{
$retval = true;
if ( $this->transactionNestingLevel == 0 )
{
$retval = $this->exec( "BEGIN TRANSACTION" );
}
// else NOP
$this->transactionNestingLevel++;
return $retval;
} | [
"public",
"function",
"beginTransaction",
"(",
")",
"{",
"$",
"retval",
"=",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"transactionNestingLevel",
"==",
"0",
")",
"{",
"$",
"retval",
"=",
"$",
"this",
"->",
"exec",
"(",
"\"BEGIN TRANSACTION\"",
")",
";",... | Begins a transaction.
This method executes a begin transaction query unless a
transaction has already been started (transaction nesting level > 0 ).
Each call to begin() must have a corresponding commit() or rollback() call.
@see commit()
@see rollback()
@return bool | [
"Begins",
"a",
"transaction",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/handlers/mssql.php#L165-L176 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Database/src/handlers/mssql.php | ezcDbHandlerMssql.commit | public function commit()
{
if ( $this->transactionNestingLevel <= 0 )
{
$this->transactionNestingLevel = 0;
throw new ezcDbTransactionException( "commit() called before beginTransaction()." );
}
$retval = true;
if ( $this->transactionNestingLevel == ... | php | public function commit()
{
if ( $this->transactionNestingLevel <= 0 )
{
$this->transactionNestingLevel = 0;
throw new ezcDbTransactionException( "commit() called before beginTransaction()." );
}
$retval = true;
if ( $this->transactionNestingLevel == ... | [
"public",
"function",
"commit",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"transactionNestingLevel",
"<=",
"0",
")",
"{",
"$",
"this",
"->",
"transactionNestingLevel",
"=",
"0",
";",
"throw",
"new",
"ezcDbTransactionException",
"(",
"\"commit() called before ... | Commits a transaction.
If this this call to commit corresponds to the outermost call to
begin() and all queries within this transaction were successful,
a commit query is executed. If one of the queries
returned with an error, a rollback query is executed instead.
This method returns true if the transaction was succe... | [
"Commits",
"a",
"transaction",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/handlers/mssql.php#L193-L220 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Database/src/handlers/mssql.php | ezcDbHandlerMssql.rollback | public function rollback()
{
if ( $this->transactionNestingLevel <= 0 )
{
$this->transactionNestingLevel = 0;
throw new ezcDbTransactionException( "rollback() called without previous beginTransaction()." );
}
if ( $this->transactionNestingLevel == 1 )
... | php | public function rollback()
{
if ( $this->transactionNestingLevel <= 0 )
{
$this->transactionNestingLevel = 0;
throw new ezcDbTransactionException( "rollback() called without previous beginTransaction()." );
}
if ( $this->transactionNestingLevel == 1 )
... | [
"public",
"function",
"rollback",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"transactionNestingLevel",
"<=",
"0",
")",
"{",
"$",
"this",
"->",
"transactionNestingLevel",
"=",
"0",
";",
"throw",
"new",
"ezcDbTransactionException",
"(",
"\"rollback() called wit... | Rollback a transaction.
If this this call to rollback corresponds to the outermost call to
begin(), a rollback query is executed. If this is an inner transaction
(nesting level > 1) the error flag is set, leaving the rollback to the
outermost transaction.
This method always returns true.
@see begin()
@see commit()
@... | [
"Rollback",
"a",
"transaction",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/handlers/mssql.php#L236-L258 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo/Loader.php | Dwoo_Loader.rebuildClassPathCache | protected function rebuildClassPathCache($path, $cacheFile)
{
if ($cacheFile!==false) {
$tmp = $this->classPath;
$this->classPath = array();
}
// iterates over all files/folders
$list = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*');
if (is_array($list)) {
foreach ($list as $f)... | php | protected function rebuildClassPathCache($path, $cacheFile)
{
if ($cacheFile!==false) {
$tmp = $this->classPath;
$this->classPath = array();
}
// iterates over all files/folders
$list = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*');
if (is_array($list)) {
foreach ($list as $f)... | [
"protected",
"function",
"rebuildClassPathCache",
"(",
"$",
"path",
",",
"$",
"cacheFile",
")",
"{",
"if",
"(",
"$",
"cacheFile",
"!==",
"false",
")",
"{",
"$",
"tmp",
"=",
"$",
"this",
"->",
"classPath",
";",
"$",
"this",
"->",
"classPath",
"=",
"arra... | rebuilds class paths, scans the given directory recursively and saves all paths in the given file
@param string $path the plugin path to scan
@param string $cacheFile the file where to store the plugin paths cache, it will be overwritten | [
"rebuilds",
"class",
"paths",
"scans",
"the",
"given",
"directory",
"recursively",
"and",
"saves",
"all",
"paths",
"in",
"the",
"given",
"file"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo/Loader.php#L66-L92 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo/Loader.php | Dwoo_Loader.loadPlugin | public function loadPlugin($class, $forceRehash = true)
{
// a new class was added or the include failed so we rebuild the cache
if (!isset($this->classPath[$class]) || !(include $this->classPath[$class])) {
if ($forceRehash) {
$this->rebuildClassPathCache($this->corePluginDir, $this->cacheDir . 'classpath.... | php | public function loadPlugin($class, $forceRehash = true)
{
// a new class was added or the include failed so we rebuild the cache
if (!isset($this->classPath[$class]) || !(include $this->classPath[$class])) {
if ($forceRehash) {
$this->rebuildClassPathCache($this->corePluginDir, $this->cacheDir . 'classpath.... | [
"public",
"function",
"loadPlugin",
"(",
"$",
"class",
",",
"$",
"forceRehash",
"=",
"true",
")",
"{",
"// a new class was added or the include failed so we rebuild the cache",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"classPath",
"[",
"$",
"class",
"]",
... | loads a plugin file
@param string $class the plugin name, without the Dwoo_Plugin_ prefix
@param bool $forceRehash if true, the class path caches will be rebuilt if the plugin is not found, in case it has just been added, defaults to true | [
"loads",
"a",
"plugin",
"file"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo/Loader.php#L100-L118 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo/Loader.php | Dwoo_Loader.addDirectory | public function addDirectory($pluginDirectory)
{
$pluginDir = realpath($pluginDirectory);
if (!$pluginDir) {
throw new Dwoo_Exception('Plugin directory does not exist or can not be read : '.$pluginDirectory);
}
$cacheFile = $this->cacheDir . 'classpath-'.substr(strtr($pluginDir, '/\\:'.PATH_SEPARATOR, '----... | php | public function addDirectory($pluginDirectory)
{
$pluginDir = realpath($pluginDirectory);
if (!$pluginDir) {
throw new Dwoo_Exception('Plugin directory does not exist or can not be read : '.$pluginDirectory);
}
$cacheFile = $this->cacheDir . 'classpath-'.substr(strtr($pluginDir, '/\\:'.PATH_SEPARATOR, '----... | [
"public",
"function",
"addDirectory",
"(",
"$",
"pluginDirectory",
")",
"{",
"$",
"pluginDir",
"=",
"realpath",
"(",
"$",
"pluginDirectory",
")",
";",
"if",
"(",
"!",
"$",
"pluginDir",
")",
"{",
"throw",
"new",
"Dwoo_Exception",
"(",
"'Plugin directory does no... | adds a plugin directory, the plugins found in the new plugin directory
will take precedence over the other directories (including the default
dwoo plugin directory), you can use this for example to override plugins
in a specific directory for a specific application while keeping all your
usual plugins in the same place... | [
"adds",
"a",
"plugin",
"directory",
"the",
"plugins",
"found",
"in",
"the",
"new",
"plugin",
"directory",
"will",
"take",
"precedence",
"over",
"the",
"other",
"directories",
"(",
"including",
"the",
"default",
"dwoo",
"plugin",
"directory",
")",
"you",
"can",... | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo/Loader.php#L132-L146 |
eghojansu/moe | src/tools/Crypto.php | Crypto.encrypt | public function encrypt($string)
{
$string = serialize($string);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM);
$key = pack('H*', $this->key);
$mac = hash_hmac('sha256', $string, substr(bin2hex($key), -32));
$passcrypt = ... | php | public function encrypt($string)
{
$string = serialize($string);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM);
$key = pack('H*', $this->key);
$mac = hash_hmac('sha256', $string, substr(bin2hex($key), -32));
$passcrypt = ... | [
"public",
"function",
"encrypt",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"serialize",
"(",
"$",
"string",
")",
";",
"$",
"iv",
"=",
"mcrypt_create_iv",
"(",
"mcrypt_get_iv_size",
"(",
"MCRYPT_RIJNDAEL_256",
",",
"MCRYPT_MODE_CBC",
")",
",",
"MCRYPT... | Encrypt Function | [
"Encrypt",
"Function"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/Crypto.php#L20-L28 |
eghojansu/moe | src/tools/Crypto.php | Crypto.decrypt | public function decrypt($string){
$string = explode('|', $string.'|');
$decoded = base64_decode($string[0]);
$iv = base64_decode($string[1]);
if(strlen($iv)!==mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC))
return false;
$key = pack('H*', $this->key);
... | php | public function decrypt($string){
$string = explode('|', $string.'|');
$decoded = base64_decode($string[0]);
$iv = base64_decode($string[1]);
if(strlen($iv)!==mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC))
return false;
$key = pack('H*', $this->key);
... | [
"public",
"function",
"decrypt",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"explode",
"(",
"'|'",
",",
"$",
"string",
".",
"'|'",
")",
";",
"$",
"decoded",
"=",
"base64_decode",
"(",
"$",
"string",
"[",
"0",
"]",
")",
";",
"$",
"iv",
"=",... | Decrypt Function | [
"Decrypt",
"Function"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/Crypto.php#L31-L45 |
ekuiter/feature-php | FeaturePhp/File/TemplateFile.php | TemplateFile.render | public static function render($source, $rules = array(), $directory = null) {
if (!$directory)
$directory = getcwd();
return self::fromSpecification(
fphp\Specification\TemplateSpecification::fromArrayAndSettings(
array(
"source" => $s... | php | public static function render($source, $rules = array(), $directory = null) {
if (!$directory)
$directory = getcwd();
return self::fromSpecification(
fphp\Specification\TemplateSpecification::fromArrayAndSettings(
array(
"source" => $s... | [
"public",
"static",
"function",
"render",
"(",
"$",
"source",
",",
"$",
"rules",
"=",
"array",
"(",
")",
",",
"$",
"directory",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"directory",
")",
"$",
"directory",
"=",
"getcwd",
"(",
")",
";",
"return",
... | A quick way to directly render a template file with some replacement rules.
@param string $source
@param array[] $rules
@param string $directory
@return string | [
"A",
"quick",
"way",
"to",
"directly",
"render",
"a",
"template",
"file",
"with",
"some",
"replacement",
"rules",
"."
] | train | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/File/TemplateFile.php#L52-L63 |
ekuiter/feature-php | FeaturePhp/File/TemplateFile.php | TemplateFile.extend | public function extend($templateSpecification) {
$rules = $templateSpecification->getRules();
$this->rules = array_merge($this->rules, $rules);
$places = array();
$oldContent = file_get_contents($this->fileSource);
foreach ($rules as $rule) {
$newContent = $rule->app... | php | public function extend($templateSpecification) {
$rules = $templateSpecification->getRules();
$this->rules = array_merge($this->rules, $rules);
$places = array();
$oldContent = file_get_contents($this->fileSource);
foreach ($rules as $rule) {
$newContent = $rule->app... | [
"public",
"function",
"extend",
"(",
"$",
"templateSpecification",
")",
"{",
"$",
"rules",
"=",
"$",
"templateSpecification",
"->",
"getRules",
"(",
")",
";",
"$",
"this",
"->",
"rules",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"rules",
",",
"$",
"rul... | Adds rules to the template file.
This is expected to be called only be a {@see \FeaturePhp\Generator\TemplateGenerator}.
Only uses the rules of the template specification.
@param \FeaturePhp\Specification\TemplateSpecification $templateSpecification
@return \FeaturePhp\Place\Place[] | [
"Adds",
"rules",
"to",
"the",
"template",
"file",
".",
"This",
"is",
"expected",
"to",
"be",
"called",
"only",
"be",
"a",
"{"
] | train | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/File/TemplateFile.php#L72-L93 |
ekuiter/feature-php | FeaturePhp/File/TemplateFile.php | TemplateFile.getContent | public function getContent() {
$content = file_get_contents($this->fileSource);
foreach ($this->rules as $rule)
$content = $rule->apply($content);
return new TextFileContent($content);
} | php | public function getContent() {
$content = file_get_contents($this->fileSource);
foreach ($this->rules as $rule)
$content = $rule->apply($content);
return new TextFileContent($content);
} | [
"public",
"function",
"getContent",
"(",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"this",
"->",
"fileSource",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"as",
"$",
"rule",
")",
"$",
"content",
"=",
"$",
"rule",
"->",
"... | Returns the template file's content.
The content consists of the file content with every rule applied.
@return TextFileContent | [
"Returns",
"the",
"template",
"file",
"s",
"content",
".",
"The",
"content",
"consists",
"of",
"the",
"file",
"content",
"with",
"every",
"rule",
"applied",
"."
] | train | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/File/TemplateFile.php#L100-L105 |
phPoirot/psr7 | Stream.php | Stream.getSize | function getSize()
{
if (!$this->_assertUsable())
return null;
$size = null;
if ($uri = $this->getMetadata('uri'))
## clear the stat cache of stream URI
clearstatcache(true, $uri);
$stats = fstat($this->rHandler);
if (isset($stats['size'... | php | function getSize()
{
if (!$this->_assertUsable())
return null;
$size = null;
if ($uri = $this->getMetadata('uri'))
## clear the stat cache of stream URI
clearstatcache(true, $uri);
$stats = fstat($this->rHandler);
if (isset($stats['size'... | [
"function",
"getSize",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_assertUsable",
"(",
")",
")",
"return",
"null",
";",
"$",
"size",
"=",
"null",
";",
"if",
"(",
"$",
"uri",
"=",
"$",
"this",
"->",
"getMetadata",
"(",
"'uri'",
")",
")",
... | Get the size of the stream if known.
@return int|null Returns the size in bytes if known, or null if unknown. | [
"Get",
"the",
"size",
"of",
"the",
"stream",
"if",
"known",
"."
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/Stream.php#L115-L130 |
phPoirot/psr7 | Stream.php | Stream.tell | function tell()
{
if (!$this->_assertUsable())
throw new \RuntimeException('No resource available; cannot tell position');
if (false === $r = ftell($this->rHandler))
throw new \RuntimeException('Unable to determine stream position');
return $r;
} | php | function tell()
{
if (!$this->_assertUsable())
throw new \RuntimeException('No resource available; cannot tell position');
if (false === $r = ftell($this->rHandler))
throw new \RuntimeException('Unable to determine stream position');
return $r;
} | [
"function",
"tell",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_assertUsable",
"(",
")",
")",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'No resource available; cannot tell position'",
")",
";",
"if",
"(",
"false",
"===",
"$",
"r",
"=",
"ftell... | Returns the current position of the file read/write pointer
@return int Position of the file pointer
@throws \RuntimeException on error. | [
"Returns",
"the",
"current",
"position",
"of",
"the",
"file",
"read",
"/",
"write",
"pointer"
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/Stream.php#L138-L147 |
phPoirot/psr7 | Stream.php | Stream.isSeekable | function isSeekable()
{
if (!$this->_assertUsable())
return false;
if ($this->getMetadata('wrapper_type')) {
// This is a wrapper resource; challenge seekable ...
$pos = $this->tell();
if (-1 === @fseek($this->rHandler, $pos, SEEK_SET))
... | php | function isSeekable()
{
if (!$this->_assertUsable())
return false;
if ($this->getMetadata('wrapper_type')) {
// This is a wrapper resource; challenge seekable ...
$pos = $this->tell();
if (-1 === @fseek($this->rHandler, $pos, SEEK_SET))
... | [
"function",
"isSeekable",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_assertUsable",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"getMetadata",
"(",
"'wrapper_type'",
")",
")",
"{",
"// This is a wrapper resource; challenge s... | Returns whether or not the stream is seekable.
note: StreamWrapper implementations have no control over
the "seekable" property of stream_get_meta_data()
and always advertise themselves as seekable.
@return bool | [
"Returns",
"whether",
"or",
"not",
"the",
"stream",
"is",
"seekable",
"."
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/Stream.php#L168-L181 |
phPoirot/psr7 | Stream.php | Stream.seek | function seek($offset, $whence = SEEK_SET)
{
if (!$this->_assertUsable())
throw new \RuntimeException('No resource available; cannot seek position');
if (-1 === @fseek($this->rHandler, $offset, $whence))
throw new \RuntimeException('Cannot seek on stream');
} | php | function seek($offset, $whence = SEEK_SET)
{
if (!$this->_assertUsable())
throw new \RuntimeException('No resource available; cannot seek position');
if (-1 === @fseek($this->rHandler, $offset, $whence))
throw new \RuntimeException('Cannot seek on stream');
} | [
"function",
"seek",
"(",
"$",
"offset",
",",
"$",
"whence",
"=",
"SEEK_SET",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_assertUsable",
"(",
")",
")",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'No resource available; cannot seek position'",
")",
";"... | Seek to a position in the stream.
@link http://www.php.net/manual/en/function.fseek.php
@param int $offset Stream offset
@param int $whence Specifies how the cursor position will be calculated
based on the seek offset. Valid values are identical to the built-in
PHP $whence values for `fseek()`. SEEK_SET: Set position... | [
"Seek",
"to",
"a",
"position",
"in",
"the",
"stream",
"."
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/Stream.php#L195-L202 |
phPoirot/psr7 | Stream.php | Stream.isWritable | function isWritable()
{
if (!$this->_assertUsable())
return false;
$mode = $this->getMetadata('mode');
return in_array($mode, self::$readWriteHash['write']);
} | php | function isWritable()
{
if (!$this->_assertUsable())
return false;
$mode = $this->getMetadata('mode');
return in_array($mode, self::$readWriteHash['write']);
} | [
"function",
"isWritable",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_assertUsable",
"(",
")",
")",
"return",
"false",
";",
"$",
"mode",
"=",
"$",
"this",
"->",
"getMetadata",
"(",
"'mode'",
")",
";",
"return",
"in_array",
"(",
"$",
"mode",
... | Returns whether or not the stream is writable.
@return bool | [
"Returns",
"whether",
"or",
"not",
"the",
"stream",
"is",
"writable",
"."
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/Stream.php#L225-L232 |
phPoirot/psr7 | Stream.php | Stream.write | function write($string)
{
if (!$this->_assertUsable())
throw new \RuntimeException('No resource available; cannot write');
if (!$this->isWritable())
throw new \RuntimeException('resource is not writable.');
$content = (string) $string;
$result = fwrite($thi... | php | function write($string)
{
if (!$this->_assertUsable())
throw new \RuntimeException('No resource available; cannot write');
if (!$this->isWritable())
throw new \RuntimeException('resource is not writable.');
$content = (string) $string;
$result = fwrite($thi... | [
"function",
"write",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_assertUsable",
"(",
")",
")",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'No resource available; cannot write'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"is... | Write data to the stream.
@param string $string The string that is to be written.
@return int Returns the number of bytes written to the stream.
@throws \RuntimeException on failure. | [
"Write",
"data",
"to",
"the",
"stream",
"."
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/Stream.php#L241-L261 |
phPoirot/psr7 | Stream.php | Stream.read | function read($length)
{
if (!$this->_assertUsable())
throw new \RuntimeException('No resource alive; cannot read.');
if (!$this->isReadable())
throw new \RuntimeException('resource is not readable.');
$data = stream_get_contents($this->rHandler, $length);
... | php | function read($length)
{
if (!$this->_assertUsable())
throw new \RuntimeException('No resource alive; cannot read.');
if (!$this->isReadable())
throw new \RuntimeException('resource is not readable.');
$data = stream_get_contents($this->rHandler, $length);
... | [
"function",
"read",
"(",
"$",
"length",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_assertUsable",
"(",
")",
")",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'No resource alive; cannot read.'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isReada... | Read data from the stream.
@param int $length Read up to $length bytes from the object and return
them. Fewer than $length bytes may be returned if
underlying stream call returns fewer bytes.
@return string Returns the data read from the stream, or an empty string
if no bytes are available.
@throws \RuntimeException ... | [
"Read",
"data",
"from",
"the",
"stream",
"."
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/Stream.php#L288-L301 |
phPoirot/psr7 | Stream.php | Stream.getContents | function getContents()
{
if (!$this->isReadable())
throw new \RuntimeException('Stream is not readable.');
$content = '';
while (!$this->eof()) {
$buf = $this->read(1048576);
// match on '' and false by loose equal
if ($buf == null)
... | php | function getContents()
{
if (!$this->isReadable())
throw new \RuntimeException('Stream is not readable.');
$content = '';
while (!$this->eof()) {
$buf = $this->read(1048576);
// match on '' and false by loose equal
if ($buf == null)
... | [
"function",
"getContents",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isReadable",
"(",
")",
")",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Stream is not readable.'",
")",
";",
"$",
"content",
"=",
"''",
";",
"while",
"(",
"!",
"$",
"thi... | Returns the remaining contents in a string
@return string
@throws \RuntimeException if unable to read or an error occurs while
reading. | [
"Returns",
"the",
"remaining",
"contents",
"in",
"a",
"string"
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/Stream.php#L310-L326 |
phPoirot/psr7 | Stream.php | Stream.getMetadata | function getMetadata($key = null)
{
if (!$this->_assertUsable())
return ($key === null) ? array() : null;
$meta = stream_get_meta_data($this->rHandler);
if ($key === null)
return $meta;
return (array_key_exists($key, $meta)) ? $meta[$key] : null;
} | php | function getMetadata($key = null)
{
if (!$this->_assertUsable())
return ($key === null) ? array() : null;
$meta = stream_get_meta_data($this->rHandler);
if ($key === null)
return $meta;
return (array_key_exists($key, $meta)) ? $meta[$key] : null;
} | [
"function",
"getMetadata",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_assertUsable",
"(",
")",
")",
"return",
"(",
"$",
"key",
"===",
"null",
")",
"?",
"array",
"(",
")",
":",
"null",
";",
"$",
"meta",
"=",
"st... | Get stream metadata as an associative array or retrieve a specific key.
The keys returned are identical to the keys returned from PHP's
stream_get_meta_data() function.
@link http://php.net/manual/en/function.stream-get-meta-data.php
@param string $key Specific metadata to retrieve.
@return array|mixed|null Returns a... | [
"Get",
"stream",
"metadata",
"as",
"an",
"associative",
"array",
"or",
"retrieve",
"a",
"specific",
"key",
"."
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/Stream.php#L340-L352 |
Smile-SA/EzUICronBundle | Controller/CronsController.php | CronsController.listAction | public function listAction()
{
$this->performAccessChecks();
$crons = $this->cronService->getCrons();
return $this->render('SmileEzUICronBundle:cron:tab/crons/list.html.twig', [
'datas' => $crons
]);
} | php | public function listAction()
{
$this->performAccessChecks();
$crons = $this->cronService->getCrons();
return $this->render('SmileEzUICronBundle:cron:tab/crons/list.html.twig', [
'datas' => $crons
]);
} | [
"public",
"function",
"listAction",
"(",
")",
"{",
"$",
"this",
"->",
"performAccessChecks",
"(",
")",
";",
"$",
"crons",
"=",
"$",
"this",
"->",
"cronService",
"->",
"getCrons",
"(",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'SmileEzUICronB... | List crons definition
@return Response | [
"List",
"crons",
"definition"
] | train | https://github.com/Smile-SA/EzUICronBundle/blob/c62fc6a3ab0b39e3f911742d9affe4aade90cf66/Controller/CronsController.php#L44-L53 |
Smile-SA/EzUICronBundle | Controller/CronsController.php | CronsController.editAction | public function editAction(Request $request, $type, $alias)
{
$this->performAccessChecks();
$value = $request->get('value');
$response = new Response();
try {
$this->cronService->updateCron($alias, $type, $value);
$response->setStatusCode(
2... | php | public function editAction(Request $request, $type, $alias)
{
$this->performAccessChecks();
$value = $request->get('value');
$response = new Response();
try {
$this->cronService->updateCron($alias, $type, $value);
$response->setStatusCode(
2... | [
"public",
"function",
"editAction",
"(",
"Request",
"$",
"request",
",",
"$",
"type",
",",
"$",
"alias",
")",
"{",
"$",
"this",
"->",
"performAccessChecks",
"(",
")",
";",
"$",
"value",
"=",
"$",
"request",
"->",
"get",
"(",
"'value'",
")",
";",
"$",... | Edition cron definition
@param Request $request
@param string $type cron property identifier
@param string $alias cron alias identifier
@return Response | [
"Edition",
"cron",
"definition"
] | train | https://github.com/Smile-SA/EzUICronBundle/blob/c62fc6a3ab0b39e3f911742d9affe4aade90cf66/Controller/CronsController.php#L63-L84 |
lyt8384/pingpp-laravel5-plus | src/PingppServiceProvider.php | PingppServiceProvider.register | public function register()
{
$config = config('pingpp');
$this->app->bind('pingpp', function () use ($config) {
Pingpp::setApiKey(
$config['live'] === true
? $config['live_secret_key']
: $config['test_secret_key']
);
... | php | public function register()
{
$config = config('pingpp');
$this->app->bind('pingpp', function () use ($config) {
Pingpp::setApiKey(
$config['live'] === true
? $config['live_secret_key']
: $config['test_secret_key']
);
... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"config",
"=",
"config",
"(",
"'pingpp'",
")",
";",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'pingpp'",
",",
"function",
"(",
")",
"use",
"(",
"$",
"config",
")",
"{",
"Pingpp",
"::",
"setA... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/lyt8384/pingpp-laravel5-plus/blob/6266d764e51cdc13b37e71d184ac257bff8ee5d7/src/PingppServiceProvider.php#L22-L39 |
codezero-be/laravel-localizer | src/Localizer.php | Localizer.detect | public function detect()
{
foreach ($this->detectors as $detector) {
$locales = (array) $this->getInstance($detector)->detect();
foreach ($locales as $locale) {
if ($this->isSupportedLocale($locale)) {
return $locale;
}
... | php | public function detect()
{
foreach ($this->detectors as $detector) {
$locales = (array) $this->getInstance($detector)->detect();
foreach ($locales as $locale) {
if ($this->isSupportedLocale($locale)) {
return $locale;
}
... | [
"public",
"function",
"detect",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"detectors",
"as",
"$",
"detector",
")",
"{",
"$",
"locales",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"getInstance",
"(",
"$",
"detector",
")",
"->",
"detect",
"(",
... | Detect any supported locale and return the first match.
@return string|false | [
"Detect",
"any",
"supported",
"locale",
"and",
"return",
"the",
"first",
"match",
"."
] | train | https://github.com/codezero-be/laravel-localizer/blob/812692796a73bd38fc205404d8ef90df5bfa0d83/src/Localizer.php#L49-L62 |
codezero-be/laravel-localizer | src/Localizer.php | Localizer.store | public function store($locale)
{
foreach ($this->stores as $store) {
$this->getInstance($store)->store($locale);
}
} | php | public function store($locale)
{
foreach ($this->stores as $store) {
$this->getInstance($store)->store($locale);
}
} | [
"public",
"function",
"store",
"(",
"$",
"locale",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"stores",
"as",
"$",
"store",
")",
"{",
"$",
"this",
"->",
"getInstance",
"(",
"$",
"store",
")",
"->",
"store",
"(",
"$",
"locale",
")",
";",
"}",
"}... | Store the given locale.
@param string $locale
@return void | [
"Store",
"the",
"given",
"locale",
"."
] | train | https://github.com/codezero-be/laravel-localizer/blob/812692796a73bd38fc205404d8ef90df5bfa0d83/src/Localizer.php#L71-L76 |
zhouyl/mellivora | Mellivora/Helper/Protobuf/MessageWrapper.php | MessageWrapper.from | public function from($data)
{
if (is_string($data)) {
$this->message->mergeFromString($data);
} elseif (!empty($data)) {
$this->set(Arr::convert($data));
}
return $this;
} | php | public function from($data)
{
if (is_string($data)) {
$this->message->mergeFromString($data);
} elseif (!empty($data)) {
$this->set(Arr::convert($data));
}
return $this;
} | [
"public",
"function",
"from",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"data",
")",
")",
"{",
"$",
"this",
"->",
"message",
"->",
"mergeFromString",
"(",
"$",
"data",
")",
";",
"}",
"elseif",
"(",
"!",
"empty",
"(",
"$",
"dat... | 设定来源数据,可以是序列化之后的字符,也可以是数组数据
@param mixed $data
@return \Mellivora\Helper\Protobuf\MessageWrapper | [
"设定来源数据,可以是序列化之后的字符,也可以是数组数据"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Helper/Protobuf/MessageWrapper.php#L83-L92 |
zhouyl/mellivora | Mellivora/Helper/Protobuf/MessageWrapper.php | MessageWrapper.set | public function set($property, $value = null)
{
if (is_array($property)) {
foreach ($property as $k => $v) {
$this->set($k, $v);
}
return $this;
}
if ($this->has($property)) {
$method = 'set' . Str::studly($property);
... | php | public function set($property, $value = null)
{
if (is_array($property)) {
foreach ($property as $k => $v) {
$this->set($k, $v);
}
return $this;
}
if ($this->has($property)) {
$method = 'set' . Str::studly($property);
... | [
"public",
"function",
"set",
"(",
"$",
"property",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"property",
")",
")",
"{",
"foreach",
"(",
"$",
"property",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"this",
"->... | 为 Message 设定数据
@param mixed $property
@param mixed $data
@param null|mixed $value
@return \Mellivora\Helper\Protobuf\MessageWrapper | [
"为",
"Message",
"设定数据"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Helper/Protobuf/MessageWrapper.php#L123-L141 |
zhouyl/mellivora | Mellivora/Helper/Protobuf/MessageWrapper.php | MessageWrapper.get | public function get($property, $default = null)
{
if ($this->has($property)) {
$method = 'get' . Str::studly($property);
$return = $this->message->{$method}();
return is_null($return) ? $default : $return;
}
return $default;
} | php | public function get($property, $default = null)
{
if ($this->has($property)) {
$method = 'get' . Str::studly($property);
$return = $this->message->{$method}();
return is_null($return) ? $default : $return;
}
return $default;
} | [
"public",
"function",
"get",
"(",
"$",
"property",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"property",
")",
")",
"{",
"$",
"method",
"=",
"'get'",
".",
"Str",
"::",
"studly",
"(",
"$",
"property"... | 从 Message 中获取数据
@param string $property
@param mixed $default
@return mixed | [
"从",
"Message",
"中获取数据"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Helper/Protobuf/MessageWrapper.php#L151-L161 |
zhouyl/mellivora | Mellivora/Helper/Protobuf/MessageWrapper.php | MessageWrapper.has | public function has($key)
{
return $this->ref->hasProperty($key) || $this->ref->hasProperty(Str::snake($key));
} | php | public function has($key)
{
return $this->ref->hasProperty($key) || $this->ref->hasProperty(Str::snake($key));
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"return",
"$",
"this",
"->",
"ref",
"->",
"hasProperty",
"(",
"$",
"key",
")",
"||",
"$",
"this",
"->",
"ref",
"->",
"hasProperty",
"(",
"Str",
"::",
"snake",
"(",
"$",
"key",
")",
")",
";",... | 判断 Message 中是否存在指定的属性
@param string $key
@return bool | [
"判断",
"Message",
"中是否存在指定的属性"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Helper/Protobuf/MessageWrapper.php#L170-L173 |
zhouyl/mellivora | Mellivora/Helper/Protobuf/MessageWrapper.php | MessageWrapper.toArray | public function toArray()
{
$data = [];
foreach ($this->ref->getProperties() as $property) {
$name = $property->getName();
$data[$name] = $this->sanitizeToArrayValue($this->get($name));
}
return $data;
} | php | public function toArray()
{
$data = [];
foreach ($this->ref->getProperties() as $property) {
$name = $property->getName();
$data[$name] = $this->sanitizeToArrayValue($this->get($name));
}
return $data;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"ref",
"->",
"getProperties",
"(",
")",
"as",
"$",
"property",
")",
"{",
"$",
"name",
"=",
"$",
"property",
"->",
"getName",
"(",
... | 将 Message 属性数据转换为 array
@return array | [
"将",
"Message",
"属性数据转换为",
"array"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Helper/Protobuf/MessageWrapper.php#L192-L202 |
zhouyl/mellivora | Mellivora/Helper/Protobuf/MessageWrapper.php | MessageWrapper.getSetterRestrict | protected function getSetterRestrict($method)
{
$namespace = $this->ref->getNamespaceName();
$document = $this->ref->getMethod($method)->getDocComment();
$regex = sprintf(
'~<code>(repeated\s*)?\.?(%s\.[\w\-]+).*<\/code>~',
preg_quote(str_replace('\\', '.', $namespa... | php | protected function getSetterRestrict($method)
{
$namespace = $this->ref->getNamespaceName();
$document = $this->ref->getMethod($method)->getDocComment();
$regex = sprintf(
'~<code>(repeated\s*)?\.?(%s\.[\w\-]+).*<\/code>~',
preg_quote(str_replace('\\', '.', $namespa... | [
"protected",
"function",
"getSetterRestrict",
"(",
"$",
"method",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"ref",
"->",
"getNamespaceName",
"(",
")",
";",
"$",
"document",
"=",
"$",
"this",
"->",
"ref",
"->",
"getMethod",
"(",
"$",
"method",
... | 根据 protobuf 生成的代码,尝试从注释中匹配参数的约束类
例如
<code>.Proto.PayCenter.StatusInfo status_info = 1;</code>
<code>repeated .Proto.PayCenter.PayPaymentItem payment_list = 3;</code>
@param string $method
@return array|false | [
"根据",
"protobuf",
"生成的代码,尝试从注释中匹配参数的约束类"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Helper/Protobuf/MessageWrapper.php#L246-L266 |
zhouyl/mellivora | Mellivora/Helper/Protobuf/MessageWrapper.php | MessageWrapper.sanitizeSetterValue | protected function sanitizeSetterValue($setter, $value)
{
if ($value instanceof self) {
return $value->raw();
}
// 获取 setter 方法的约束条件
if (!(is_array($value) && $restrict = $this->getSetterRestrict($setter))) {
return $value;
}
list($repeated, ... | php | protected function sanitizeSetterValue($setter, $value)
{
if ($value instanceof self) {
return $value->raw();
}
// 获取 setter 方法的约束条件
if (!(is_array($value) && $restrict = $this->getSetterRestrict($setter))) {
return $value;
}
list($repeated, ... | [
"protected",
"function",
"sanitizeSetterValue",
"(",
"$",
"setter",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"self",
")",
"{",
"return",
"$",
"value",
"->",
"raw",
"(",
")",
";",
"}",
"// 获取 setter 方法的约束条件",
"if",
"(",
"!",
"... | 应用于 setter 方法的 value 转换
@param string $setter
@param mixed $value
@return mixed | [
"应用于",
"setter",
"方法的",
"value",
"转换"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Helper/Protobuf/MessageWrapper.php#L276-L307 |
zhouyl/mellivora | Mellivora/Helper/Protobuf/MessageWrapper.php | MessageWrapper.sanitizeToArrayValue | protected function sanitizeToArrayValue($value)
{
if ($value instanceof Message) {
return (new self($value))->toArray();
}
if ($value instanceof RepeatedField) {
$values = [];
foreach ($value as $k => $v) {
$values[] = $this->sanitizeToArr... | php | protected function sanitizeToArrayValue($value)
{
if ($value instanceof Message) {
return (new self($value))->toArray();
}
if ($value instanceof RepeatedField) {
$values = [];
foreach ($value as $k => $v) {
$values[] = $this->sanitizeToArr... | [
"protected",
"function",
"sanitizeToArrayValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"Message",
")",
"{",
"return",
"(",
"new",
"self",
"(",
"$",
"value",
")",
")",
"->",
"toArray",
"(",
")",
";",
"}",
"if",
"(",
"$",
... | 应用于 toArray 方法的 value 转换
@param mixed $value
@return mixed | [
"应用于",
"toArray",
"方法的",
"value",
"转换"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Helper/Protobuf/MessageWrapper.php#L316-L336 |
jakzal/injector | src/Service/Injector.php | Injector.splitOnVisibilityAndMapToClasses | private function splitOnVisibilityAndMapToClasses(array $properties): array
{
return \array_reduce($properties, function (array $tuple, Property $p) {
$tuple[$this->isPrivate($p) ? 0 : 1][] = $p->getClassName();
return $tuple;
}, [[], []]);
} | php | private function splitOnVisibilityAndMapToClasses(array $properties): array
{
return \array_reduce($properties, function (array $tuple, Property $p) {
$tuple[$this->isPrivate($p) ? 0 : 1][] = $p->getClassName();
return $tuple;
}, [[], []]);
} | [
"private",
"function",
"splitOnVisibilityAndMapToClasses",
"(",
"array",
"$",
"properties",
")",
":",
"array",
"{",
"return",
"\\",
"array_reduce",
"(",
"$",
"properties",
",",
"function",
"(",
"array",
"$",
"tuple",
",",
"Property",
"$",
"p",
")",
"{",
"$",... | @param Property[] $properties
@return string[][] tuple of class names with a private (left) or non-private (right) property | [
"@param",
"Property",
"[]",
"$properties"
] | train | https://github.com/jakzal/injector/blob/16ece2d449f6b395e632f498f95865532ec72245/src/Service/Injector.php#L133-L140 |
songshenzong/log | src/DataCollector/AuthCollector.php | AuthCollector.getUserInformation | protected function getUserInformation($user = null)
{
// Defaults
if (is_null($user)) {
return [
'name' => 'Guest',
'user' => ['guest' => true],
];
}
// The default auth identifer is the ID number, which isn't all that
... | php | protected function getUserInformation($user = null)
{
// Defaults
if (is_null($user)) {
return [
'name' => 'Guest',
'user' => ['guest' => true],
];
}
// The default auth identifer is the ID number, which isn't all that
... | [
"protected",
"function",
"getUserInformation",
"(",
"$",
"user",
"=",
"null",
")",
"{",
"// Defaults",
"if",
"(",
"is_null",
"(",
"$",
"user",
")",
")",
"{",
"return",
"[",
"'name'",
"=>",
"'Guest'",
",",
"'user'",
"=>",
"[",
"'guest'",
"=>",
"true",
"... | Get displayed user information
@param \Illuminate\Auth\UserInterface $user
@return array | [
"Get",
"displayed",
"user",
"information"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/DataCollector/AuthCollector.php#L57-L85 |
josh-taylor/migrations-generator | src/Generator.php | Generator.tables | public function tables()
{
$schema = $this->db->connection()
->getDoctrineConnection()
->getSchemaManager();
$tables = $schema->listTableNames();
foreach ($tables as $table) {
$columns = $this->describer->describe($table);
yield compact('tab... | php | public function tables()
{
$schema = $this->db->connection()
->getDoctrineConnection()
->getSchemaManager();
$tables = $schema->listTableNames();
foreach ($tables as $table) {
$columns = $this->describer->describe($table);
yield compact('tab... | [
"public",
"function",
"tables",
"(",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"db",
"->",
"connection",
"(",
")",
"->",
"getDoctrineConnection",
"(",
")",
"->",
"getSchemaManager",
"(",
")",
";",
"$",
"tables",
"=",
"$",
"schema",
"->",
"listTa... | Return a description for each table.
@return \Generator | [
"Return",
"a",
"description",
"for",
"each",
"table",
"."
] | train | https://github.com/josh-taylor/migrations-generator/blob/bb6edc78773d11491881f12265a658bf058cb218/src/Generator.php#L36-L49 |
WellCommerce/StandardEditionBundle | DataFixtures/ORM/LoadOrderStatusGroupData.php | LoadOrderStatusGroupData.load | public function load(ObjectManager $manager)
{
if (!$this->isEnabled()) {
return;
}
foreach (self::$samples as $name) {
$orderStatusGroup = new OrderStatusGroup();
foreach ($this->getLocales() as $locale) {
$orderStatusGroup->trans... | php | public function load(ObjectManager $manager)
{
if (!$this->isEnabled()) {
return;
}
foreach (self::$samples as $name) {
$orderStatusGroup = new OrderStatusGroup();
foreach ($this->getLocales() as $locale) {
$orderStatusGroup->trans... | [
"public",
"function",
"load",
"(",
"ObjectManager",
"$",
"manager",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"self",
"::",
"$",
"samples",
"as",
"$",
"name",
")",
"{",
"$",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/WellCommerce/StandardEditionBundle/blob/6367bd20bbb6bde37c710a6ba87ae72b5f05f61e/DataFixtures/ORM/LoadOrderStatusGroupData.php#L32-L50 |
inhere/php-librarys | src/Utils/LiteLogger.php | LiteLogger.log | public function log($level, $message, array $context = [], array $extra = [])
{
if (!$this->isCanRecord($level)) {
return;
}
if (!$this->name) {
throw new \InvalidArgumentException('Logger name is required.');
}
$levelName = self::getLevelName($level... | php | public function log($level, $message, array $context = [], array $extra = [])
{
if (!$this->isCanRecord($level)) {
return;
}
if (!$this->name) {
throw new \InvalidArgumentException('Logger name is required.');
}
$levelName = self::getLevelName($level... | [
"public",
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"[",
"]",
",",
"array",
"$",
"extra",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isCanRecord",
"(",
"$",
"level",
")",
")"... | record log info to file
@param int $level
@param string $message
@param array $context
@param array $extra
@throws \InvalidArgumentException | [
"record",
"log",
"info",
"to",
"file"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Utils/LiteLogger.php#L290-L324 |
inhere/php-librarys | src/Utils/LiteLogger.php | LiteLogger.flush | public function flush()
{
if ($this->recordSize === 0) {
return;
}
$str = '';
foreach ($this->records as $record) {
$str .= $this->recordFormat($record);
}
$this->clear();
$this->write($str);
} | php | public function flush()
{
if ($this->recordSize === 0) {
return;
}
$str = '';
foreach ($this->records as $record) {
$str .= $this->recordFormat($record);
}
$this->clear();
$this->write($str);
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"recordSize",
"===",
"0",
")",
"{",
"return",
";",
"}",
"$",
"str",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"records",
"as",
"$",
"record",
")",
"{",
"$",
"s... | flush data to file.
@throws \Inhere\Exceptions\FileSystemException | [
"flush",
"data",
"to",
"file",
"."
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Utils/LiteLogger.php#L330-L343 |
inhere/php-librarys | src/Utils/LiteLogger.php | LiteLogger.write | protected function write($str)
{
$file = $this->getLogPath() . $this->getFilename();
$dir = \dirname($file);
if (!Directory::create($dir)) {
throw new FileSystemException("Create log directory failed. $dir");
}
// check file size
if (is_file($file) && fi... | php | protected function write($str)
{
$file = $this->getLogPath() . $this->getFilename();
$dir = \dirname($file);
if (!Directory::create($dir)) {
throw new FileSystemException("Create log directory failed. $dir");
}
// check file size
if (is_file($file) && fi... | [
"protected",
"function",
"write",
"(",
"$",
"str",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getLogPath",
"(",
")",
".",
"$",
"this",
"->",
"getFilename",
"(",
")",
";",
"$",
"dir",
"=",
"\\",
"dirname",
"(",
"$",
"file",
")",
";",
"if",
... | write log info to file
@param string $str
@return bool
@throws \InvalidArgumentException
@throws FileSystemException | [
"write",
"log",
"info",
"to",
"file"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Utils/LiteLogger.php#L384-L400 |
inhere/php-librarys | src/Utils/LiteLogger.php | LiteLogger.getLogPath | public function getLogPath()
{
if (!$this->basePath) {
throw new \InvalidArgumentException('The property basePath is required.');
}
return $this->getBasePath() . '/' . ($this->subFolder ? $this->subFolder . '/' : '');
} | php | public function getLogPath()
{
if (!$this->basePath) {
throw new \InvalidArgumentException('The property basePath is required.');
}
return $this->getBasePath() . '/' . ($this->subFolder ? $this->subFolder . '/' : '');
} | [
"public",
"function",
"getLogPath",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"basePath",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The property basePath is required.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"getBasePath"... | get log path
@return string
@throws \InvalidArgumentException | [
"get",
"log",
"path"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Utils/LiteLogger.php#L449-L456 |
inhere/php-librarys | src/Utils/LiteLogger.php | LiteLogger.getFilename | public function getFilename()
{
if ($handler = $this->filenameHandler) {
return $handler($this);
}
if ($this->splitType === 'hour') {
return $this->name . '.' . date('Ymd_H') . '.log';
}
return $this->name . '.' . date('Ymd') . '.log';
} | php | public function getFilename()
{
if ($handler = $this->filenameHandler) {
return $handler($this);
}
if ($this->splitType === 'hour') {
return $this->name . '.' . date('Ymd_H') . '.log';
}
return $this->name . '.' . date('Ymd') . '.log';
} | [
"public",
"function",
"getFilename",
"(",
")",
"{",
"if",
"(",
"$",
"handler",
"=",
"$",
"this",
"->",
"filenameHandler",
")",
"{",
"return",
"$",
"handler",
"(",
"$",
"this",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"splitType",
"===",
"'hour'",... | 得到日志文件名
@return string | [
"得到日志文件名"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Utils/LiteLogger.php#L474-L485 |
AbuseIO/parser-ipechelon | src/Ipechelon.php | Ipechelon.parse | public function parse()
{
// ACNS: Automated Copyright Notice System
$foundAcnsFile = false;
foreach ($this->parsedMail->getAttachments() as $attachment) {
// Only use the Copyrightcompliance formatted reports, skip all others
if (preg_match(config("{$this->configBas... | php | public function parse()
{
// ACNS: Automated Copyright Notice System
$foundAcnsFile = false;
foreach ($this->parsedMail->getAttachments() as $attachment) {
// Only use the Copyrightcompliance formatted reports, skip all others
if (preg_match(config("{$this->configBas... | [
"public",
"function",
"parse",
"(",
")",
"{",
"// ACNS: Automated Copyright Notice System",
"$",
"foundAcnsFile",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"parsedMail",
"->",
"getAttachments",
"(",
")",
"as",
"$",
"attachment",
")",
"{",
"// Only us... | Parse attachments
@return array Returns array with failed or success data
(See parser-common/src/Parser.php) for more info. | [
"Parse",
"attachments"
] | train | https://github.com/AbuseIO/parser-ipechelon/blob/41154a5aa88f7762db0941edca95363fac9f6886/src/Ipechelon.php#L29-L70 |
AbuseIO/parser-ipechelon | src/Ipechelon.php | Ipechelon.saveIncident | private function saveIncident($report_xml)
{
if (!empty($report_xml) && $report_xml = simplexml_load_string($report_xml)) {
$this->feedName = 'default';
// If feed is known and enabled, validate data and save report
if ($this->isKnownFeed() && $this->isEnabledFeed()) {
... | php | private function saveIncident($report_xml)
{
if (!empty($report_xml) && $report_xml = simplexml_load_string($report_xml)) {
$this->feedName = 'default';
// If feed is known and enabled, validate data and save report
if ($this->isKnownFeed() && $this->isEnabledFeed()) {
... | [
"private",
"function",
"saveIncident",
"(",
"$",
"report_xml",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"report_xml",
")",
"&&",
"$",
"report_xml",
"=",
"simplexml_load_string",
"(",
"$",
"report_xml",
")",
")",
"{",
"$",
"this",
"->",
"feedName",
"=... | Uses the XML to create incidents
@param string $report_xml | [
"Uses",
"the",
"XML",
"to",
"create",
"incidents"
] | train | https://github.com/AbuseIO/parser-ipechelon/blob/41154a5aa88f7762db0941edca95363fac9f6886/src/Ipechelon.php#L77-L104 |
phpgears/dto | src/PayloadBehaviour.php | PayloadBehaviour.setPayload | private function setPayload(array $parameters): void
{
$this->payload = [];
foreach ($parameters as $parameter => $value) {
$this->setPayloadParameter($parameter, $value);
}
} | php | private function setPayload(array $parameters): void
{
$this->payload = [];
foreach ($parameters as $parameter => $value) {
$this->setPayloadParameter($parameter, $value);
}
} | [
"private",
"function",
"setPayload",
"(",
"array",
"$",
"parameters",
")",
":",
"void",
"{",
"$",
"this",
"->",
"payload",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"parameter",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",... | Set payload.
@param array<string, mixed> $parameters | [
"Set",
"payload",
"."
] | train | https://github.com/phpgears/dto/blob/404b2cdea108538b55caa261c29280062dd0e3db/src/PayloadBehaviour.php#L34-L41 |
phpgears/dto | src/PayloadBehaviour.php | PayloadBehaviour.get | final public function get(string $parameter)
{
if (!\array_key_exists($parameter, $this->payload)) {
throw new InvalidParameterException(\sprintf(
'Payload parameter %s on %s does not exist',
$parameter,
static::class
));
}
... | php | final public function get(string $parameter)
{
if (!\array_key_exists($parameter, $this->payload)) {
throw new InvalidParameterException(\sprintf(
'Payload parameter %s on %s does not exist',
$parameter,
static::class
));
}
... | [
"final",
"public",
"function",
"get",
"(",
"string",
"$",
"parameter",
")",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"$",
"parameter",
",",
"$",
"this",
"->",
"payload",
")",
")",
"{",
"throw",
"new",
"InvalidParameterException",
"(",
"\\",
"s... | Get parameter.
@param string $parameter
@throws InvalidParameterException
@return mixed | [
"Get",
"parameter",
"."
] | train | https://github.com/phpgears/dto/blob/404b2cdea108538b55caa261c29280062dd0e3db/src/PayloadBehaviour.php#L75-L93 |
php-lug/lug | src/Bundle/GridBundle/Form/EventSubscriber/Filter/BooleanFilterSubscriber.php | BooleanFilterSubscriber.onPreSubmit | public function onPreSubmit(FormEvent $event)
{
$data = $event->getData();
if (in_array($data, ['true', true, '1', 1, 'yes', 'on'], true)) {
$data = 'true';
} elseif (in_array($data, ['false', false, '0', 0, 'no', 'off'], true)) {
$data = 'false';
}
... | php | public function onPreSubmit(FormEvent $event)
{
$data = $event->getData();
if (in_array($data, ['true', true, '1', 1, 'yes', 'on'], true)) {
$data = 'true';
} elseif (in_array($data, ['false', false, '0', 0, 'no', 'off'], true)) {
$data = 'false';
}
... | [
"public",
"function",
"onPreSubmit",
"(",
"FormEvent",
"$",
"event",
")",
"{",
"$",
"data",
"=",
"$",
"event",
"->",
"getData",
"(",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"data",
",",
"[",
"'true'",
",",
"true",
",",
"'1'",
",",
"1",
",",
"'... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Form/EventSubscriber/Filter/BooleanFilterSubscriber.php#L26-L37 |
j-d/draggy | src/Draggy/Autocode/Templates/CPP/Entity.php | Entity.getAttributeLines | public function getAttributeLines(CPPAttribute $attribute)
{
$lines = [];
if ('object' === $attribute->getType()) {
$lines[] = $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getName() . ';';
} else {
$lines[] = $attribute->getType() . ' ' . $attribute-... | php | public function getAttributeLines(CPPAttribute $attribute)
{
$lines = [];
if ('object' === $attribute->getType()) {
$lines[] = $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getName() . ';';
} else {
$lines[] = $attribute->getType() . ' ' . $attribute-... | [
"public",
"function",
"getAttributeLines",
"(",
"CPPAttribute",
"$",
"attribute",
")",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"if",
"(",
"'object'",
"===",
"$",
"attribute",
"->",
"getType",
"(",
")",
")",
"{",
"$",
"lines",
"[",
"]",
"=",
"$",
"attr... | <editor-fold desc="Attributes"> | [
"<editor",
"-",
"fold",
"desc",
"=",
"Attributes",
">"
] | train | https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Templates/CPP/Entity.php#L84-L95 |
j-d/draggy | src/Draggy/Autocode/Templates/CPP/Entity.php | Entity.getSetterDeclarationLine | public function getSetterDeclarationLine(CPPAttribute $attribute)
{
if ('object' === $attribute->getType()) {
return $this->getEntity()->getProject()->getAutocodeProperty('base')
? $this->getEntity()->getNameBase() . ' ' . $this->getEntity()->getNameBase() . '::' . $attribute->ge... | php | public function getSetterDeclarationLine(CPPAttribute $attribute)
{
if ('object' === $attribute->getType()) {
return $this->getEntity()->getProject()->getAutocodeProperty('base')
? $this->getEntity()->getNameBase() . ' ' . $this->getEntity()->getNameBase() . '::' . $attribute->ge... | [
"public",
"function",
"getSetterDeclarationLine",
"(",
"CPPAttribute",
"$",
"attribute",
")",
"{",
"if",
"(",
"'object'",
"===",
"$",
"attribute",
"->",
"getType",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getEntity",
"(",
")",
"->",
"getProject",
... | <editor-fold desc="Setters"> | [
"<editor",
"-",
"fold",
"desc",
"=",
"Setters",
">"
] | train | https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Templates/CPP/Entity.php#L99-L110 |
j-d/draggy | src/Draggy/Autocode/Templates/CPP/Entity.php | Entity.getGetterCodeLines | public function getGetterCodeLines(CPPAttribute $attribute)
{
$lines = [];
$base = $this->getEntity()->getProject()->getAutocodeProperty('base');
if ('object' === $attribute->getType()) {
$lines[] = $attribute->getStatic()
? $attribute->getEntitySubtype()->getNa... | php | public function getGetterCodeLines(CPPAttribute $attribute)
{
$lines = [];
$base = $this->getEntity()->getProject()->getAutocodeProperty('base');
if ('object' === $attribute->getType()) {
$lines[] = $attribute->getStatic()
? $attribute->getEntitySubtype()->getNa... | [
"public",
"function",
"getGetterCodeLines",
"(",
"CPPAttribute",
"$",
"attribute",
")",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"$",
"base",
"=",
"$",
"this",
"->",
"getEntity",
"(",
")",
"->",
"getProject",
"(",
")",
"->",
"getAutocodeProperty",
"(",
"'b... | <editor-fold desc="Getters"> | [
"<editor",
"-",
"fold",
"desc",
"=",
"Getters",
">"
] | train | https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Templates/CPP/Entity.php#L143-L164 |
shipmile/shipmile-api-php | lib/Shipmile/HttpClient/AuthHandler.php | AuthHandler.getAuthType | public function getAuthType()
{
if (isset($this->auth['username']) && isset($this->auth['password'])) {
return self::HTTP_PASSWORD;
}
if (isset($this->auth['client_id']) && isset($this->auth['client_secret'])) {
return self::URL_SECRET;
}
if (isset(... | php | public function getAuthType()
{
if (isset($this->auth['username']) && isset($this->auth['password'])) {
return self::HTTP_PASSWORD;
}
if (isset($this->auth['client_id']) && isset($this->auth['client_secret'])) {
return self::URL_SECRET;
}
if (isset(... | [
"public",
"function",
"getAuthType",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"auth",
"[",
"'username'",
"]",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"auth",
"[",
"'password'",
"]",
")",
")",
"{",
"return",
"self",
"::",
"HTTP... | Calculating the Authentication Type | [
"Calculating",
"the",
"Authentication",
"Type"
] | train | https://github.com/shipmile/shipmile-api-php/blob/b8272613b3a27f0f27e8722cbee277e41e9dfe59/lib/Shipmile/HttpClient/AuthHandler.php#L27-L43 |
shipmile/shipmile-api-php | lib/Shipmile/HttpClient/AuthHandler.php | AuthHandler.httpPassword | public function httpPassword(Event $event)
{
$event['request']->setHeader('Authorization', sprintf('Basic %s', base64_encode($this->auth['username'] . ':' . $this->auth['password'])));
} | php | public function httpPassword(Event $event)
{
$event['request']->setHeader('Authorization', sprintf('Basic %s', base64_encode($this->auth['username'] . ':' . $this->auth['password'])));
} | [
"public",
"function",
"httpPassword",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"event",
"[",
"'request'",
"]",
"->",
"setHeader",
"(",
"'Authorization'",
",",
"sprintf",
"(",
"'Basic %s'",
",",
"base64_encode",
"(",
"$",
"this",
"->",
"auth",
"[",
"'user... | Basic Authorization with username and password | [
"Basic",
"Authorization",
"with",
"username",
"and",
"password"
] | train | https://github.com/shipmile/shipmile-api-php/blob/b8272613b3a27f0f27e8722cbee277e41e9dfe59/lib/Shipmile/HttpClient/AuthHandler.php#L77-L80 |
shipmile/shipmile-api-php | lib/Shipmile/HttpClient/AuthHandler.php | AuthHandler.urlSecret | public function urlSecret(Event $event)
{
$query = $event['request']->getQuery();
$query->set('client_id', $this->auth['client_id']);
$query->set('client_secret', $this->auth['client_secret']);
} | php | public function urlSecret(Event $event)
{
$query = $event['request']->getQuery();
$query->set('client_id', $this->auth['client_id']);
$query->set('client_secret', $this->auth['client_secret']);
} | [
"public",
"function",
"urlSecret",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"query",
"=",
"$",
"event",
"[",
"'request'",
"]",
"->",
"getQuery",
"(",
")",
";",
"$",
"query",
"->",
"set",
"(",
"'client_id'",
",",
"$",
"this",
"->",
"auth",
"[",
"'... | OAUTH2 Authorization with client secret | [
"OAUTH2",
"Authorization",
"with",
"client",
"secret"
] | train | https://github.com/shipmile/shipmile-api-php/blob/b8272613b3a27f0f27e8722cbee277e41e9dfe59/lib/Shipmile/HttpClient/AuthHandler.php#L85-L91 |
nathan-fiscaletti/extended-arrays | src/ExtendedArrays/AssociativeArray.php | AssociativeArray.offsetSet | public function offsetSet($offset, $value)
{
if (is_null($offset)) {
throw new \Exception('Must supply key to modify arguments in an AssociativeArray.');
} else {
$this->_args[$offset] = $value;
}
} | php | public function offsetSet($offset, $value)
{
if (is_null($offset)) {
throw new \Exception('Must supply key to modify arguments in an AssociativeArray.');
} else {
$this->_args[$offset] = $value;
}
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"offset",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Must supply key to modify arguments in an AssociativeArray.'",
")",
";",
"}",... | Override the offsetSet function to modify
values of the wrapped array. Key is enforced.
@param mixed $offset
@param mixed $value
@return mixed
@throws \Exception | [
"Override",
"the",
"offsetSet",
"function",
"to",
"modify",
"values",
"of",
"the",
"wrapped",
"array",
".",
"Key",
"is",
"enforced",
"."
] | train | https://github.com/nathan-fiscaletti/extended-arrays/blob/a641856115131f76417521d3e4aa2d951158050a/src/ExtendedArrays/AssociativeArray.php#L34-L41 |
DomAndTom/dnt_laravel-swagger-alpha_framework | src/seeds/LaravelSwaggerSeeder.php | LaravelSwaggerSeeder.run | public function run()
{
Eloquent::unguard();
$this->call('DomAndTom\LaravelSwagger\CategoryTableSeeder');
$this->command->info('Laravel Swagger Demo Categories seeded!');
$this->call('DomAndTom\LaravelSwagger\TagTableSeeder');
$this->command->info('Laravel Swagger Demo Tags seeded!');
$this->call('DomAn... | php | public function run()
{
Eloquent::unguard();
$this->call('DomAndTom\LaravelSwagger\CategoryTableSeeder');
$this->command->info('Laravel Swagger Demo Categories seeded!');
$this->call('DomAndTom\LaravelSwagger\TagTableSeeder');
$this->command->info('Laravel Swagger Demo Tags seeded!');
$this->call('DomAn... | [
"public",
"function",
"run",
"(",
")",
"{",
"Eloquent",
"::",
"unguard",
"(",
")",
";",
"$",
"this",
"->",
"call",
"(",
"'DomAndTom\\LaravelSwagger\\CategoryTableSeeder'",
")",
";",
"$",
"this",
"->",
"command",
"->",
"info",
"(",
"'Laravel Swagger Demo Categori... | Run the database seeds.
@return void | [
"Run",
"the",
"database",
"seeds",
"."
] | train | https://github.com/DomAndTom/dnt_laravel-swagger-alpha_framework/blob/489fc5398583682b8372bdadd6631a4cbff6099f/src/seeds/LaravelSwaggerSeeder.php#L17-L29 |
zhouyl/mellivora | Mellivora/Session/SessionServiceProvider.php | SessionServiceProvider.register | public function register()
{
$this->container['session'] = function ($container) {
$handler = null;
if ($config = $container['config']->get('session.saveHandler')) {
if (!$class = $config->handler) {
throw new InvalidArgumentException(
... | php | public function register()
{
$this->container['session'] = function ($container) {
$handler = null;
if ($config = $container['config']->get('session.saveHandler')) {
if (!$class = $config->handler) {
throw new InvalidArgumentException(
... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"container",
"[",
"'session'",
"]",
"=",
"function",
"(",
"$",
"container",
")",
"{",
"$",
"handler",
"=",
"null",
";",
"if",
"(",
"$",
"config",
"=",
"$",
"container",
"[",
"'config... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Session/SessionServiceProvider.php#L16-L41 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/apc/apc_backend.php | ezcCacheApcBackend.store | public function store( $key, $var, $ttl = 0 )
{
$data = new ezcCacheMemoryVarStruct( $key, $var, $ttl );
return apc_store( $key, $data, $ttl );
} | php | public function store( $key, $var, $ttl = 0 )
{
$data = new ezcCacheMemoryVarStruct( $key, $var, $ttl );
return apc_store( $key, $data, $ttl );
} | [
"public",
"function",
"store",
"(",
"$",
"key",
",",
"$",
"var",
",",
"$",
"ttl",
"=",
"0",
")",
"{",
"$",
"data",
"=",
"new",
"ezcCacheMemoryVarStruct",
"(",
"$",
"key",
",",
"$",
"var",
",",
"$",
"ttl",
")",
";",
"return",
"apc_store",
"(",
"$"... | Stores the data $var under the key $key. Returns true or false depending
on the success of the operation.
@param string $key
@param mixed $var
@param int $ttl
@return bool | [
"Stores",
"the",
"data",
"$var",
"under",
"the",
"key",
"$key",
".",
"Returns",
"true",
"or",
"false",
"depending",
"on",
"the",
"success",
"of",
"the",
"operation",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/apc/apc_backend.php#L47-L51 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/apc/apc_backend.php | ezcCacheApcBackend.acquireLock | public function acquireLock( $key, $waitTime, $maxTime )
{
$counter = 0;
// add() does not replace and returns true on success. $maxTime is
// obeyed by Memcache expiry.
while ( apc_add( $key, time(), $maxTime ) === false )
{
// Wait for next check
usl... | php | public function acquireLock( $key, $waitTime, $maxTime )
{
$counter = 0;
// add() does not replace and returns true on success. $maxTime is
// obeyed by Memcache expiry.
while ( apc_add( $key, time(), $maxTime ) === false )
{
// Wait for next check
usl... | [
"public",
"function",
"acquireLock",
"(",
"$",
"key",
",",
"$",
"waitTime",
",",
"$",
"maxTime",
")",
"{",
"$",
"counter",
"=",
"0",
";",
"// add() does not replace and returns true on success. $maxTime is",
"// obeyed by Memcache expiry.",
"while",
"(",
"apc_add",
"(... | Acquires a lock on the given $key.
@param string $key
@param int $waitTime usleep()
@param int $maxTime seconds | [
"Acquires",
"a",
"lock",
"on",
"the",
"given",
"$key",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/apc/apc_backend.php#L99-L116 |
giftcards/Encryption | Command/RotateRangeInStoreCommand.php | RotateRangeInStoreCommand.configure | protected function configure()
{
$this
->addArgument('stores', InputArgument::IS_ARRAY | InputArgument::REQUIRED,
'A list of stores to re-encrypt.')
->addOption(
'new-profile',
null,
InputOption::VALUE_REQUIRED,
... | php | protected function configure()
{
$this
->addArgument('stores', InputArgument::IS_ARRAY | InputArgument::REQUIRED,
'A list of stores to re-encrypt.')
->addOption(
'new-profile',
null,
InputOption::VALUE_REQUIRED,
... | [
"protected",
"function",
"configure",
"(",
")",
"{",
"$",
"this",
"->",
"addArgument",
"(",
"'stores'",
",",
"InputArgument",
"::",
"IS_ARRAY",
"|",
"InputArgument",
"::",
"REQUIRED",
",",
"'A list of stores to re-encrypt.'",
")",
"->",
"addOption",
"(",
"'new-pro... | Configures the current command. | [
"Configures",
"the",
"current",
"command",
"."
] | train | https://github.com/giftcards/Encryption/blob/a48f92408538e2ffe1c8603f168d57803aad7100/Command/RotateRangeInStoreCommand.php#L38-L71 |
nblum/silverstripe-flexible-content | code/ContentPage.php | ContentPage_Controller.Elements | public function Elements()
{
$fcvdo = new \Nblum\FlexibleContent\FlexibleContentVersionedDataObject();
$defaultStage = $fcvdo->getDefaultStage();
if (isset($_GET['stage']) && $defaultStage == $_GET['stage'] && \Permission::check('CMS_ACCESS')) {
$stage = $defaultStage;
} ... | php | public function Elements()
{
$fcvdo = new \Nblum\FlexibleContent\FlexibleContentVersionedDataObject();
$defaultStage = $fcvdo->getDefaultStage();
if (isset($_GET['stage']) && $defaultStage == $_GET['stage'] && \Permission::check('CMS_ACCESS')) {
$stage = $defaultStage;
} ... | [
"public",
"function",
"Elements",
"(",
")",
"{",
"$",
"fcvdo",
"=",
"new",
"\\",
"Nblum",
"\\",
"FlexibleContent",
"\\",
"FlexibleContentVersionedDataObject",
"(",
")",
";",
"$",
"defaultStage",
"=",
"$",
"fcvdo",
"->",
"getDefaultStage",
"(",
")",
";",
"if"... | creates List of all rows with content
@return DataList | [
"creates",
"List",
"of",
"all",
"rows",
"with",
"content"
] | train | https://github.com/nblum/silverstripe-flexible-content/blob/e20a06ee98b7f884965a951653d98af11eb6bc67/code/ContentPage.php#L197-L218 |
inhere/php-librarys | src/Components/Pipeline.php | Pipeline.add | public function add(callable $stage)
{
if ($stage instanceof $this) {
$stage->add(function ($payload) {
return $this->invokeStage($payload);
});
}
$this->stages->attach($stage);
return $this;
} | php | public function add(callable $stage)
{
if ($stage instanceof $this) {
$stage->add(function ($payload) {
return $this->invokeStage($payload);
});
}
$this->stages->attach($stage);
return $this;
} | [
"public",
"function",
"add",
"(",
"callable",
"$",
"stage",
")",
"{",
"if",
"(",
"$",
"stage",
"instanceof",
"$",
"this",
")",
"{",
"$",
"stage",
"->",
"add",
"(",
"function",
"(",
"$",
"payload",
")",
"{",
"return",
"$",
"this",
"->",
"invokeStage",... | {@inheritdoc} | [
"{"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Components/Pipeline.php#L31-L42 |
DevGroup-ru/yii2-measure | src/helpers/MeasureHelper.php | MeasureHelper.convert | public static function convert($value, $to, $from)
{
if ($from instanceof Measure === false || $to instanceof Measure === false) {
throw new Exception('`from` or `to` parameter is not a Measure');
}
if ($from->type !== $to->type) {
throw new Exception('Measures have d... | php | public static function convert($value, $to, $from)
{
if ($from instanceof Measure === false || $to instanceof Measure === false) {
throw new Exception('`from` or `to` parameter is not a Measure');
}
if ($from->type !== $to->type) {
throw new Exception('Measures have d... | [
"public",
"static",
"function",
"convert",
"(",
"$",
"value",
",",
"$",
"to",
",",
"$",
"from",
")",
"{",
"if",
"(",
"$",
"from",
"instanceof",
"Measure",
"===",
"false",
"||",
"$",
"to",
"instanceof",
"Measure",
"===",
"false",
")",
"{",
"throw",
"n... | Convert a value from one measure to another
@param float $value
@param Measure $from
@param Measure $to
@return float
@throws Exception | [
"Convert",
"a",
"value",
"from",
"one",
"measure",
"to",
"another"
] | train | https://github.com/DevGroup-ru/yii2-measure/blob/1d41a4af6ad3f2e34cabc32fa1c97bfd3643269c/src/helpers/MeasureHelper.php#L30-L45 |
DevGroup-ru/yii2-measure | src/helpers/MeasureHelper.php | MeasureHelper.format | public static function format($value, $to, $from = null)
{
if ($to instanceof Measure === false) {
throw new Exception('Unknown object');
}
if ($from instanceof Measure) {
$value = static::convert($value, $to, $from);
}
$formatter = $to->use_custom_for... | php | public static function format($value, $to, $from = null)
{
if ($to instanceof Measure === false) {
throw new Exception('Unknown object');
}
if ($from instanceof Measure) {
$value = static::convert($value, $to, $from);
}
$formatter = $to->use_custom_for... | [
"public",
"static",
"function",
"format",
"(",
"$",
"value",
",",
"$",
"to",
",",
"$",
"from",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"to",
"instanceof",
"Measure",
"===",
"false",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Unknown object'",
")",
... | Format a value by rule as a string
@param double $value
@param Measure $to
@param Measure|null $from
@return string
@throws Exception | [
"Format",
"a",
"value",
"by",
"rule",
"as",
"a",
"string"
] | train | https://github.com/DevGroup-ru/yii2-measure/blob/1d41a4af6ad3f2e34cabc32fa1c97bfd3643269c/src/helpers/MeasureHelper.php#L55-L71 |
DevGroup-ru/yii2-measure | src/helpers/MeasureHelper.php | MeasureHelper.parseString | public static function parseString($source, $matchRules)
{
foreach ((array) $matchRules as $matchRule) {
if (is_callable($matchRule) === true) {
return call_user_func($matchRule, $source);
} else {
if (preg_match($matchRule, $source, $matches) === 1) {... | php | public static function parseString($source, $matchRules)
{
foreach ((array) $matchRules as $matchRule) {
if (is_callable($matchRule) === true) {
return call_user_func($matchRule, $source);
} else {
if (preg_match($matchRule, $source, $matches) === 1) {... | [
"public",
"static",
"function",
"parseString",
"(",
"$",
"source",
",",
"$",
"matchRules",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"matchRules",
"as",
"$",
"matchRule",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"matchRule",
")",
"===",
"t... | Parse string by regexp or closure.
@param string $source
@param \Closure[]|string[]|\Closure|string $matchRules
@return false|float | [
"Parse",
"string",
"by",
"regexp",
"or",
"closure",
"."
] | train | https://github.com/DevGroup-ru/yii2-measure/blob/1d41a4af6ad3f2e34cabc32fa1c97bfd3643269c/src/helpers/MeasureHelper.php#L79-L95 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parts/delivery_status.php | ezcMailDeliveryStatus.generateBody | public function generateBody()
{
$result = $this->addHeadersSection( $this->message ) . ezcMailTools::lineBreak();
for ( $i = 0; $i < count( $this->recipients ); $i++ )
{
$result .= $this->addHeadersSection( $this->recipients[$i] ) . ezcMailTools::lineBreak();
}
r... | php | public function generateBody()
{
$result = $this->addHeadersSection( $this->message ) . ezcMailTools::lineBreak();
for ( $i = 0; $i < count( $this->recipients ); $i++ )
{
$result .= $this->addHeadersSection( $this->recipients[$i] ) . ezcMailTools::lineBreak();
}
r... | [
"public",
"function",
"generateBody",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"addHeadersSection",
"(",
"$",
"this",
"->",
"message",
")",
".",
"ezcMailTools",
"::",
"lineBreak",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
... | Returns the generated text body of this part as a string.
@return string | [
"Returns",
"the",
"generated",
"text",
"body",
"of",
"this",
"part",
"as",
"a",
"string",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parts/delivery_status.php#L139-L147 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parts/delivery_status.php | ezcMailDeliveryStatus.addHeadersSection | private function addHeadersSection( ezcMailHeadersHolder $headers )
{
$result = "";
foreach ( $headers->getCaseSensitiveArray() as $header => $value )
{
$result .= $header . ": " . $value . ezcMailTools::lineBreak();
}
return $result;
} | php | private function addHeadersSection( ezcMailHeadersHolder $headers )
{
$result = "";
foreach ( $headers->getCaseSensitiveArray() as $header => $value )
{
$result .= $header . ": " . $value . ezcMailTools::lineBreak();
}
return $result;
} | [
"private",
"function",
"addHeadersSection",
"(",
"ezcMailHeadersHolder",
"$",
"headers",
")",
"{",
"$",
"result",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"headers",
"->",
"getCaseSensitiveArray",
"(",
")",
"as",
"$",
"header",
"=>",
"$",
"value",
")",
"{",
... | Returns the generated text for a section of the delivery-status part.
@param ezcMailHeadersHolder $headers
@return string | [
"Returns",
"the",
"generated",
"text",
"for",
"a",
"section",
"of",
"the",
"delivery",
"-",
"status",
"part",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parts/delivery_status.php#L155-L163 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parts/delivery_status.php | ezcMailDeliveryStatus.createRecipient | public function createRecipient()
{
$result = count( $this->recipients );
$this->recipients[$result] = new ezcMailHeadersHolder();
return $result;
} | php | public function createRecipient()
{
$result = count( $this->recipients );
$this->recipients[$result] = new ezcMailHeadersHolder();
return $result;
} | [
"public",
"function",
"createRecipient",
"(",
")",
"{",
"$",
"result",
"=",
"count",
"(",
"$",
"this",
"->",
"recipients",
")",
";",
"$",
"this",
"->",
"recipients",
"[",
"$",
"result",
"]",
"=",
"new",
"ezcMailHeadersHolder",
"(",
")",
";",
"return",
... | Adds a new recipient to this delivery-status message and returns the index
of the last added recipient.
@return int | [
"Adds",
"a",
"new",
"recipient",
"to",
"this",
"delivery",
"-",
"status",
"message",
"and",
"returns",
"the",
"index",
"of",
"the",
"last",
"added",
"recipient",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parts/delivery_status.php#L171-L176 |
oroinc/OroLayoutComponent | LayoutRendererRegistry.php | LayoutRendererRegistry.getRenderer | public function getRenderer($name = null)
{
if (!$name) {
$name = $this->defaultRendererName;
}
if (!isset($this->renderers[$name])) {
throw new Exception\LogicException(
sprintf('The layout renderer named "%s" was not found.', $name)
);
... | php | public function getRenderer($name = null)
{
if (!$name) {
$name = $this->defaultRendererName;
}
if (!isset($this->renderers[$name])) {
throw new Exception\LogicException(
sprintf('The layout renderer named "%s" was not found.', $name)
);
... | [
"public",
"function",
"getRenderer",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"defaultRendererName",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"renderers",... | {@inheritdoc} | [
"{"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/LayoutRendererRegistry.php#L18-L30 |
mergado/mergado-api-client-php | src/mergadoclient/OAuth2/AccessToken.php | AccessToken.jsonSerialize | public function jsonSerialize()
{
$parameters = [];
if ($this->accessToken) {
$parameters['access_token'] = $this->accessToken;
}
if ($this->userId) {
$parameters['user_id'] = $this->userId;
}
if ($this->entityId) {
$parameters['... | php | public function jsonSerialize()
{
$parameters = [];
if ($this->accessToken) {
$parameters['access_token'] = $this->accessToken;
}
if ($this->userId) {
$parameters['user_id'] = $this->userId;
}
if ($this->entityId) {
$parameters['... | [
"public",
"function",
"jsonSerialize",
"(",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"accessToken",
")",
"{",
"$",
"parameters",
"[",
"'access_token'",
"]",
"=",
"$",
"this",
"->",
"accessToken",
";",
"}",
"if",
... | Returns an array of parameters to serialize when this is serialized with
json_encode().
@return array | [
"Returns",
"an",
"array",
"of",
"parameters",
"to",
"serialize",
"when",
"this",
"is",
"serialized",
"with",
"json_encode",
"()",
"."
] | train | https://github.com/mergado/mergado-api-client-php/blob/6c13b994a81bf5a3d6f3f791ea1dfbe2c420565f/src/mergadoclient/OAuth2/AccessToken.php#L162-L183 |
lukasz-adamski/teamspeak3-framework | src/TeamSpeak3/Viewer/Text.php | Text.fetchObject | public function fetchObject(Node $node, array $siblings = array())
{
$this->currObj = $node;
$this->currSib = $siblings;
$args = array(
$this->getPrefix(),
$this->getCorpusIcon(),
$this->getCorpusName(),
);
return Str::factory($this->pattern)->arg($args);
} | php | public function fetchObject(Node $node, array $siblings = array())
{
$this->currObj = $node;
$this->currSib = $siblings;
$args = array(
$this->getPrefix(),
$this->getCorpusIcon(),
$this->getCorpusName(),
);
return Str::factory($this->pattern)->arg($args);
} | [
"public",
"function",
"fetchObject",
"(",
"Node",
"$",
"node",
",",
"array",
"$",
"siblings",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"currObj",
"=",
"$",
"node",
";",
"$",
"this",
"->",
"currSib",
"=",
"$",
"siblings",
";",
"$",
"args... | Returns the code needed to display a node in a TeamSpeak 3 viewer.
@param Node $node
@param array $siblings
@return string | [
"Returns",
"the",
"code",
"needed",
"to",
"display",
"a",
"node",
"in",
"a",
"TeamSpeak",
"3",
"viewer",
"."
] | train | https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Viewer/Text.php#L51-L63 |
phapi/cache-nullcache | src/Phapi/Di/Validator/Cache.php | Cache.validate | public function validate($cache)
{
$original = $cache;
// Make sure the cache is configured using a closure
if (is_callable($cache)) {
$failed = false;
try {
$cache = $cache($this->container);
} catch (\Exception $e) {
$fai... | php | public function validate($cache)
{
$original = $cache;
// Make sure the cache is configured using a closure
if (is_callable($cache)) {
$failed = false;
try {
$cache = $cache($this->container);
} catch (\Exception $e) {
$fai... | [
"public",
"function",
"validate",
"(",
"$",
"cache",
")",
"{",
"$",
"original",
"=",
"$",
"cache",
";",
"// Make sure the cache is configured using a closure",
"if",
"(",
"is_callable",
"(",
"$",
"cache",
")",
")",
"{",
"$",
"failed",
"=",
"false",
";",
"try... | Validate a cache to ensure it implements the Cache Contract and that
we are able to connect to the cache backend.
If we are unable to connect to the cache backend an Exception should be
thrown. That Exception will be handled by the validator.
A working cache is NOT a requirement for the application to run so it's
imp... | [
"Validate",
"a",
"cache",
"to",
"ensure",
"it",
"implements",
"the",
"Cache",
"Contract",
"and",
"that",
"we",
"are",
"able",
"to",
"connect",
"to",
"the",
"cache",
"backend",
"."
] | train | https://github.com/phapi/cache-nullcache/blob/89e1c16f2d50b77cd112c27627d6733de32fb5c3/src/Phapi/Di/Validator/Cache.php#L49-L82 |
vaibhavpandeyvpz/sandesh | src/ServerRequestFactory.php | ServerRequestFactory.createServerRequest | public function createServerRequest($method, $uri)
{
if (is_string($uri)) {
$factory = new UriFactory();
$uri = $factory->createUri($uri);
}
return new ServerRequest($method, $uri);
} | php | public function createServerRequest($method, $uri)
{
if (is_string($uri)) {
$factory = new UriFactory();
$uri = $factory->createUri($uri);
}
return new ServerRequest($method, $uri);
} | [
"public",
"function",
"createServerRequest",
"(",
"$",
"method",
",",
"$",
"uri",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"uri",
")",
")",
"{",
"$",
"factory",
"=",
"new",
"UriFactory",
"(",
")",
";",
"$",
"uri",
"=",
"$",
"factory",
"->",
"cre... | {@inheritdoc} | [
"{"
] | train | https://github.com/vaibhavpandeyvpz/sandesh/blob/bea2d06c7cac099ed82da973c922859de4158de0/src/ServerRequestFactory.php#L27-L34 |
vaibhavpandeyvpz/sandesh | src/ServerRequestFactory.php | ServerRequestFactory.createServerRequestFromArray | public function createServerRequestFromArray(array $server)
{
$body = self::getPhpInputStream();
$method = $server['REQUEST_METHOD'];
$protocolVersion = self::getProtocolVersion($server);
$uri = self::getUri($server);
$request = new ServerRequest($method, $uri);
$requ... | php | public function createServerRequestFromArray(array $server)
{
$body = self::getPhpInputStream();
$method = $server['REQUEST_METHOD'];
$protocolVersion = self::getProtocolVersion($server);
$uri = self::getUri($server);
$request = new ServerRequest($method, $uri);
$requ... | [
"public",
"function",
"createServerRequestFromArray",
"(",
"array",
"$",
"server",
")",
"{",
"$",
"body",
"=",
"self",
"::",
"getPhpInputStream",
"(",
")",
";",
"$",
"method",
"=",
"$",
"server",
"[",
"'REQUEST_METHOD'",
"]",
";",
"$",
"protocolVersion",
"="... | {@inheritdoc} | [
"{"
] | train | https://github.com/vaibhavpandeyvpz/sandesh/blob/bea2d06c7cac099ed82da973c922859de4158de0/src/ServerRequestFactory.php#L39-L54 |
old-town/workflow-designer-server | src/View/WorkflowDescriptorApiStrategy.php | WorkflowDescriptorApiStrategy.selectRenderer | public function selectRenderer(ViewEvent $e)
{
$model = $e->getModel();
if (!($model instanceof WorkflowDescriptorApiModel || $model instanceof HalEntity)) {
return null;
}
$this->renderer->setViewEvent($e);
return $this->renderer;
} | php | public function selectRenderer(ViewEvent $e)
{
$model = $e->getModel();
if (!($model instanceof WorkflowDescriptorApiModel || $model instanceof HalEntity)) {
return null;
}
$this->renderer->setViewEvent($e);
return $this->renderer;
} | [
"public",
"function",
"selectRenderer",
"(",
"ViewEvent",
"$",
"e",
")",
"{",
"$",
"model",
"=",
"$",
"e",
"->",
"getModel",
"(",
")",
";",
"if",
"(",
"!",
"(",
"$",
"model",
"instanceof",
"WorkflowDescriptorApiModel",
"||",
"$",
"model",
"instanceof",
"... | Detect if we should use the FeedRenderer based on model type and/or
Accept header
@param ViewEvent $e
@return null|WorkflowDescriptorApiRenderer | [
"Detect",
"if",
"we",
"should",
"use",
"the",
"FeedRenderer",
"based",
"on",
"model",
"type",
"and",
"/",
"or",
"Accept",
"header"
] | train | https://github.com/old-town/workflow-designer-server/blob/6389c5a515861cc8e0b769f1ca7be12c6b78c611/src/View/WorkflowDescriptorApiStrategy.php#L53-L64 |
old-town/workflow-designer-server | src/View/WorkflowDescriptorApiStrategy.php | WorkflowDescriptorApiStrategy.injectResponse | public function injectResponse(ViewEvent $e)
{
$renderer = $e->getRenderer();
if ($renderer !== $this->renderer) {
return;
}
$result = $e->getResult();
/** @var HttpResponse $response */
$response = $e->getResponse();
$response->setContent($re... | php | public function injectResponse(ViewEvent $e)
{
$renderer = $e->getRenderer();
if ($renderer !== $this->renderer) {
return;
}
$result = $e->getResult();
/** @var HttpResponse $response */
$response = $e->getResponse();
$response->setContent($re... | [
"public",
"function",
"injectResponse",
"(",
"ViewEvent",
"$",
"e",
")",
"{",
"$",
"renderer",
"=",
"$",
"e",
"->",
"getRenderer",
"(",
")",
";",
"if",
"(",
"$",
"renderer",
"!==",
"$",
"this",
"->",
"renderer",
")",
"{",
"return",
";",
"}",
"$",
"... | Inject the response with the feed payload and appropriate Content-Type header
@param ViewEvent $e
@return void
@throws \Zend\Http\Exception\InvalidArgumentException | [
"Inject",
"the",
"response",
"with",
"the",
"feed",
"payload",
"and",
"appropriate",
"Content",
"-",
"Type",
"header"
] | train | https://github.com/old-town/workflow-designer-server/blob/6389c5a515861cc8e0b769f1ca7be12c6b78c611/src/View/WorkflowDescriptorApiStrategy.php#L73-L89 |
gn36/phpbb-oo-posting-api | src/Gn36/OoPostingApi/posting_base.php | posting_base.submit_post | protected function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true, $update_search_index = true)
{
global $db, $user, $config, $auth, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher;
/**
* Modify the data for post submitting
*
* @event ... | php | protected function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true, $update_search_index = true)
{
global $db, $user, $config, $auth, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher;
/**
* Modify the data for post submitting
*
* @event ... | [
"protected",
"function",
"submit_post",
"(",
"$",
"mode",
",",
"$",
"subject",
",",
"$",
"username",
",",
"$",
"topic_type",
",",
"&",
"$",
"poll",
",",
"&",
"$",
"data",
",",
"$",
"update_message",
"=",
"true",
",",
"$",
"update_search_index",
"=",
"t... | This is currently a modified copy of the phpBB function so it allows posting as a different user and ignores some permissions. | [
"This",
"is",
"currently",
"a",
"modified",
"copy",
"of",
"the",
"phpBB",
"function",
"so",
"it",
"allows",
"posting",
"as",
"a",
"different",
"user",
"and",
"ignores",
"some",
"permissions",
"."
] | train | https://github.com/gn36/phpbb-oo-posting-api/blob/d0e19482a9e1e93a435c1758a66df9324145381a/src/Gn36/OoPostingApi/posting_base.php#L13-L981 |
php-lug/lug | src/Component/Grid/Sort/Type/SortType.php | SortType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setRequired(['builder', 'grid', 'sort'])
->setAllowedTypes('builder', DataSourceBuilderInterface::class)
->setAllowedTypes('grid', GridInterface::class)
->setAllowedTypes('sort', SortInt... | php | public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setRequired(['builder', 'grid', 'sort'])
->setAllowedTypes('builder', DataSourceBuilderInterface::class)
->setAllowedTypes('grid', GridInterface::class)
->setAllowedTypes('sort', SortInt... | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"resolver",
"->",
"setRequired",
"(",
"[",
"'builder'",
",",
"'grid'",
",",
"'sort'",
"]",
")",
"->",
"setAllowedTypes",
"(",
"'builder'",
",",
"DataSourceBuilderIn... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Sort/Type/SortType.php#L40-L47 |
Daursu/xero | src/Daursu/Xero/models/Invoice.php | Invoice.getPdf | public function getPdf($id = '')
{
$id = $id ? : $this->attributes[$this->primary_column];
return $this->request('GET', sprintf('%s/%s', $this->getUrl(), $id), array(), "", "pdf");
} | php | public function getPdf($id = '')
{
$id = $id ? : $this->attributes[$this->primary_column];
return $this->request('GET', sprintf('%s/%s', $this->getUrl(), $id), array(), "", "pdf");
} | [
"public",
"function",
"getPdf",
"(",
"$",
"id",
"=",
"''",
")",
"{",
"$",
"id",
"=",
"$",
"id",
"?",
":",
"$",
"this",
"->",
"attributes",
"[",
"$",
"this",
"->",
"primary_column",
"]",
";",
"return",
"$",
"this",
"->",
"request",
"(",
"'GET'",
"... | Retrieves a PDF file of an invoice
@return mixed | [
"Retrieves",
"a",
"PDF",
"file",
"of",
"an",
"invoice"
] | train | https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/Invoice.php#L17-L21 |
canis-io/yii2-broadcaster | lib/models/BroadcastSubscription.php | BroadcastSubscription.prepareConfig | public function prepareConfig($event)
{
if (empty($this->batch_type)) {
$this->batch_type = null;
}
if (isset($this->_configObject)) {
if (!$this->configObject->validate()) {
$this->addError('config', 'Invalid configuration');
$event->i... | php | public function prepareConfig($event)
{
if (empty($this->batch_type)) {
$this->batch_type = null;
}
if (isset($this->_configObject)) {
if (!$this->configObject->validate()) {
$this->addError('config', 'Invalid configuration');
$event->i... | [
"public",
"function",
"prepareConfig",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"batch_type",
")",
")",
"{",
"$",
"this",
"->",
"batch_type",
"=",
"null",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_confi... | [[@doctodo method_description:serializeAction]]. | [
"[["
] | train | https://github.com/canis-io/yii2-broadcaster/blob/b8d7b5b24f2d8f4fdb29132dd85df34602dcd6b1/lib/models/BroadcastSubscription.php#L63-L87 |
canis-io/yii2-broadcaster | lib/models/BroadcastSubscription.php | BroadcastSubscription.getConfigObject | public function getConfigObject()
{
if (!isset($this->_configObject) && !empty($this->config)) {
$configSettings = json_decode($this->config, true);
if (isset($configSettings['class'])) {
$this->_configObject = Yii::createObject($configSettings);
$this... | php | public function getConfigObject()
{
if (!isset($this->_configObject) && !empty($this->config)) {
$configSettings = json_decode($this->config, true);
if (isset($configSettings['class'])) {
$this->_configObject = Yii::createObject($configSettings);
$this... | [
"public",
"function",
"getConfigObject",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_configObject",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"config",
")",
")",
"{",
"$",
"configSettings",
"=",
"json_decode",
"(",
"$",
"... | Get action object.
@return [[@doctodo return_type:getActionObject]] [[@doctodo return_description:getActionObject]] | [
"Get",
"action",
"object",
"."
] | train | https://github.com/canis-io/yii2-broadcaster/blob/b8d7b5b24f2d8f4fdb29132dd85df34602dcd6b1/lib/models/BroadcastSubscription.php#L119-L130 |
ekuiter/feature-php | FeaturePhp/Aspect/AspectKernel.php | AspectKernel.generateFiles | public function generateFiles($class, $target) {
$files = array();
$includes = "";
$registers = "";
foreach ($this->aspects as $aspect) {
$files[] = $aspect->getStoredFile();
$includes .= "require_once __DIR__ . '/" . str_replace("'", "\'", $aspect->getRe... | php | public function generateFiles($class, $target) {
$files = array();
$includes = "";
$registers = "";
foreach ($this->aspects as $aspect) {
$files[] = $aspect->getStoredFile();
$includes .= "require_once __DIR__ . '/" . str_replace("'", "\'", $aspect->getRe... | [
"public",
"function",
"generateFiles",
"(",
"$",
"class",
",",
"$",
"target",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"$",
"includes",
"=",
"\"\"",
";",
"$",
"registers",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"aspects",
... | Generates the aspect kernel's files.
This includes all aspect files and the aspect kernel itself.
@param string $class
@param string $target | [
"Generates",
"the",
"aspect",
"kernel",
"s",
"files",
".",
"This",
"includes",
"all",
"aspect",
"files",
"and",
"the",
"aspect",
"kernel",
"itself",
"."
] | train | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Aspect/AspectKernel.php#L44-L69 |
NuclearCMS/Hierarchy | src/Builders/ModelBuilder.php | ModelBuilder.build | public function build($name, Collection $fields = null)
{
$path = $this->getClassFilePath($name);
$tableName = source_table_name($name);
$contents = view('_hierarchy::entities.model', [
'tableName' => $tableName,
'name' => $this->getClassName($name... | php | public function build($name, Collection $fields = null)
{
$path = $this->getClassFilePath($name);
$tableName = source_table_name($name);
$contents = view('_hierarchy::entities.model', [
'tableName' => $tableName,
'name' => $this->getClassName($name... | [
"public",
"function",
"build",
"(",
"$",
"name",
",",
"Collection",
"$",
"fields",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getClassFilePath",
"(",
"$",
"name",
")",
";",
"$",
"tableName",
"=",
"source_table_name",
"(",
"$",
"name",... | Builds a source model
@param string $name
@param Collection $fields | [
"Builds",
"a",
"source",
"model"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Builders/ModelBuilder.php#L20-L34 |
NuclearCMS/Hierarchy | src/Builders/ModelBuilder.php | ModelBuilder.makeFields | protected function makeFields(Collection $fields = null)
{
if (is_null($fields))
{
return '';
}
$fields = $fields->pluck('name')->toArray();
return count($fields) ? "'" . implode("', '", $fields) . "'" : '';
} | php | protected function makeFields(Collection $fields = null)
{
if (is_null($fields))
{
return '';
}
$fields = $fields->pluck('name')->toArray();
return count($fields) ? "'" . implode("', '", $fields) . "'" : '';
} | [
"protected",
"function",
"makeFields",
"(",
"Collection",
"$",
"fields",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"fields",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"fields",
"=",
"$",
"fields",
"->",
"pluck",
"(",
"'name'",
")",
... | Makes fields
@param Collection $fields
@return string | [
"Makes",
"fields"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Builders/ModelBuilder.php#L42-L52 |
NuclearCMS/Hierarchy | src/Builders/ModelBuilder.php | ModelBuilder.makeSearchableFields | protected function makeSearchableFields(Collection $fields = null, $tableName)
{
if (is_null($fields))
{
return '';
}
$searchables = [];
foreach ($fields as $field)
{
if (intval($field->search_priority) > 0)
{
$sea... | php | protected function makeSearchableFields(Collection $fields = null, $tableName)
{
if (is_null($fields))
{
return '';
}
$searchables = [];
foreach ($fields as $field)
{
if (intval($field->search_priority) > 0)
{
$sea... | [
"protected",
"function",
"makeSearchableFields",
"(",
"Collection",
"$",
"fields",
"=",
"null",
",",
"$",
"tableName",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"fields",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"searchables",
"=",
"[",
"]",
";",
... | Makes searchable fields
@param Collection $fields
@param string $tableName
@return string | [
"Makes",
"searchable",
"fields"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Builders/ModelBuilder.php#L61-L79 |
NuclearCMS/Hierarchy | src/Builders/ModelBuilder.php | ModelBuilder.makeMutatableFields | protected function makeMutatableFields(Collection $fields = null)
{
if (is_null($fields))
{
return '';
}
$mutatables = [];
foreach ($fields as $field)
{
if (in_array($field->type, ['document', 'gallery', 'markdown', 'node', 'node_collection']... | php | protected function makeMutatableFields(Collection $fields = null)
{
if (is_null($fields))
{
return '';
}
$mutatables = [];
foreach ($fields as $field)
{
if (in_array($field->type, ['document', 'gallery', 'markdown', 'node', 'node_collection']... | [
"protected",
"function",
"makeMutatableFields",
"(",
"Collection",
"$",
"fields",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"fields",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"mutatables",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"f... | Makes mutatable fields
@param Collection $fields
@return string | [
"Makes",
"mutatable",
"fields"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Builders/ModelBuilder.php#L87-L105 |
expectation-php/expect | src/matcher/TruthyMatcher.php | TruthyMatcher.match | public function match($actual)
{
$this->actual = $actual;
if (is_bool($this->actual)) {
return $this->actual !== false;
}
return isset($this->actual);
} | php | public function match($actual)
{
$this->actual = $actual;
if (is_bool($this->actual)) {
return $this->actual !== false;
}
return isset($this->actual);
} | [
"public",
"function",
"match",
"(",
"$",
"actual",
")",
"{",
"$",
"this",
"->",
"actual",
"=",
"$",
"actual",
";",
"if",
"(",
"is_bool",
"(",
"$",
"this",
"->",
"actual",
")",
")",
"{",
"return",
"$",
"this",
"->",
"actual",
"!==",
"false",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/matcher/TruthyMatcher.php#L28-L37 |
tttptd/laravel-responder | src/Traits/RespondsWithJson.php | RespondsWithJson.errorResponse | public function errorResponse(string $errorCode = null, int $statusCode = null, $message = null):JsonResponse
{
return app(Responder::class)->error($errorCode, $statusCode, $message);
} | php | public function errorResponse(string $errorCode = null, int $statusCode = null, $message = null):JsonResponse
{
return app(Responder::class)->error($errorCode, $statusCode, $message);
} | [
"public",
"function",
"errorResponse",
"(",
"string",
"$",
"errorCode",
"=",
"null",
",",
"int",
"$",
"statusCode",
"=",
"null",
",",
"$",
"message",
"=",
"null",
")",
":",
"JsonResponse",
"{",
"return",
"app",
"(",
"Responder",
"::",
"class",
")",
"->",... | Generate an error JSON response.
@param string|null $errorCode
@param int|null $statusCode
@param mixed $message
@return JsonResponse | [
"Generate",
"an",
"error",
"JSON",
"response",
"."
] | train | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Traits/RespondsWithJson.php#L27-L30 |
tttptd/laravel-responder | src/Traits/RespondsWithJson.php | RespondsWithJson.successResponse | public function successResponse($data = null, $statusCode = null, array $meta = []):JsonResponse
{
return app(Responder::class)->success($data, $statusCode, $meta);
} | php | public function successResponse($data = null, $statusCode = null, array $meta = []):JsonResponse
{
return app(Responder::class)->success($data, $statusCode, $meta);
} | [
"public",
"function",
"successResponse",
"(",
"$",
"data",
"=",
"null",
",",
"$",
"statusCode",
"=",
"null",
",",
"array",
"$",
"meta",
"=",
"[",
"]",
")",
":",
"JsonResponse",
"{",
"return",
"app",
"(",
"Responder",
"::",
"class",
")",
"->",
"success"... | Generate a successful JSON response.
@param mixed|null $data
@param int|null $statusCode
@param array $meta
@return \Illuminate\Http\JsonResponse | [
"Generate",
"a",
"successful",
"JSON",
"response",
"."
] | train | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Traits/RespondsWithJson.php#L40-L43 |
tttptd/laravel-responder | src/Traits/RespondsWithJson.php | RespondsWithJson.transform | public function transform($data = null, $transformer = null):SuccessResponseBuilder
{
return app(Responder::class)->transform($data, $transformer);
} | php | public function transform($data = null, $transformer = null):SuccessResponseBuilder
{
return app(Responder::class)->transform($data, $transformer);
} | [
"public",
"function",
"transform",
"(",
"$",
"data",
"=",
"null",
",",
"$",
"transformer",
"=",
"null",
")",
":",
"SuccessResponseBuilder",
"{",
"return",
"app",
"(",
"Responder",
"::",
"class",
")",
"->",
"transform",
"(",
"$",
"data",
",",
"$",
"transf... | Transform the data and return a success response builder.
@param mixed|null $data
@param callable|string|null $transformer
@return \Flugg\Responder\Http\SuccessResponse | [
"Transform",
"the",
"data",
"and",
"return",
"a",
"success",
"response",
"builder",
"."
] | train | https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Traits/RespondsWithJson.php#L52-L55 |
artscorestudio/document-bundle | Form/Factory/FormFactory.php | FormFactory.createForm | public function createForm(array $options = array())
{
$options = array_merge(array('validation_groups' => $this->validationGroups), $options);
return $this->formFactory->createNamed($this->name, $this->type, null, $options);
} | php | public function createForm(array $options = array())
{
$options = array_merge(array('validation_groups' => $this->validationGroups), $options);
return $this->formFactory->createNamed($this->name, $this->type, null, $options);
} | [
"public",
"function",
"createForm",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"array",
"(",
"'validation_groups'",
"=>",
"$",
"this",
"->",
"validationGroups",
")",
",",
"$",
"options",
")",
... | {@inheritDoc}
@see \ASF\DocumentBundle\Form\Factory\FormFactoryInterface::createForm() | [
"{"
] | train | https://github.com/artscorestudio/document-bundle/blob/3aceab0f75de8f7dd0fad0d0db83d7940bf565c8/Form/Factory/FormFactory.php#L60-L65 |
kusanagi/katana-sdk-php7 | src/Component/Component.php | Component.run | public function run(): bool
{
if ($this->startup) {
$this->logger->debug('Calling startup callback');
call_user_func($this->startup, $this);
}
$actions = implode(', ', array_keys($this->callbacks));
$this->logger->info("Component running with callbacks for $a... | php | public function run(): bool
{
if ($this->startup) {
$this->logger->debug('Calling startup callback');
call_user_func($this->startup, $this);
}
$actions = implode(', ', array_keys($this->callbacks));
$this->logger->info("Component running with callbacks for $a... | [
"public",
"function",
"run",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"startup",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'Calling startup callback'",
")",
";",
"call_user_func",
"(",
"$",
"this",
"->",
"startup",
",... | Run the SDK.
@return bool | [
"Run",
"the",
"SDK",
"."
] | train | https://github.com/kusanagi/katana-sdk-php7/blob/91e7860a1852c3ce79a7034f8c36f41840e69e1f/src/Component/Component.php#L131-L153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.