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 |
|---|---|---|---|---|---|---|---|---|---|---|
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Relations/HasManyThrough.php | HasManyThrough.beforeApplyOptions | protected function beforeApplyOptions($stub)
{
$refModel = new ReflectionClass($this->model);
$refIntermeidateModel = new ReflectionClass($this->defaultOptions['intermediate_model']);
$model = $refIntermeidateModel->getShortName();
if ($refModel->getNamespaceName() !== $refIntermeidateModel->getNamespace... | php | protected function beforeApplyOptions($stub)
{
$refModel = new ReflectionClass($this->model);
$refIntermeidateModel = new ReflectionClass($this->defaultOptions['intermediate_model']);
$model = $refIntermeidateModel->getShortName();
if ($refModel->getNamespaceName() !== $refIntermeidateModel->getNamespace... | [
"protected",
"function",
"beforeApplyOptions",
"(",
"$",
"stub",
")",
"{",
"$",
"refModel",
"=",
"new",
"ReflectionClass",
"(",
"$",
"this",
"->",
"model",
")",
";",
"$",
"refIntermeidateModel",
"=",
"new",
"ReflectionClass",
"(",
"$",
"this",
"->",
"default... | replace more before apply options code
@param string $stub
@return string | [
"replace",
"more",
"before",
"apply",
"options",
"code"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Relations/HasManyThrough.php#L147-L159 |
barebone-php/barebone-core | lib/Session.php | Session.instance | public static function instance()
{
if (null === self::$_instance) {
$session_factory = new SessionFactory;
$session = $session_factory->newInstance($_COOKIE);
$segment = $session->getSegment('Barebone\Session');
self::$_instance = $segment;
}
... | php | public static function instance()
{
if (null === self::$_instance) {
$session_factory = new SessionFactory;
$session = $session_factory->newInstance($_COOKIE);
$segment = $session->getSegment('Barebone\Session');
self::$_instance = $segment;
}
... | [
"public",
"static",
"function",
"instance",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"_instance",
")",
"{",
"$",
"session_factory",
"=",
"new",
"SessionFactory",
";",
"$",
"session",
"=",
"$",
"session_factory",
"->",
"newInstance",
"(",... | Instantiate Session Segment
@return Segment | [
"Instantiate",
"Session",
"Segment"
] | train | https://github.com/barebone-php/barebone-core/blob/7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc/lib/Session.php#L46-L56 |
yuncms/framework | src/rest/models/User.php | User.fields | public function fields()
{
return [
'id',
'nickname',
'faceUrl' => function () {
return $this->getAvatar(AvatarHelper::AVATAR_MIDDLE);
},
'identified',
"created_datetime" => function () {
return gmdate(DA... | php | public function fields()
{
return [
'id',
'nickname',
'faceUrl' => function () {
return $this->getAvatar(AvatarHelper::AVATAR_MIDDLE);
},
'identified',
"created_datetime" => function () {
return gmdate(DA... | [
"public",
"function",
"fields",
"(",
")",
"{",
"return",
"[",
"'id'",
",",
"'nickname'",
",",
"'faceUrl'",
"=>",
"function",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getAvatar",
"(",
"AvatarHelper",
"::",
"AVATAR_MIDDLE",
")",
";",
"}",
",",
"'identi... | 客户端允许访问的字段
@return array | [
"客户端允许访问的字段"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/models/User.php#L24-L43 |
CakeCMS/Core | src/Theme.php | Theme.setup | public static function setup($prefix = null)
{
$theme = self::name($prefix);
$path = self::find($theme);
if ($path !== null) {
$config = self::getData($theme, 'meta');
if ($config->get('type') == 'theme') {
return $theme;
}
}
... | php | public static function setup($prefix = null)
{
$theme = self::name($prefix);
$path = self::find($theme);
if ($path !== null) {
$config = self::getData($theme, 'meta');
if ($config->get('type') == 'theme') {
return $theme;
}
}
... | [
"public",
"static",
"function",
"setup",
"(",
"$",
"prefix",
"=",
"null",
")",
"{",
"$",
"theme",
"=",
"self",
"::",
"name",
"(",
"$",
"prefix",
")",
";",
"$",
"path",
"=",
"self",
"::",
"find",
"(",
"$",
"theme",
")",
";",
"if",
"(",
"$",
"pat... | Setup current theme.
@param null|string $prefix
@return null|string | [
"Setup",
"current",
"theme",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Theme.php#L36-L49 |
CakeCMS/Core | src/Theme.php | Theme.find | public static function find($theme)
{
$paths = App::path('Plugin');
foreach ($paths as $path) {
$path = FS::clean($path . '/', DS);
$themeFolder = $path . $theme;
if (FS::isDir($themeFolder)) {
return $themeFolder;
}
}
... | php | public static function find($theme)
{
$paths = App::path('Plugin');
foreach ($paths as $path) {
$path = FS::clean($path . '/', DS);
$themeFolder = $path . $theme;
if (FS::isDir($themeFolder)) {
return $themeFolder;
}
}
... | [
"public",
"static",
"function",
"find",
"(",
"$",
"theme",
")",
"{",
"$",
"paths",
"=",
"App",
"::",
"path",
"(",
"'Plugin'",
")",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"FS",
"::",
"clean",
"(",
"$",
... | Find theme plugin in path.
@param string $theme
@return null|string | [
"Find",
"theme",
"plugin",
"in",
"path",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Theme.php#L68-L81 |
liugene/framework | src/Controller.php | Controller.error | protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = [])
{
if (is_null($url)) {
$url = $this->request->isAjax() ? '' : 'javascript:history.back(-1);';
} elseif ('' !== $url && !strpos($url, '://') && 0 !== strpos($url, '/')) {
$url = $this->... | php | protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = [])
{
if (is_null($url)) {
$url = $this->request->isAjax() ? '' : 'javascript:history.back(-1);';
} elseif ('' !== $url && !strpos($url, '://') && 0 !== strpos($url, '/')) {
$url = $this->... | [
"protected",
"function",
"error",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"url",
"=",
"null",
",",
"$",
"data",
"=",
"''",
",",
"$",
"wait",
"=",
"3",
",",
"array",
"$",
"header",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"url",
... | 操作错误跳转的快捷方法
@access protected
@param mixed $msg 提示信息
@param string $url 跳转的 URL 地址
@param mixed $data 返回的数据
@param int $wait 跳转等待时间
@param array $header 发送的 Header 信息
@return void | [
"操作错误跳转的快捷方法"
] | train | https://github.com/liugene/framework/blob/450642242442c5884d47552a588a2639923e7289/src/Controller.php#L108-L136 |
liugene/framework | src/Controller.php | Controller.getReturnType | public function getReturnType($action)
{
if(isset($this->returnType[$action])){
return $this->returnType[$action];
}
return false;
} | php | public function getReturnType($action)
{
if(isset($this->returnType[$action])){
return $this->returnType[$action];
}
return false;
} | [
"public",
"function",
"getReturnType",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"returnType",
"[",
"$",
"action",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"returnType",
"[",
"$",
"action",
"]",
";",
"}",
"re... | 获取当前的 response 输出类型
@access public
@param $action string 方法 ['view', 'json', 'console', 'xml', 'jsonp']
@return string|boolean | [
"获取当前的",
"response",
"输出类型"
] | train | https://github.com/liugene/framework/blob/450642242442c5884d47552a588a2639923e7289/src/Controller.php#L173-L181 |
ipunkt/laravel-package-manager | src/Providers/ConfigurationServiceProvider.php | ConfigurationServiceProvider.register | public function register()
{
$this->configurations()->each(function (array $configuration) {
$this->mergeConfigFrom(
$this->packagePath($configuration['file']), $configuration['key']
);
if ($this->app->runningInConsole()) {
$this->publishe... | php | public function register()
{
$this->configurations()->each(function (array $configuration) {
$this->mergeConfigFrom(
$this->packagePath($configuration['file']), $configuration['key']
);
if ($this->app->runningInConsole()) {
$this->publishe... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"configurations",
"(",
")",
"->",
"each",
"(",
"function",
"(",
"array",
"$",
"configuration",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"$",
"this",
"->",
"packagePath",
"(",... | registering | [
"registering"
] | train | https://github.com/ipunkt/laravel-package-manager/blob/6ecfc9d933c37927e52c441d5019126be69e5817/src/Providers/ConfigurationServiceProvider.php#L26-L39 |
ipunkt/laravel-package-manager | src/Providers/ConfigurationServiceProvider.php | ConfigurationServiceProvider.configurations | protected function configurations(): Collection
{
$configurations = collect();
foreach ($this->configurationFiles as $alias => $file) {
if (is_numeric($alias)) {
$alias = $file;
}
$key = $alias;
if (ends_with($key, '.php')) {
... | php | protected function configurations(): Collection
{
$configurations = collect();
foreach ($this->configurationFiles as $alias => $file) {
if (is_numeric($alias)) {
$alias = $file;
}
$key = $alias;
if (ends_with($key, '.php')) {
... | [
"protected",
"function",
"configurations",
"(",
")",
":",
"Collection",
"{",
"$",
"configurations",
"=",
"collect",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"configurationFiles",
"as",
"$",
"alias",
"=>",
"$",
"file",
")",
"{",
"if",
"(",
"is_nu... | prepares configuration
@return \Illuminate\Support\Collection | [
"prepares",
"configuration"
] | train | https://github.com/ipunkt/laravel-package-manager/blob/6ecfc9d933c37927e52c441d5019126be69e5817/src/Providers/ConfigurationServiceProvider.php#L46-L68 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Validate/Sitemap/Changefreq.php | Zend_Validate_Sitemap_Changefreq.isValid | public function isValid($value)
{
$this->_setValue($value);
if (!is_string($value)) {
return false;
}
if (!in_array($value, $this->_changeFreqs, true)) {
$this->_error();
return false;
}
return true;
} | php | public function isValid($value)
{
$this->_setValue($value);
if (!is_string($value)) {
return false;
}
if (!in_array($value, $this->_changeFreqs, true)) {
$this->_error();
return false;
}
return true;
} | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_setValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"in_array",
"("... | Validates if a string is valid as a sitemap changefreq
@link http://www.sitemaps.org/protocol.php#changefreqdef <changefreq>
@param string $value value to validate
@return boolean | [
"Validates",
"if",
"a",
"string",
"is",
"valid",
"as",
"a",
"sitemap",
"changefreq"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Validate/Sitemap/Changefreq.php#L73-L87 |
ekho/lumberjack-php | src/SecureSocket.php | SecureSocket.mergeOptions | private function mergeOptions(array $options)
{
foreach ($options as $key => $value) {
if (!in_array($key, self::$acceptableOptions)) {
throw new InvalidArgumentException("Option '{$key}' does not supported");
}
$this->options[$key] = $value;
}
... | php | private function mergeOptions(array $options)
{
foreach ($options as $key => $value) {
if (!in_array($key, self::$acceptableOptions)) {
throw new InvalidArgumentException("Option '{$key}' does not supported");
}
$this->options[$key] = $value;
}
... | [
"private",
"function",
"mergeOptions",
"(",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"key",
",",
"self",
"::",
"$",
"acceptableOptions",
"... | merge options
@param array $options
@throws InvalidArgumentException | [
"merge",
"options"
] | train | https://github.com/ekho/lumberjack-php/blob/c2d0d88c6917f8e165d6f828569873df35750ecd/src/SecureSocket.php#L306-L314 |
liugene/framework | src/Application.php | Application.router | static public function router($rule='',$tag='')
{
if($rule && $tag){
return self::make(\linkphp\router\Router::class)->rule($rule,$tag);
}
return self::make(\linkphp\router\Router::class);
} | php | static public function router($rule='',$tag='')
{
if($rule && $tag){
return self::make(\linkphp\router\Router::class)->rule($rule,$tag);
}
return self::make(\linkphp\router\Router::class);
} | [
"static",
"public",
"function",
"router",
"(",
"$",
"rule",
"=",
"''",
",",
"$",
"tag",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"rule",
"&&",
"$",
"tag",
")",
"{",
"return",
"self",
"::",
"make",
"(",
"\\",
"linkphp",
"\\",
"router",
"\\",
"Router",... | 获取环境实例
@param string $rule
@param string $tag
@return Router | [
"获取环境实例"
] | train | https://github.com/liugene/framework/blob/450642242442c5884d47552a588a2639923e7289/src/Application.php#L66-L74 |
liugene/framework | src/Application.php | Application.event | static public function event($server='',$events='', $eager=false)
{
$eventObject = self::get('linkphp\event\Event');
if($server == '') return $eventObject;
if($events != ''){
if(is_array($events)){
$first = false;
foreach($events as $event){
... | php | static public function event($server='',$events='', $eager=false)
{
$eventObject = self::get('linkphp\event\Event');
if($server == '') return $eventObject;
if($events != ''){
if(is_array($events)){
$first = false;
foreach($events as $event){
... | [
"static",
"public",
"function",
"event",
"(",
"$",
"server",
"=",
"''",
",",
"$",
"events",
"=",
"''",
",",
"$",
"eager",
"=",
"false",
")",
"{",
"$",
"eventObject",
"=",
"self",
"::",
"get",
"(",
"'linkphp\\event\\Event'",
")",
";",
"if",
"(",
"$",
... | 获取事件类实例
@param string $server
@param string|array $events
@param bool $eager 是否立即执行
@return mixed | [
"获取事件类实例"
] | train | https://github.com/liugene/framework/blob/450642242442c5884d47552a588a2639923e7289/src/Application.php#L221-L254 |
cohesion/cohesion-core | src/Environment/HTTPEnvironment.php | HTTPEnvironment.getHighestSupportedValue | private function getHighestSupportedValue($str, $supported) {
$accepts = explode(',', $str);
$types = array();
foreach ($accepts as $accept) {
$tmp = explode(';', trim($accept));
$q = 1;
if (count($tmp) > 1) {
if (preg_match('/q=(\d+(?:\.\d+)?)... | php | private function getHighestSupportedValue($str, $supported) {
$accepts = explode(',', $str);
$types = array();
foreach ($accepts as $accept) {
$tmp = explode(';', trim($accept));
$q = 1;
if (count($tmp) > 1) {
if (preg_match('/q=(\d+(?:\.\d+)?)... | [
"private",
"function",
"getHighestSupportedValue",
"(",
"$",
"str",
",",
"$",
"supported",
")",
"{",
"$",
"accepts",
"=",
"explode",
"(",
"','",
",",
"$",
"str",
")",
";",
"$",
"types",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"accepts",
"as... | Returns the highest value found in the string that is within the supported array
For use with headers such as:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
@param $str The header string to use
@param $supported an array of ... | [
"Returns",
"the",
"highest",
"value",
"found",
"in",
"the",
"string",
"that",
"is",
"within",
"the",
"supported",
"array",
"For",
"use",
"with",
"headers",
"such",
"as",
":",
"Accept",
":",
"text",
"/",
"html",
"application",
"/",
"xhtml",
"+",
"xml",
"a... | train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Environment/HTTPEnvironment.php#L87-L109 |
PortaText/php-sdk | src/PortaText/Client/Curl.php | Curl.execute | public function execute($descriptor)
{
$curl = @curl_init();
$headers = array();
foreach ($descriptor->headers as $k => $v) {
$headers[] = "$k: $v";
}
$fileHandle = null;
$fileHandleW = null;
$headers[] = "Expect:";
$state = "reading_status... | php | public function execute($descriptor)
{
$curl = @curl_init();
$headers = array();
foreach ($descriptor->headers as $k => $v) {
$headers[] = "$k: $v";
}
$fileHandle = null;
$fileHandleW = null;
$headers[] = "Expect:";
$state = "reading_status... | [
"public",
"function",
"execute",
"(",
"$",
"descriptor",
")",
"{",
"$",
"curl",
"=",
"@",
"curl_init",
"(",
")",
";",
"$",
"headers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"descriptor",
"->",
"headers",
"as",
"$",
"k",
"=>",
"$",
"v",
... | Executes the request. Will depend on the client implementation.
Returns an array with code, headers, and body.
@param PortaText\Command\Descriptor $descriptor Command descriptor.
@return array
@throws PortaText\Exception\RequestError | [
"Executes",
"the",
"request",
".",
"Will",
"depend",
"on",
"the",
"client",
"implementation",
".",
"Returns",
"an",
"array",
"with",
"code",
"headers",
"and",
"body",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Client/Curl.php#L27-L107 |
PortaText/php-sdk | src/PortaText/Client/Curl.php | Curl.assertCurlResult | private function assertCurlResult($curl, $result, $descriptor)
{
if ($result === false) {
$error = curl_error($curl);
@curl_close($curl);
throw new RequestError($error, $descriptor);
}
@curl_close($curl);
return $result;
} | php | private function assertCurlResult($curl, $result, $descriptor)
{
if ($result === false) {
$error = curl_error($curl);
@curl_close($curl);
throw new RequestError($error, $descriptor);
}
@curl_close($curl);
return $result;
} | [
"private",
"function",
"assertCurlResult",
"(",
"$",
"curl",
",",
"$",
"result",
",",
"$",
"descriptor",
")",
"{",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"$",
"error",
"=",
"curl_error",
"(",
"$",
"curl",
")",
";",
"@",
"curl_close",
"("... | Asserts that the curl result was successful.
@param resource $curl The curl resource.
@param mixed $result The result.
@param PortaText\Command\Descriptor $descriptor Command descriptor.
@return mixed
@throws PortaText\Exception\RequestError | [
"Asserts",
"that",
"the",
"curl",
"result",
"was",
"successful",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Client/Curl.php#L119-L128 |
PortaText/php-sdk | src/PortaText/Client/Curl.php | Curl.parseHeader | private function parseHeader($header)
{
list($key, $value) = explode(": ", trim($header), 2);
return array(strtolower($key), $value);
} | php | private function parseHeader($header)
{
list($key, $value) = explode(": ", trim($header), 2);
return array(strtolower($key), $value);
} | [
"private",
"function",
"parseHeader",
"(",
"$",
"header",
")",
"{",
"list",
"(",
"$",
"key",
",",
"$",
"value",
")",
"=",
"explode",
"(",
"\": \"",
",",
"trim",
"(",
"$",
"header",
")",
",",
"2",
")",
";",
"return",
"array",
"(",
"strtolower",
"(",... | Parses an HTTP header line.
@param string $header The HTTP header line.
@return array | [
"Parses",
"an",
"HTTP",
"header",
"line",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Client/Curl.php#L149-L153 |
PortaText/php-sdk | src/PortaText/Client/Curl.php | Curl.openFile | private function openFile($file, $mode)
{
$handle = @fopen($file, $mode);
if ($handle === false) {
throw new \InvalidArgumentException("Could not open $file");
}
return $handle;
} | php | private function openFile($file, $mode)
{
$handle = @fopen($file, $mode);
if ($handle === false) {
throw new \InvalidArgumentException("Could not open $file");
}
return $handle;
} | [
"private",
"function",
"openFile",
"(",
"$",
"file",
",",
"$",
"mode",
")",
"{",
"$",
"handle",
"=",
"@",
"fopen",
"(",
"$",
"file",
",",
"$",
"mode",
")",
";",
"if",
"(",
"$",
"handle",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"InvalidArg... | Opens a file and returns a file handle.
@param string $file The filename.
@param string $mode The mode.
@return resource|false | [
"Opens",
"a",
"file",
"and",
"returns",
"a",
"file",
"handle",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Client/Curl.php#L163-L170 |
simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.addModule | public function addModule(Module $module)
{
$name = $module->getName();
if (isset($this->modules[$name])) {
throw new \LogicException(sprintf('Trying to register two modules with the same name "%s"', $name));
}
$this->view->addTemplatePath($module->getPath() . '/Resources... | php | public function addModule(Module $module)
{
$name = $module->getName();
if (isset($this->modules[$name])) {
throw new \LogicException(sprintf('Trying to register two modules with the same name "%s"', $name));
}
$this->view->addTemplatePath($module->getPath() . '/Resources... | [
"public",
"function",
"addModule",
"(",
"Module",
"$",
"module",
")",
"{",
"$",
"name",
"=",
"$",
"module",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"modules",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new... | Add Module
@param Module $module
@return Container
@throws \LogicException | [
"Add",
"Module"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L111-L121 |
simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.addProvider | public function addProvider(Provider $provider)
{
$name = $provider->getName();
if (isset($this->providers[$name])) {
throw new \LogicException(sprintf('Trying to register two providers with the same name "%s"', $name));
}
$this->providers[$name] = $provider;
... | php | public function addProvider(Provider $provider)
{
$name = $provider->getName();
if (isset($this->providers[$name])) {
throw new \LogicException(sprintf('Trying to register two providers with the same name "%s"', $name));
}
$this->providers[$name] = $provider;
... | [
"public",
"function",
"addProvider",
"(",
"Provider",
"$",
"provider",
")",
"{",
"$",
"name",
"=",
"$",
"provider",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"providers",
"[",
"$",
"name",
"]",
")",
")",
"{",
"thro... | Add Module
@param Provider $provider
@return Container
@throws \LogicException | [
"Add",
"Module"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L130-L139 |
simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.addRoute | public function addRoute($route)
{
if (!$route instanceof Route && !is_array($route)) {
throw new \LogicException('Route invalid. Expected Route instance or array.');
} elseif ($route instanceof Route) {
$name = $route->getName();
if (isset($this->routes[$name])) ... | php | public function addRoute($route)
{
if (!$route instanceof Route && !is_array($route)) {
throw new \LogicException('Route invalid. Expected Route instance or array.');
} elseif ($route instanceof Route) {
$name = $route->getName();
if (isset($this->routes[$name])) ... | [
"public",
"function",
"addRoute",
"(",
"$",
"route",
")",
"{",
"if",
"(",
"!",
"$",
"route",
"instanceof",
"Route",
"&&",
"!",
"is_array",
"(",
"$",
"route",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Route invalid. Expected Route instance... | Add Route
@param Route|array $route
@return Container
@throws \LogicException | [
"Add",
"Route"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L148-L167 |
simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.getModule | public function getModule($name)
{
if (!isset($this->modules[$name])) {
throw new \LogicException(sprintf('The module "%s" don\'t exists.', $name));
}
return $this->modules[$name];
} | php | public function getModule($name)
{
if (!isset($this->modules[$name])) {
throw new \LogicException(sprintf('The module "%s" don\'t exists.', $name));
}
return $this->modules[$name];
} | [
"public",
"function",
"getModule",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"modules",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'The module \"%s\" don\\'t exis... | Get Module
@param string $name
@return Module
@throws \LogicException | [
"Get",
"Module"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L186-L192 |
simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.getProvider | public function getProvider($name)
{
if (!isset($this->providers[$name])) {
throw new \LogicException(sprintf('The provider "%s" don\'t exists.', $name));
}
return $this->providers[$name];
} | php | public function getProvider($name)
{
if (!isset($this->providers[$name])) {
throw new \LogicException(sprintf('The provider "%s" don\'t exists.', $name));
}
return $this->providers[$name];
} | [
"public",
"function",
"getProvider",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"providers",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'The provider \"%s\" don\\'... | Get Provider
@param string $name
@return Provider
@throws \LogicException | [
"Get",
"Provider"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L211-L217 |
simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.getRoute | public function getRoute($name)
{
if (!isset($this->routes[$name])) {
throw new \LogicException(sprintf('Route "%s" not found.', $name));
}
return $this->routes[$name];
} | php | public function getRoute($name)
{
if (!isset($this->routes[$name])) {
throw new \LogicException(sprintf('Route "%s" not found.', $name));
}
return $this->routes[$name];
} | [
"public",
"function",
"getRoute",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"routes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'Route \"%s\" not found.'",
","... | Get Route from name
@param string $name
@return Route
@throws \LogicException | [
"Get",
"Route",
"from",
"name"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L266-L273 |
simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.getSetting | public function getSetting($name)
{
if (!isset($this->settings[$name])) {
throw new \LogicException(sprintf('The setting "%s" don\'t exists.', $name));
}
return $this->settings[$name];
} | php | public function getSetting($name)
{
if (!isset($this->settings[$name])) {
throw new \LogicException(sprintf('The setting "%s" don\'t exists.', $name));
}
return $this->settings[$name];
} | [
"public",
"function",
"getSetting",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"settings",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'The setting \"%s\" don\\'t e... | Set setting from name
@param string $name
@return mixed
@throws \LogicException | [
"Set",
"setting",
"from",
"name"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L292-L298 |
simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.setSettings | public function setSettings(array $settings)
{
$this->settings = array_merge($this->settings, $settings);
if (isset($settings['templates_path'])) {
$this->view->templatesPath = $this->settings['templates_path'];
}
return $this;
} | php | public function setSettings(array $settings)
{
$this->settings = array_merge($this->settings, $settings);
if (isset($settings['templates_path'])) {
$this->view->templatesPath = $this->settings['templates_path'];
}
return $this;
} | [
"public",
"function",
"setSettings",
"(",
"array",
"$",
"settings",
")",
"{",
"$",
"this",
"->",
"settings",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"settings",
",",
"$",
"settings",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"settings",
"[",
"'templa... | Set settings
@param array $settings
@return Container | [
"Set",
"settings"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L422-L431 |
phrest/sdk | src/Generator/Helper/Files.php | Files.formPath | public static function formPath($version, $type, $entityName, $className)
{
return self::$outputDir . '/'
. $version . '/'
. $type . '/'
. $entityName . '/'
. $className . '.php';
} | php | public static function formPath($version, $type, $entityName, $className)
{
return self::$outputDir . '/'
. $version . '/'
. $type . '/'
. $entityName . '/'
. $className . '.php';
} | [
"public",
"static",
"function",
"formPath",
"(",
"$",
"version",
",",
"$",
"type",
",",
"$",
"entityName",
",",
"$",
"className",
")",
"{",
"return",
"self",
"::",
"$",
"outputDir",
".",
"'/'",
".",
"$",
"version",
".",
"'/'",
".",
"$",
"type",
".",
... | @param $version
@param $type
@param $entityName
@param $className
@return string | [
"@param",
"$version",
"@param",
"$type",
"@param",
"$entityName",
"@param",
"$className"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Generator/Helper/Files.php#L62-L69 |
Articus/DataTransfer | src/Articus/DataTransfer/Metadata/Reader/Annotation.php | Annotation.getMetadata | public function getMetadata($className, $subset)
{
$classMetadataCacheKey = $this->getClassMetadataCacheKey($className);
$classMetadata = $this->cacheStorage->getItem($classMetadataCacheKey);
if ($classMetadata === null)
{
$classMetadata = $this->readClassMetadata($className);
$this->cacheStorage->addIte... | php | public function getMetadata($className, $subset)
{
$classMetadataCacheKey = $this->getClassMetadataCacheKey($className);
$classMetadata = $this->cacheStorage->getItem($classMetadataCacheKey);
if ($classMetadata === null)
{
$classMetadata = $this->readClassMetadata($className);
$this->cacheStorage->addIte... | [
"public",
"function",
"getMetadata",
"(",
"$",
"className",
",",
"$",
"subset",
")",
"{",
"$",
"classMetadataCacheKey",
"=",
"$",
"this",
"->",
"getClassMetadataCacheKey",
"(",
"$",
"className",
")",
";",
"$",
"classMetadata",
"=",
"$",
"this",
"->",
"cacheS... | Returns metadata for specified subset of class fields
@param string $className
@param string $subset
@return DT\Metadata | [
"Returns",
"metadata",
"for",
"specified",
"subset",
"of",
"class",
"fields"
] | train | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Metadata/Reader/Annotation.php#L30-L53 |
Articus/DataTransfer | src/Articus/DataTransfer/Metadata/Reader/Annotation.php | Annotation.readClassMetadata | protected function readClassMetadata($className)
{
/** @var DT\Metadata[] $result */
$result = [];
$reflection = new \ReflectionClass($className);
$reader = new AnnotationReader();
//Read property annotations
$propertyFilter = \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED | \Reflection... | php | protected function readClassMetadata($className)
{
/** @var DT\Metadata[] $result */
$result = [];
$reflection = new \ReflectionClass($className);
$reader = new AnnotationReader();
//Read property annotations
$propertyFilter = \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED | \Reflection... | [
"protected",
"function",
"readClassMetadata",
"(",
"$",
"className",
")",
"{",
"/** @var DT\\Metadata[] $result */",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"className",
")",
";",
"$",
"reader",
"=",... | Reads class metadata from annotations
@param string $className
@return DT\Metadata[]
@throws \ReflectionException
@throws \Doctrine\Common\Annotations\AnnotationException | [
"Reads",
"class",
"metadata",
"from",
"annotations"
] | train | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Metadata/Reader/Annotation.php#L72-L150 |
Articus/DataTransfer | src/Articus/DataTransfer/Metadata/Reader/Annotation.php | Annotation.readPropertyAnnotations | protected static function readPropertyAnnotations(\ReflectionProperty &$property, AnnotationReader &$reader)
{
$dataMap = [];
$strategyMap = [];
$validatorsMap = [];
foreach ($reader->getPropertyAnnotations($property) as $annotation)
{
switch (true)
{
case ($annotation instanceof DT\Annotation\Data... | php | protected static function readPropertyAnnotations(\ReflectionProperty &$property, AnnotationReader &$reader)
{
$dataMap = [];
$strategyMap = [];
$validatorsMap = [];
foreach ($reader->getPropertyAnnotations($property) as $annotation)
{
switch (true)
{
case ($annotation instanceof DT\Annotation\Data... | [
"protected",
"static",
"function",
"readPropertyAnnotations",
"(",
"\\",
"ReflectionProperty",
"&",
"$",
"property",
",",
"AnnotationReader",
"&",
"$",
"reader",
")",
"{",
"$",
"dataMap",
"=",
"[",
"]",
";",
"$",
"strategyMap",
"=",
"[",
"]",
";",
"$",
"va... | Reads and groups up annotations for specified property
@param \ReflectionProperty $property
@param AnnotationReader $reader
@return \Generator | [
"Reads",
"and",
"groups",
"up",
"annotations",
"for",
"specified",
"property"
] | train | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Metadata/Reader/Annotation.php#L158-L184 |
Articus/DataTransfer | src/Articus/DataTransfer/Metadata/Reader/Annotation.php | Annotation.isValidGetter | protected static function isValidGetter(\ReflectionClass &$reflection, $name)
{
if (!$reflection->hasMethod($name))
{
throw new \LogicException(
sprintf('Invalid metadata for %s: no getter %s.', $reflection->getName(), $name)
);
}
$getter = $reflection->getMethod($name);
if (!$getter->isPublic())
... | php | protected static function isValidGetter(\ReflectionClass &$reflection, $name)
{
if (!$reflection->hasMethod($name))
{
throw new \LogicException(
sprintf('Invalid metadata for %s: no getter %s.', $reflection->getName(), $name)
);
}
$getter = $reflection->getMethod($name);
if (!$getter->isPublic())
... | [
"protected",
"static",
"function",
"isValidGetter",
"(",
"\\",
"ReflectionClass",
"&",
"$",
"reflection",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"reflection",
"->",
"hasMethod",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicExcep... | Validates if class has valid getter method with specified name
@param \ReflectionClass $reflection
@param string $name
@return bool | [
"Validates",
"if",
"class",
"has",
"valid",
"getter",
"method",
"with",
"specified",
"name"
] | train | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Metadata/Reader/Annotation.php#L192-L214 |
Articus/DataTransfer | src/Articus/DataTransfer/Metadata/Reader/Annotation.php | Annotation.isValidSetter | protected static function isValidSetter(\ReflectionClass &$reflection, $name)
{
if (!$reflection->hasMethod($name))
{
throw new \LogicException(
sprintf('Invalid metadata for %s: no setter %s.', $reflection->getName(), $name)
);
}
$setter = $reflection->getMethod($name);
if (!$setter->isPublic())
... | php | protected static function isValidSetter(\ReflectionClass &$reflection, $name)
{
if (!$reflection->hasMethod($name))
{
throw new \LogicException(
sprintf('Invalid metadata for %s: no setter %s.', $reflection->getName(), $name)
);
}
$setter = $reflection->getMethod($name);
if (!$setter->isPublic())
... | [
"protected",
"static",
"function",
"isValidSetter",
"(",
"\\",
"ReflectionClass",
"&",
"$",
"reflection",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"reflection",
"->",
"hasMethod",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicExcep... | Validates if class has valid setter method with specified name
@param \ReflectionClass $reflection
@param string $name
@return bool | [
"Validates",
"if",
"class",
"has",
"valid",
"setter",
"method",
"with",
"specified",
"name"
] | train | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Metadata/Reader/Annotation.php#L222-L250 |
hametuha/gapiwp | src/Hametuha/GapiWP/Utility/Input.php | Input.verify_nonce | public function verify_nonce($action, $key = '_wpnonce'){
$nonce = $this->request($key);
return $nonce && wp_verify_nonce($this->request($key), $action);
} | php | public function verify_nonce($action, $key = '_wpnonce'){
$nonce = $this->request($key);
return $nonce && wp_verify_nonce($this->request($key), $action);
} | [
"public",
"function",
"verify_nonce",
"(",
"$",
"action",
",",
"$",
"key",
"=",
"'_wpnonce'",
")",
"{",
"$",
"nonce",
"=",
"$",
"this",
"->",
"request",
"(",
"$",
"key",
")",
";",
"return",
"$",
"nonce",
"&&",
"wp_verify_nonce",
"(",
"$",
"this",
"->... | Verify nonce
@param string $action
@param string $key Default '_wpnonce'
@return bool | [
"Verify",
"nonce"
] | train | https://github.com/hametuha/gapiwp/blob/7b9716d0ebd54c4ab79cca94a4c5aef099a54266/src/Hametuha/GapiWP/Utility/Input.php#L98-L101 |
Articus/DataTransfer | src/Articus/DataTransfer/Validator.php | Validator.validate | public function validate(array $array)
{
$messages = [];
foreach ($this->metadata->fields as $field)
{
$value = array_key_exists($field, $array)? $array[$field] : null;
if (!(($value === null) && $this->metadata->nullables[$field]))
{
$validator = $this->getValidator($field);
if (!$validator->is... | php | public function validate(array $array)
{
$messages = [];
foreach ($this->metadata->fields as $field)
{
$value = array_key_exists($field, $array)? $array[$field] : null;
if (!(($value === null) && $this->metadata->nullables[$field]))
{
$validator = $this->getValidator($field);
if (!$validator->is... | [
"public",
"function",
"validate",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"messages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"metadata",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"value",
"=",
"array_key_exists",
"(",
"$",... | Validates associative array according metadata
@param array $array
@return array | [
"Validates",
"associative",
"array",
"according",
"metadata"
] | train | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Validator.php#L70-L91 |
Articus/DataTransfer | src/Articus/DataTransfer/Validator.php | Validator.getValidator | protected function getValidator($field)
{
$result = null;
if (isset($this->validators[$field]))
{
$result = $this->validators[$field];
}
else
{
$result = new ValidatorChain();
$result->setPluginManager($this->validatorPluginManager);
if (isset($this->metadata->validators[$field]))
{
fore... | php | protected function getValidator($field)
{
$result = null;
if (isset($this->validators[$field]))
{
$result = $this->validators[$field];
}
else
{
$result = new ValidatorChain();
$result->setPluginManager($this->validatorPluginManager);
if (isset($this->metadata->validators[$field]))
{
fore... | [
"protected",
"function",
"getValidator",
"(",
"$",
"field",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"validators",
"[",
"$",
"field",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"validato... | Builds validator chain for specified field according metadata
@param string $field
@return ValidatorInterface | [
"Builds",
"validator",
"chain",
"for",
"specified",
"field",
"according",
"metadata"
] | train | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Validator.php#L98-L124 |
zircote/AMQP | library/AMQP/AbstractChannel.php | AbstractChannel.dispatch | public function dispatch($methodSig, $args, $content)
{
if (!array_key_exists($methodSig, $this->methodMap)) {
throw new \Exception("Unknown AMQP method $methodSig");
}
$amqpMethod = $this->methodMap[$methodSig];
if ($content == null) {
return call_user_func... | php | public function dispatch($methodSig, $args, $content)
{
if (!array_key_exists($methodSig, $this->methodMap)) {
throw new \Exception("Unknown AMQP method $methodSig");
}
$amqpMethod = $this->methodMap[$methodSig];
if ($content == null) {
return call_user_func... | [
"public",
"function",
"dispatch",
"(",
"$",
"methodSig",
",",
"$",
"args",
",",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"methodSig",
",",
"$",
"this",
"->",
"methodMap",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
... | @todo tie in an event handler interface and decouple.
@param $methodSig
@param $args
@param $content
@return mixed
@throws \Exception | [
"@todo",
"tie",
"in",
"an",
"event",
"handler",
"interface",
"and",
"decouple",
"."
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/AbstractChannel.php#L151-L166 |
zircote/AMQP | library/AMQP/AbstractChannel.php | AbstractChannel.wait | public function wait($allowedMethods = array(), $nonBlocking = false)
{
if ($allowedMethods) {
if ($this->debug) {
Helper::debugMsg(
sprintf('waiting for %s', implode(', ', $allowedMethods))
);
}
} else {
if ($th... | php | public function wait($allowedMethods = array(), $nonBlocking = false)
{
if ($allowedMethods) {
if ($this->debug) {
Helper::debugMsg(
sprintf('waiting for %s', implode(', ', $allowedMethods))
);
}
} else {
if ($th... | [
"public",
"function",
"wait",
"(",
"$",
"allowedMethods",
"=",
"array",
"(",
")",
",",
"$",
"nonBlocking",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"allowedMethods",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"debug",
")",
"{",
"Helper",
"::",
"debugMsg"... | @todo refactor
Wait for some expected AMQP methods and dispatch to them.
Unexpected methods are queued up for later calls to this PHP
method.
@param array $allowedMethods
@param bool $nonBlocking
@return mixed|null
@throws \Exception | [
"@todo",
"refactor"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/AbstractChannel.php#L272-L381 |
periaptio/empress-generator | src/Generators/ControllerGenerator.php | ControllerGenerator.getTemplatePath | public function getTemplatePath()
{
// get template filename
$useRepositoryLayer = config('generator.use_repository_layer', true);
$useServiceLayer = config('generator.use_service_layer', true);
if ($useServiceLayer && $useRepositoryLayer) {
$templateFilename = 'Controlle... | php | public function getTemplatePath()
{
// get template filename
$useRepositoryLayer = config('generator.use_repository_layer', true);
$useServiceLayer = config('generator.use_service_layer', true);
if ($useServiceLayer && $useRepositoryLayer) {
$templateFilename = 'Controlle... | [
"public",
"function",
"getTemplatePath",
"(",
")",
"{",
"// get template filename",
"$",
"useRepositoryLayer",
"=",
"config",
"(",
"'generator.use_repository_layer'",
",",
"true",
")",
";",
"$",
"useServiceLayer",
"=",
"config",
"(",
"'generator.use_service_layer'",
","... | Get the template path for generate
@return string | [
"Get",
"the",
"template",
"path",
"for",
"generate"
] | train | https://github.com/periaptio/empress-generator/blob/749fb4b12755819e9c97377ebfb446ee0822168a/src/Generators/ControllerGenerator.php#L22-L35 |
ConnectHolland/tulip-api-client | src/ResponseParser.php | ResponseParser.getResponseCode | public function getResponseCode()
{
$code = 0;
$dom = $this->getDOMDocument();
$xpath = new DOMXPath($dom);
if (($codeAttribute = $xpath->query('/response/@code')->item(0)) instanceof DOMAttr) {
$code = intval($codeAttribute->nodeValue);
}
return $code;
... | php | public function getResponseCode()
{
$code = 0;
$dom = $this->getDOMDocument();
$xpath = new DOMXPath($dom);
if (($codeAttribute = $xpath->query('/response/@code')->item(0)) instanceof DOMAttr) {
$code = intval($codeAttribute->nodeValue);
}
return $code;
... | [
"public",
"function",
"getResponseCode",
"(",
")",
"{",
"$",
"code",
"=",
"0",
";",
"$",
"dom",
"=",
"$",
"this",
"->",
"getDOMDocument",
"(",
")",
";",
"$",
"xpath",
"=",
"new",
"DOMXPath",
"(",
"$",
"dom",
")",
";",
"if",
"(",
"(",
"$",
"codeAt... | Returns the response code from the API.
@param ResponseInterface $response
@return int | [
"Returns",
"the",
"response",
"code",
"from",
"the",
"API",
"."
] | train | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/ResponseParser.php#L49-L60 |
ConnectHolland/tulip-api-client | src/ResponseParser.php | ResponseParser.getErrorMessage | public function getErrorMessage()
{
$errorMessage = '';
$dom = $this->getDOMDocument();
$xpath = new DOMXPath($dom);
if (($errorNode = $xpath->query('/response/error')->item(0)) instanceof DOMNode) {
$errorMessage = $errorNode->nodeValue;
}
return $error... | php | public function getErrorMessage()
{
$errorMessage = '';
$dom = $this->getDOMDocument();
$xpath = new DOMXPath($dom);
if (($errorNode = $xpath->query('/response/error')->item(0)) instanceof DOMNode) {
$errorMessage = $errorNode->nodeValue;
}
return $error... | [
"public",
"function",
"getErrorMessage",
"(",
")",
"{",
"$",
"errorMessage",
"=",
"''",
";",
"$",
"dom",
"=",
"$",
"this",
"->",
"getDOMDocument",
"(",
")",
";",
"$",
"xpath",
"=",
"new",
"DOMXPath",
"(",
"$",
"dom",
")",
";",
"if",
"(",
"(",
"$",
... | Returns the error message from the Tulip API.
@return string | [
"Returns",
"the",
"error",
"message",
"from",
"the",
"Tulip",
"API",
"."
] | train | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/ResponseParser.php#L67-L78 |
ConnectHolland/tulip-api-client | src/ResponseParser.php | ResponseParser.getDOMDocument | public function getDOMDocument()
{
if ($this->domDocument instanceof DOMDocument === false) {
$this->domDocument = new DOMDocument('1.0', 'UTF-8');
libxml_clear_errors();
$previousSetting = libxml_use_internal_errors(true);
@$this->domDocument->loadXML($this... | php | public function getDOMDocument()
{
if ($this->domDocument instanceof DOMDocument === false) {
$this->domDocument = new DOMDocument('1.0', 'UTF-8');
libxml_clear_errors();
$previousSetting = libxml_use_internal_errors(true);
@$this->domDocument->loadXML($this... | [
"public",
"function",
"getDOMDocument",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"domDocument",
"instanceof",
"DOMDocument",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"domDocument",
"=",
"new",
"DOMDocument",
"(",
"'1.0'",
",",
"'UTF-8'",
")",
";",
... | Returns the response body as DOMDocument instance.
@return DOMDocument | [
"Returns",
"the",
"response",
"body",
"as",
"DOMDocument",
"instance",
"."
] | train | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/ResponseParser.php#L85-L100 |
yuncms/framework | src/rest/ActiveController.php | ActiveController.behaviors | public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = [
'class' => CompositeAuth::class,
'authMethods' => $this->authMethods,
];
$behaviors['corsFilter'] = [
'class' => \yii\filters\Cors::class,
'... | php | public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = [
'class' => CompositeAuth::class,
'authMethods' => $this->authMethods,
];
$behaviors['corsFilter'] = [
'class' => \yii\filters\Cors::class,
'... | [
"public",
"function",
"behaviors",
"(",
")",
"{",
"$",
"behaviors",
"=",
"parent",
"::",
"behaviors",
"(",
")",
";",
"$",
"behaviors",
"[",
"'authenticator'",
"]",
"=",
"[",
"'class'",
"=>",
"CompositeAuth",
"::",
"class",
",",
"'authMethods'",
"=>",
"$",
... | 初始化 API 控制器验证
@return array | [
"初始化",
"API",
"控制器验证"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/ActiveController.php#L52-L76 |
yuncms/framework | src/rest/ActiveController.php | ActiveController.prepareDataProvider | public function prepareDataProvider(IndexAction $action, $filter)
{
/* @var $modelClass \yii\db\BaseActiveRecord */
$modelClass = $this->modelClass;
$query = $modelClass::find();
if (!empty($filter)) {
$query->andWhere($filter);
}
return Yii::createObject... | php | public function prepareDataProvider(IndexAction $action, $filter)
{
/* @var $modelClass \yii\db\BaseActiveRecord */
$modelClass = $this->modelClass;
$query = $modelClass::find();
if (!empty($filter)) {
$query->andWhere($filter);
}
return Yii::createObject... | [
"public",
"function",
"prepareDataProvider",
"(",
"IndexAction",
"$",
"action",
",",
"$",
"filter",
")",
"{",
"/* @var $modelClass \\yii\\db\\BaseActiveRecord */",
"$",
"modelClass",
"=",
"$",
"this",
"->",
"modelClass",
";",
"$",
"query",
"=",
"$",
"modelClass",
... | Prepares the data provider that should return the requested collection of the models.
@param IndexAction $action
@param mixed $filter
@return ActiveDataProvider
@throws \yii\base\InvalidConfigException | [
"Prepares",
"the",
"data",
"provider",
"that",
"should",
"return",
"the",
"requested",
"collection",
"of",
"the",
"models",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/ActiveController.php#L97-L116 |
yuncms/framework | src/rest/ActiveController.php | ActiveController.checkAccess | public function checkAccess($action, $model = null, $params = [])
{
if ($action === 'update' || $action === 'delete') {
if ($model && $model->user_id !== Yii::$app->user->id) {
throw new ForbiddenHttpException('You do not have permission to perform this operation.');
... | php | public function checkAccess($action, $model = null, $params = [])
{
if ($action === 'update' || $action === 'delete') {
if ($model && $model->user_id !== Yii::$app->user->id) {
throw new ForbiddenHttpException('You do not have permission to perform this operation.');
... | [
"public",
"function",
"checkAccess",
"(",
"$",
"action",
",",
"$",
"model",
"=",
"null",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"action",
"===",
"'update'",
"||",
"$",
"action",
"===",
"'delete'",
")",
"{",
"if",
"(",
"$",
"... | 检查当前用户的权限
This method should be overridden to check whether the current user has the privilege
to run the specified action against the specified data model.
If the user does not have access, a [[ForbiddenHttpException]] should be thrown.
@param string $action the ID of the action to be executed
@param object $model t... | [
"检查当前用户的权限"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/ActiveController.php#L130-L137 |
zodream/thirdparty | src/OAuth/ALiPay.php | ALiPay.info | public function info() {
/**
* avatar 用户头像 String 如果没有数据的时候不会返回该数据,请做好容错 可空 https://tfsimg.alipay.com/images/partner/T1k0xiXXRnXXXXXXXX
nick_name 用户昵称 String 如果没有数据的时候不会返回该数据,请做好容错 可空 张三
province 省份 String 用户注册时填写的省份 如果没有数据的时候不会返回该数据,请做好容错 可空 浙江省
city 城市 String 用户注册时填写的城市, 如果没有数... | php | public function info() {
/**
* avatar 用户头像 String 如果没有数据的时候不会返回该数据,请做好容错 可空 https://tfsimg.alipay.com/images/partner/T1k0xiXXRnXXXXXXXX
nick_name 用户昵称 String 如果没有数据的时候不会返回该数据,请做好容错 可空 张三
province 省份 String 用户注册时填写的省份 如果没有数据的时候不会返回该数据,请做好容错 可空 浙江省
city 城市 String 用户注册时填写的城市, 如果没有数... | [
"public",
"function",
"info",
"(",
")",
"{",
"/**\n * avatar\t用户头像\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\thttps://tfsimg.alipay.com/images/partner/T1k0xiXXRnXXXXXXXX\n nick_name\t用户昵称\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\t张三\n province\t省份\tString\t用户注册时填写的省份 如果没有数据的时候不会返回该数据,请做好容错\t可... | 获取用户信息
@return array|false
@throws \Exception | [
"获取用户信息"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/OAuth/ALiPay.php#L58-L85 |
ondrakoupil/tools | src/Html.php | Html.processLinksInText | static function processLinksInText($input, $stripTags=false, $blankTarget=true) {
if ($stripTags) $input=strip_tags($input);
//Add protocol to www links without one. We use ahttp to strip it later
$input = preg_replace("~([^\w\/:-_]|^)(www\.[^<>,\s\)]+\.\w+)~i","\\1ahttp://\\2", $input);
//Make classical lin... | php | static function processLinksInText($input, $stripTags=false, $blankTarget=true) {
if ($stripTags) $input=strip_tags($input);
//Add protocol to www links without one. We use ahttp to strip it later
$input = preg_replace("~([^\w\/:-_]|^)(www\.[^<>,\s\)]+\.\w+)~i","\\1ahttp://\\2", $input);
//Make classical lin... | [
"static",
"function",
"processLinksInText",
"(",
"$",
"input",
",",
"$",
"stripTags",
"=",
"false",
",",
"$",
"blankTarget",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"stripTags",
")",
"$",
"input",
"=",
"strip_tags",
"(",
"$",
"input",
")",
";",
"//Add p... | Z plaintextu udělá HTML kód tím, že zaktivní odkazy
@param type $input
@param type $stripTags
@param type $blankTarget
@return type | [
"Z",
"plaintextu",
"udělá",
"HTML",
"kód",
"tím",
"že",
"zaktivní",
"odkazy"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Html.php#L14-L33 |
ondrakoupil/tools | src/Html.php | Html.shortenHtml | static function shortenHtml($text, $length = 100, $ending = true, $exact = false, $considerHtml = true) {
if ($ending===true) {
$ending="…";
$length+=7; //Jde o jediný znak, ne o 8 znaků
}
if ($considerHtml) {
// if the plain text is shorter than the maximum length, return the whole text
if (St... | php | static function shortenHtml($text, $length = 100, $ending = true, $exact = false, $considerHtml = true) {
if ($ending===true) {
$ending="…";
$length+=7; //Jde o jediný znak, ne o 8 znaků
}
if ($considerHtml) {
// if the plain text is shorter than the maximum length, return the whole text
if (St... | [
"static",
"function",
"shortenHtml",
"(",
"$",
"text",
",",
"$",
"length",
"=",
"100",
",",
"$",
"ending",
"=",
"true",
",",
"$",
"exact",
"=",
"false",
",",
"$",
"considerHtml",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"ending",
"===",
"true",
")",
... | Zkracování řetězce na požadovanou délku při zachování všech HTML tagů.
Nenahrazuje konce řádků za <br />.
@param string $text Řetězec ke zkrácení
@param int $length Požadovaná délka výsledného řetězce (včetně ukončení)
@param string $ending Ukončení, které se přilepí na konec zkráceného řetězce. TRUE = použít &hell... | [
"Zkracování",
"řetězce",
"na",
"požadovanou",
"délku",
"při",
"zachování",
"všech",
"HTML",
"tagů",
".",
"Nenahrazuje",
"konce",
"řádků",
"za",
"<br",
"/",
">",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Html.php#L45-L137 |
ondrakoupil/tools | src/Html.php | Html.diff | public static function diff($old, $new, $startIns = "<ins>", $endIns = "</ins>", $startDel = "<del>", $endDel = "</del>") {
$ret = '';
$diff = Arrays::diff(preg_split("/[\s]+/", $old), preg_split("/[\s]+/", $new));
foreach($diff as $k){
if(is_array($k))
$ret .= (!empty($k['d'])?$startDel.implode(' ',$k['d'... | php | public static function diff($old, $new, $startIns = "<ins>", $endIns = "</ins>", $startDel = "<del>", $endDel = "</del>") {
$ret = '';
$diff = Arrays::diff(preg_split("/[\s]+/", $old), preg_split("/[\s]+/", $new));
foreach($diff as $k){
if(is_array($k))
$ret .= (!empty($k['d'])?$startDel.implode(' ',$k['d'... | [
"public",
"static",
"function",
"diff",
"(",
"$",
"old",
",",
"$",
"new",
",",
"$",
"startIns",
"=",
"\"<ins>\"",
",",
"$",
"endIns",
"=",
"\"</ins>\"",
",",
"$",
"startDel",
"=",
"\"<del>\"",
",",
"$",
"endDel",
"=",
"\"</del>\"",
")",
"{",
"$",
"re... | Jednoduché zvýraznění změn v řetězci. Pracuje s přesností na jednotlivá slova.
@param string $old
@param string $new
@param string $startIns
@param string $endIns
@param string $startDel
@param string $endDel
@return string
@author Paul's Simple Diff Algorithm v 0.1
(C) Paul Butler 2007 <http://www.paulbutler.org/>
M... | [
"Jednoduché",
"zvýraznění",
"změn",
"v",
"řetězci",
".",
"Pracuje",
"s",
"přesností",
"na",
"jednotlivá",
"slova",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Html.php#L164-L174 |
guillaumebarranco/twitter-api-php-symfony | TwitterAPIExchange.php | TwitterAPIExchange.setPostfields | public function setPostfields(array $array)
{
if (!is_null($this->getGetfield()))
{
throw new Exception('You can only choose get OR post fields.');
}
if (isset($array['status']) && substr($array['status'], 0, 1) === '@')
{
$array['status'] ... | php | public function setPostfields(array $array)
{
if (!is_null($this->getGetfield()))
{
throw new Exception('You can only choose get OR post fields.');
}
if (isset($array['status']) && substr($array['status'], 0, 1) === '@')
{
$array['status'] ... | [
"public",
"function",
"setPostfields",
"(",
"array",
"$",
"array",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"getGetfield",
"(",
")",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'You can only choose get OR post fields.'",
")",
";",
... | Set postfields array, example: array('screen_name' => 'J7mbo')
@param array $array Array of parameters to send to API
@return TwitterAPIExchange Instance of self for method chaining | [
"Set",
"postfields",
"array",
"example",
":",
"array",
"(",
"screen_name",
"=",
">",
"J7mbo",
")"
] | train | https://github.com/guillaumebarranco/twitter-api-php-symfony/blob/34f3d21b2a96b9090b74f7ec14443b085283375e/TwitterAPIExchange.php#L63-L78 |
guillaumebarranco/twitter-api-php-symfony | TwitterAPIExchange.php | TwitterAPIExchange.setGetfield | public function setGetfield($string)
{
if (!is_null($this->getPostfields()))
{
throw new Exception('You can only choose get OR post fields.');
}
$search = array('#', ',', '+', ':');
$replace = array('%23', '%2C', '%2B', '%3A');
$string = str_re... | php | public function setGetfield($string)
{
if (!is_null($this->getPostfields()))
{
throw new Exception('You can only choose get OR post fields.');
}
$search = array('#', ',', '+', ':');
$replace = array('%23', '%2C', '%2B', '%3A');
$string = str_re... | [
"public",
"function",
"setGetfield",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"getPostfields",
"(",
")",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'You can only choose get OR post fields.'",
")",
";",
"}",
"$... | Set getfield string, example: '?screen_name=J7mbo'
@param string $string Get key and value pairs as string
@return \TwitterAPIExchange Instance of self for method chaining | [
"Set",
"getfield",
"string",
"example",
":",
"?screen_name",
"=",
"J7mbo"
] | train | https://github.com/guillaumebarranco/twitter-api-php-symfony/blob/34f3d21b2a96b9090b74f7ec14443b085283375e/TwitterAPIExchange.php#L87-L101 |
guillaumebarranco/twitter-api-php-symfony | TwitterAPIExchange.php | TwitterAPIExchange.performRequest | public function performRequest($return = true)
{
if (!is_bool($return))
{
throw new Exception('performRequest parameter must be true or false');
}
$header = array($this->buildAuthorizationHeader($this->oauth), 'Expect:');
$getfield = $this->ge... | php | public function performRequest($return = true)
{
if (!is_bool($return))
{
throw new Exception('performRequest parameter must be true or false');
}
$header = array($this->buildAuthorizationHeader($this->oauth), 'Expect:');
$getfield = $this->ge... | [
"public",
"function",
"performRequest",
"(",
"$",
"return",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"return",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'performRequest parameter must be true or false'",
")",
";",
"}",
"$",
"header... | Perform the actual data retrieval from the API
@param boolean $return If true, returns data.
@return string json If $return param is true, returns json data. | [
"Perform",
"the",
"actual",
"data",
"retrieval",
"from",
"the",
"API"
] | train | https://github.com/guillaumebarranco/twitter-api-php-symfony/blob/34f3d21b2a96b9090b74f7ec14443b085283375e/TwitterAPIExchange.php#L182-L221 |
guillaumebarranco/twitter-api-php-symfony | TwitterAPIExchange.php | TwitterAPIExchange.buildAuthorizationHeader | private function buildAuthorizationHeader($oauth)
{
$return = 'Authorization: OAuth ';
$values = array();
foreach($oauth as $key => $value)
{
$values[] = "$key=\"" . rawurlencode($value) . "\"";
}
$return .= implode(', ', $values);
... | php | private function buildAuthorizationHeader($oauth)
{
$return = 'Authorization: OAuth ';
$values = array();
foreach($oauth as $key => $value)
{
$values[] = "$key=\"" . rawurlencode($value) . "\"";
}
$return .= implode(', ', $values);
... | [
"private",
"function",
"buildAuthorizationHeader",
"(",
"$",
"oauth",
")",
"{",
"$",
"return",
"=",
"'Authorization: OAuth '",
";",
"$",
"values",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"oauth",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
... | Private method to generate authorization header used by cURL
@param array $oauth Array of oauth data generated by buildOauth()
@return string $return Header used by cURL for request | [
"Private",
"method",
"to",
"generate",
"authorization",
"header",
"used",
"by",
"cURL"
] | train | https://github.com/guillaumebarranco/twitter-api-php-symfony/blob/34f3d21b2a96b9090b74f7ec14443b085283375e/TwitterAPIExchange.php#L252-L264 |
discordier/justtextwidgets | src/Widgets/JustATextOption.php | JustATextOption.generate | public function generate()
{
// Add empty option (XHTML) if there are none
if (empty($this->arrOptions)) {
$this->arrOptions = array(
array(
'value' => '',
'label' => '-'
)
);
}
$strClass... | php | public function generate()
{
// Add empty option (XHTML) if there are none
if (empty($this->arrOptions)) {
$this->arrOptions = array(
array(
'value' => '',
'label' => '-'
)
);
}
$strClass... | [
"public",
"function",
"generate",
"(",
")",
"{",
"// Add empty option (XHTML) if there are none",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"arrOptions",
")",
")",
"{",
"$",
"this",
"->",
"arrOptions",
"=",
"array",
"(",
"array",
"(",
"'value'",
"=>",
"''"... | Generate the widget and return it as string.
@return string | [
"Generate",
"the",
"widget",
"and",
"return",
"it",
"as",
"string",
"."
] | train | https://github.com/discordier/justtextwidgets/blob/585f20eec05d592bb13281ca8ef0972e956d3f06/src/Widgets/JustATextOption.php#L70-L86 |
discordier/justtextwidgets | src/Widgets/JustATextOption.php | JustATextOption.checkOptGroup | private function checkOptGroup($options, $class, $style)
{
foreach ($options as $option) {
// If it is an option group, handle it.
if (!isset($option['value'])) {
$result = $this->checkOptGroup($option, $class, $style);
if ($result) {
... | php | private function checkOptGroup($options, $class, $style)
{
foreach ($options as $option) {
// If it is an option group, handle it.
if (!isset($option['value'])) {
$result = $this->checkOptGroup($option, $class, $style);
if ($result) {
... | [
"private",
"function",
"checkOptGroup",
"(",
"$",
"options",
",",
"$",
"class",
",",
"$",
"style",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"option",
")",
"{",
"// If it is an option group, handle it.",
"if",
"(",
"!",
"isset",
"(",
"$",
"optio... | Scan an option group for the selected option.
@param array $options The option array.
@param string $class The html class to use.
@param string $style The html style to use.
@return null|string | [
"Scan",
"an",
"option",
"group",
"for",
"the",
"selected",
"option",
"."
] | train | https://github.com/discordier/justtextwidgets/blob/585f20eec05d592bb13281ca8ef0972e956d3f06/src/Widgets/JustATextOption.php#L99-L126 |
dms-org/package.blog | src/Domain/Entities/BlogAuthor.php | BlogAuthor.defineEntity | protected function defineEntity(ClassDefinition $class)
{
$class->property($this->name)->asString();
$class->property($this->slug)->asString();
$class->property($this->role)->asString();
$class->property($this->bio)->asObject(Html::class);
$class->property($this->articles... | php | protected function defineEntity(ClassDefinition $class)
{
$class->property($this->name)->asString();
$class->property($this->slug)->asString();
$class->property($this->role)->asString();
$class->property($this->bio)->asObject(Html::class);
$class->property($this->articles... | [
"protected",
"function",
"defineEntity",
"(",
"ClassDefinition",
"$",
"class",
")",
"{",
"$",
"class",
"->",
"property",
"(",
"$",
"this",
"->",
"name",
")",
"->",
"asString",
"(",
")",
";",
"$",
"class",
"->",
"property",
"(",
"$",
"this",
"->",
"slug... | Defines the structure of this entity.
@param ClassDefinition $class | [
"Defines",
"the",
"structure",
"of",
"this",
"entity",
"."
] | train | https://github.com/dms-org/package.blog/blob/1500f6fad20d81289a0dfa617fc1c54699f01e16/src/Domain/Entities/BlogAuthor.php#L77-L90 |
aedart/laravel-helpers | src/Traits/Auth/AuthManagerTrait.php | AuthManagerTrait.getAuthManager | public function getAuthManager(): ?AuthManager
{
if (!$this->hasAuthManager()) {
$this->setAuthManager($this->getDefaultAuthManager());
}
return $this->authManager;
} | php | public function getAuthManager(): ?AuthManager
{
if (!$this->hasAuthManager()) {
$this->setAuthManager($this->getDefaultAuthManager());
}
return $this->authManager;
} | [
"public",
"function",
"getAuthManager",
"(",
")",
":",
"?",
"AuthManager",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAuthManager",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setAuthManager",
"(",
"$",
"this",
"->",
"getDefaultAuthManager",
"(",
")",
")",
... | Get auth manager
If no auth manager has been set, this method will
set and return a default auth manager, if any such
value is available
@see getDefaultAuthManager()
@return AuthManager|null auth manager or null if none auth manager has been set | [
"Get",
"auth",
"manager"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Auth/AuthManagerTrait.php#L53-L59 |
miisieq/InfaktClient | src/Infakt/Collections/SortClause.php | SortClause.setOrder | public function setOrder($order)
{
if (!in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
throw new LogicException('Invalid order argument.');
}
$this->order = $order;
return $this;
} | php | public function setOrder($order)
{
if (!in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
throw new LogicException('Invalid order argument.');
}
$this->order = $order;
return $this;
} | [
"public",
"function",
"setOrder",
"(",
"$",
"order",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"order",
",",
"[",
"self",
"::",
"ORDER_ASC",
",",
"self",
"::",
"ORDER_DESC",
"]",
")",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Invalid ord... | @param $order
@throws LogicException
@return $this | [
"@param",
"$order"
] | train | https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Collections/SortClause.php#L64-L73 |
aryelgois/yasql-php | src/Controller.php | Controller.build | public static function build(
string $output,
string $config,
string $vendor,
array $vendors = null
) {
$builder = new Builder($output, $vendor);
try {
$builder->build($config, $vendors);
} catch (\Exception $e) {
throw $e;
} ... | php | public static function build(
string $output,
string $config,
string $vendor,
array $vendors = null
) {
$builder = new Builder($output, $vendor);
try {
$builder->build($config, $vendors);
} catch (\Exception $e) {
throw $e;
} ... | [
"public",
"static",
"function",
"build",
"(",
"string",
"$",
"output",
",",
"string",
"$",
"config",
",",
"string",
"$",
"vendor",
",",
"array",
"$",
"vendors",
"=",
"null",
")",
"{",
"$",
"builder",
"=",
"new",
"Builder",
"(",
"$",
"output",
",",
"$... | Builds database schemas into a directory
@param string $output Path to output directory
@param string $config Path to config file
@param string $vendor Path to vendors directory
@param array $vendors List of additional vendors to include | [
"Builds",
"database",
"schemas",
"into",
"a",
"directory"
] | train | https://github.com/aryelgois/yasql-php/blob/f428b180d35bfc1ddf1f9b3323f9b085fbc09ac7/src/Controller.php#L29-L44 |
aryelgois/yasql-php | src/Controller.php | Controller.generate | public static function generate(
string $yasql,
string $name = null,
int $indent = null
) {
$model = new Parser($yasql, $name);
$view = new Generator($model, $indent);
return $view->output();
} | php | public static function generate(
string $yasql,
string $name = null,
int $indent = null
) {
$model = new Parser($yasql, $name);
$view = new Generator($model, $indent);
return $view->output();
} | [
"public",
"static",
"function",
"generate",
"(",
"string",
"$",
"yasql",
",",
"string",
"$",
"name",
"=",
"null",
",",
"int",
"$",
"indent",
"=",
"null",
")",
"{",
"$",
"model",
"=",
"new",
"Parser",
"(",
"$",
"yasql",
",",
"$",
"name",
")",
";",
... | Generates the SQL from a YASQL
@param string $yasql A string following YAML Ain't SQL specifications
@param string $name Overwrite database's name
@param int $indent How many spaces per indentation level
@return string | [
"Generates",
"the",
"SQL",
"from",
"a",
"YASQL"
] | train | https://github.com/aryelgois/yasql-php/blob/f428b180d35bfc1ddf1f9b3323f9b085fbc09ac7/src/Controller.php#L55-L63 |
aryelgois/yasql-php | src/Controller.php | Controller.parse | public static function parse(string $yasql, string $name = null)
{
$parser = new Parser($yasql, $name);
return $parser->getData();
} | php | public static function parse(string $yasql, string $name = null)
{
$parser = new Parser($yasql, $name);
return $parser->getData();
} | [
"public",
"static",
"function",
"parse",
"(",
"string",
"$",
"yasql",
",",
"string",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"parser",
"=",
"new",
"Parser",
"(",
"$",
"yasql",
",",
"$",
"name",
")",
";",
"return",
"$",
"parser",
"->",
"getData",
"... | Parses a YASQL and returns the parsed data
@param string $yasql A string following YAML Ain't SQL specifications
@param string $name Overwrite database's name
@return array | [
"Parses",
"a",
"YASQL",
"and",
"returns",
"the",
"parsed",
"data"
] | train | https://github.com/aryelgois/yasql-php/blob/f428b180d35bfc1ddf1f9b3323f9b085fbc09ac7/src/Controller.php#L73-L77 |
aedart/laravel-helpers | src/Traits/Mail/MailerTrait.php | MailerTrait.getMailer | public function getMailer(): ?Mailer
{
if (!$this->hasMailer()) {
$this->setMailer($this->getDefaultMailer());
}
return $this->mailer;
} | php | public function getMailer(): ?Mailer
{
if (!$this->hasMailer()) {
$this->setMailer($this->getDefaultMailer());
}
return $this->mailer;
} | [
"public",
"function",
"getMailer",
"(",
")",
":",
"?",
"Mailer",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasMailer",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setMailer",
"(",
"$",
"this",
"->",
"getDefaultMailer",
"(",
")",
")",
";",
"}",
"return",... | Get mailer
If no mailer has been set, this method will
set and return a default mailer, if any such
value is available
@see getDefaultMailer()
@return Mailer|null mailer or null if none mailer has been set | [
"Get",
"mailer"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Mail/MailerTrait.php#L53-L59 |
aedart/laravel-helpers | src/Traits/Cache/CacheFactoryTrait.php | CacheFactoryTrait.getCacheFactory | public function getCacheFactory(): ?Factory
{
if (!$this->hasCacheFactory()) {
$this->setCacheFactory($this->getDefaultCacheFactory());
}
return $this->cacheFactory;
} | php | public function getCacheFactory(): ?Factory
{
if (!$this->hasCacheFactory()) {
$this->setCacheFactory($this->getDefaultCacheFactory());
}
return $this->cacheFactory;
} | [
"public",
"function",
"getCacheFactory",
"(",
")",
":",
"?",
"Factory",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasCacheFactory",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setCacheFactory",
"(",
"$",
"this",
"->",
"getDefaultCacheFactory",
"(",
")",
")",
... | Get cache factory
If no cache factory has been set, this method will
set and return a default cache factory, if any such
value is available
@see getDefaultCacheFactory()
@return Factory|null cache factory or null if none cache factory has been set | [
"Get",
"cache",
"factory"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Cache/CacheFactoryTrait.php#L53-L59 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Atom.php | Zend_Feed_Atom.link | public function link($rel = null)
{
if ($rel === null) {
return parent::__call('link', null);
}
// index link tags by their "rel" attribute.
$links = parent::__get('link');
if (!is_array($links)) {
if ($links instanceof Zend_Feed_Element) {
... | php | public function link($rel = null)
{
if ($rel === null) {
return parent::__call('link', null);
}
// index link tags by their "rel" attribute.
$links = parent::__get('link');
if (!is_array($links)) {
if ($links instanceof Zend_Feed_Element) {
... | [
"public",
"function",
"link",
"(",
"$",
"rel",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"rel",
"===",
"null",
")",
"{",
"return",
"parent",
"::",
"__call",
"(",
"'link'",
",",
"null",
")",
";",
"}",
"// index link tags by their \"rel\" attribute.",
"$",
"l... | Easy access to <link> tags keyed by "rel" attributes.
If $elt->link() is called with no arguments, we will attempt to
return the value of the <link> tag(s) like all other
method-syntax attribute access. If an argument is passed to
link(), however, then we will return the "href" value of the
first <link> tag that has a... | [
"Easy",
"access",
"to",
"<link",
">",
"tags",
"keyed",
"by",
"rel",
"attributes",
"."
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Atom.php#L130-L156 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Atom.php | Zend_Feed_Atom._mapFeedHeaders | protected function _mapFeedHeaders($array)
{
$feed = $this->_element->createElement('feed');
$feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom');
$id = $this->_element->createElement('id', $array->link);
$feed->appendChild($id);
$title = $this->_element->createEleme... | php | protected function _mapFeedHeaders($array)
{
$feed = $this->_element->createElement('feed');
$feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom');
$id = $this->_element->createElement('id', $array->link);
$feed->appendChild($id);
$title = $this->_element->createEleme... | [
"protected",
"function",
"_mapFeedHeaders",
"(",
"$",
"array",
")",
"{",
"$",
"feed",
"=",
"$",
"this",
"->",
"_element",
"->",
"createElement",
"(",
"'feed'",
")",
";",
"$",
"feed",
"->",
"setAttribute",
"(",
"'xmlns'",
",",
"'http://www.w3.org/2005/Atom'",
... | Generate the header of the feed when working in write mode
@param array $array the data to use
@return DOMElement root node | [
"Generate",
"the",
"header",
"of",
"the",
"feed",
"when",
"working",
"in",
"write",
"mode"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Atom.php#L189-L250 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Atom.php | Zend_Feed_Atom._mapFeedEntries | protected function _mapFeedEntries(DOMElement $root, $array)
{
foreach ($array as $dataentry) {
$entry = $this->_element->createElement('entry');
$id = $this->_element->createElement('id', isset($dataentry->guid) ? $dataentry->guid : $dataentry->link);
$entry->appendChil... | php | protected function _mapFeedEntries(DOMElement $root, $array)
{
foreach ($array as $dataentry) {
$entry = $this->_element->createElement('entry');
$id = $this->_element->createElement('id', isset($dataentry->guid) ? $dataentry->guid : $dataentry->link);
$entry->appendChil... | [
"protected",
"function",
"_mapFeedEntries",
"(",
"DOMElement",
"$",
"root",
",",
"$",
"array",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"dataentry",
")",
"{",
"$",
"entry",
"=",
"$",
"this",
"->",
"_element",
"->",
"createElement",
"(",
"'entry... | Generate the entries of the feed when working in write mode
The following nodes are constructed for each feed entry
<entry>
<id>url to feed entry</id>
<title>entry title</title>
<updated>last update</updated>
<link rel="alternate" href="url to feed entry" />
<summary>short text</summary>
<content>long version, can con... | [
"Generate",
"the",
"entries",
"of",
"the",
"feed",
"when",
"working",
"in",
"write",
"mode"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Atom.php#L269-L352 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Atom.php | Zend_Feed_Atom.saveXml | public function saveXml()
{
// Return a complete document including XML prologue.
$doc = new DOMDocument($this->_element->ownerDocument->version,
$this->_element->ownerDocument->actualEncoding);
$doc->appendChild($doc->importNode($this->_element, true));
... | php | public function saveXml()
{
// Return a complete document including XML prologue.
$doc = new DOMDocument($this->_element->ownerDocument->version,
$this->_element->ownerDocument->actualEncoding);
$doc->appendChild($doc->importNode($this->_element, true));
... | [
"public",
"function",
"saveXml",
"(",
")",
"{",
"// Return a complete document including XML prologue.",
"$",
"doc",
"=",
"new",
"DOMDocument",
"(",
"$",
"this",
"->",
"_element",
"->",
"ownerDocument",
"->",
"version",
",",
"$",
"this",
"->",
"_element",
"->",
... | Override Zend_Feed_Element to allow formated feeds
@return string | [
"Override",
"Zend_Feed_Element",
"to",
"allow",
"formated",
"feeds"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Atom.php#L359-L368 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Atom.php | Zend_Feed_Atom.send | public function send()
{
if (headers_sent()) {
/**
* @see Zend_Feed_Exception
*/
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Cannot send ATOM because headers have already been sent.');
}
header('Conten... | php | public function send()
{
if (headers_sent()) {
/**
* @see Zend_Feed_Exception
*/
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Cannot send ATOM because headers have already been sent.');
}
header('Conten... | [
"public",
"function",
"send",
"(",
")",
"{",
"if",
"(",
"headers_sent",
"(",
")",
")",
"{",
"/** \n * @see Zend_Feed_Exception\n */",
"require_once",
"'Zend/Feed/Exception.php'",
";",
"throw",
"new",
"Zend_Feed_Exception",
"(",
"'Cannot send ATOM bec... | Send feed to a http client with the correct header
@return void
@throws Zend_Feed_Exception if headers have already been sent | [
"Send",
"feed",
"to",
"a",
"http",
"client",
"with",
"the",
"correct",
"header"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Atom.php#L376-L389 |
hisorange/traits | src/RunTimeCache.php | RunTimeCache.runTimeCacheGet | public function runTimeCacheGet($key, $default = null)
{
// Is this key exists?
if (array_key_exists($key, $this->runTimeCache)) {
return $this->runTimeCache[$key];
}
return $default;
} | php | public function runTimeCacheGet($key, $default = null)
{
// Is this key exists?
if (array_key_exists($key, $this->runTimeCache)) {
return $this->runTimeCache[$key];
}
return $default;
} | [
"public",
"function",
"runTimeCacheGet",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"// Is this key exists?",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"runTimeCache",
")",
")",
"{",
"return",
"$",
"this",
... | Get a value from the cache.
@param string $key
@param mixed $default
@return mixed | [
"Get",
"a",
"value",
"from",
"the",
"cache",
"."
] | train | https://github.com/hisorange/traits/blob/465baf32faaf155b867dcc11218621e23ef4cac2/src/RunTimeCache.php#L43-L51 |
GrahamDeprecated/CMS-Core | src/migrations/2013_11_16_115153_add_stuff_to_pages.php | AddStuffToPages.up | public function up()
{
Schema::table('pages', function ($table) {
$table->text('css')->default('');
$table->text('js')->default('');
});
foreach (PageProvider::all() as $page) {
$page->update(array('css' => '', 'js' => ''));
}
} | php | public function up()
{
Schema::table('pages', function ($table) {
$table->text('css')->default('');
$table->text('js')->default('');
});
foreach (PageProvider::all() as $page) {
$page->update(array('css' => '', 'js' => ''));
}
} | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"table",
"(",
"'pages'",
",",
"function",
"(",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"text",
"(",
"'css'",
")",
"->",
"default",
"(",
"''",
")",
";",
"$",
"table",
"->",
"text",
"("... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/migrations/2013_11_16_115153_add_stuff_to_pages.php#L37-L47 |
lmammino/e-foundation | src/Cart/Model/CartAdjustment.php | CartAdjustment.setAdjustable | public function setAdjustable(AdjustableInterface $adjustable = null)
{
$this->adjustable = $this->cart = $adjustable;
return $this;
} | php | public function setAdjustable(AdjustableInterface $adjustable = null)
{
$this->adjustable = $this->cart = $adjustable;
return $this;
} | [
"public",
"function",
"setAdjustable",
"(",
"AdjustableInterface",
"$",
"adjustable",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"adjustable",
"=",
"$",
"this",
"->",
"cart",
"=",
"$",
"adjustable",
";",
"return",
"$",
"this",
";",
"}"
] | {@inheritDoc} | [
"{"
] | train | https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Cart/Model/CartAdjustment.php#L39-L44 |
yuncms/framework | src/rest/models/UserBindMobileForm.php | UserBindMobileForm.bind | public function bind()
{
if ($this->validate() && ($user = $this->getUser()) != null) {
$user->updateAttributes(['mobile' => $this->mobile, 'mobile_confirmed_at' => time()]);
return $user;
}
return false;
} | php | public function bind()
{
if ($this->validate() && ($user = $this->getUser()) != null) {
$user->updateAttributes(['mobile' => $this->mobile, 'mobile_confirmed_at' => time()]);
return $user;
}
return false;
} | [
"public",
"function",
"bind",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
"&&",
"(",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
")",
"!=",
"null",
")",
"{",
"$",
"user",
"->",
"updateAttributes",
"(",
"[",
... | 绑定手机
@return bool|User | [
"绑定手机"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/models/UserBindMobileForm.php#L72-L79 |
VincentChalnot/SidusAdminBundle | Doctrine/DoctrineHelper.php | DoctrineHelper.getManagerForEntity | public function getManagerForEntity($entity): EntityManagerInterface
{
$class = ClassUtils::getClass($entity);
$entityManager = $this->doctrine->getManagerForClass($class);
if (!$entityManager instanceof EntityManagerInterface) {
throw new \InvalidArgumentException("No manager fo... | php | public function getManagerForEntity($entity): EntityManagerInterface
{
$class = ClassUtils::getClass($entity);
$entityManager = $this->doctrine->getManagerForClass($class);
if (!$entityManager instanceof EntityManagerInterface) {
throw new \InvalidArgumentException("No manager fo... | [
"public",
"function",
"getManagerForEntity",
"(",
"$",
"entity",
")",
":",
"EntityManagerInterface",
"{",
"$",
"class",
"=",
"ClassUtils",
"::",
"getClass",
"(",
"$",
"entity",
")",
";",
"$",
"entityManager",
"=",
"$",
"this",
"->",
"doctrine",
"->",
"getMan... | @param mixed $entity
@throws \LogicException
@return EntityManagerInterface | [
"@param",
"mixed",
"$entity"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Doctrine/DoctrineHelper.php#L49-L58 |
weew/url | src/Weew/Url/UrlBuilder.php | UrlBuilder.build | public function build(IUrl $url, $encode = false) {
$pattern = $this->pattern;
$pattern = $this->setProtocol($pattern, $url, $encode);
$pattern = $this->setCredentials($pattern, $url, $encode);
$pattern = $this->setHost($pattern, $url, $encode);
$pattern = $this->setPort($pattern... | php | public function build(IUrl $url, $encode = false) {
$pattern = $this->pattern;
$pattern = $this->setProtocol($pattern, $url, $encode);
$pattern = $this->setCredentials($pattern, $url, $encode);
$pattern = $this->setHost($pattern, $url, $encode);
$pattern = $this->setPort($pattern... | [
"public",
"function",
"build",
"(",
"IUrl",
"$",
"url",
",",
"$",
"encode",
"=",
"false",
")",
"{",
"$",
"pattern",
"=",
"$",
"this",
"->",
"pattern",
";",
"$",
"pattern",
"=",
"$",
"this",
"->",
"setProtocol",
"(",
"$",
"pattern",
",",
"$",
"url",... | @param IUrl $url
@param bool $encode
@return string | [
"@param",
"IUrl",
"$url",
"@param",
"bool",
"$encode"
] | train | https://github.com/weew/url/blob/117be15e899cc343f22f04f5eb9e92e2164c56c1/src/Weew/Url/UrlBuilder.php#L17-L28 |
weew/url | src/Weew/Url/UrlBuilder.php | UrlBuilder.buildHost | public function buildHost($tld, $domain, $subdomain) {
$parts = [];
if ($tld !== null) {
array_unshift($parts, $tld);
}
if ($domain !== null) {
array_unshift($parts, $domain);
}
if ($subdomain !== null) {
array_unshift($parts, $subdo... | php | public function buildHost($tld, $domain, $subdomain) {
$parts = [];
if ($tld !== null) {
array_unshift($parts, $tld);
}
if ($domain !== null) {
array_unshift($parts, $domain);
}
if ($subdomain !== null) {
array_unshift($parts, $subdo... | [
"public",
"function",
"buildHost",
"(",
"$",
"tld",
",",
"$",
"domain",
",",
"$",
"subdomain",
")",
"{",
"$",
"parts",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"tld",
"!==",
"null",
")",
"{",
"array_unshift",
"(",
"$",
"parts",
",",
"$",
"tld",
")",
... | @param string $tld
@param string $domain
@param string $subdomain
@return string | [
"@param",
"string",
"$tld",
"@param",
"string",
"$domain",
"@param",
"string",
"$subdomain"
] | train | https://github.com/weew/url/blob/117be15e899cc343f22f04f5eb9e92e2164c56c1/src/Weew/Url/UrlBuilder.php#L37-L55 |
weew/url | src/Weew/Url/UrlBuilder.php | UrlBuilder.setProtocol | protected function setProtocol($pattern, IUrl $url, $encode = false, $key = ':scheme') {
$scheme = $url->getProtocol();
if ($scheme) {
$scheme = s('%s://', $scheme);
}
$pattern = s($pattern, [$key => $scheme]);
return $pattern;
} | php | protected function setProtocol($pattern, IUrl $url, $encode = false, $key = ':scheme') {
$scheme = $url->getProtocol();
if ($scheme) {
$scheme = s('%s://', $scheme);
}
$pattern = s($pattern, [$key => $scheme]);
return $pattern;
} | [
"protected",
"function",
"setProtocol",
"(",
"$",
"pattern",
",",
"IUrl",
"$",
"url",
",",
"$",
"encode",
"=",
"false",
",",
"$",
"key",
"=",
"':scheme'",
")",
"{",
"$",
"scheme",
"=",
"$",
"url",
"->",
"getProtocol",
"(",
")",
";",
"if",
"(",
"$",... | @param string $pattern
@param IUrl $url
@param bool $encode
@param string $key
@return string | [
"@param",
"string",
"$pattern",
"@param",
"IUrl",
"$url",
"@param",
"bool",
"$encode",
"@param",
"string",
"$key"
] | train | https://github.com/weew/url/blob/117be15e899cc343f22f04f5eb9e92e2164c56c1/src/Weew/Url/UrlBuilder.php#L65-L75 |
weew/url | src/Weew/Url/UrlBuilder.php | UrlBuilder.setCredentials | protected function setCredentials($pattern, IUrl $url, $encode = false, $key = ':credentials') {
$username = $url->getUsername();
$password = $url->getPassword();
$credentials = '';
if ($encode) {
$username = rawurlencode($username);
$password = rawurlencode($pas... | php | protected function setCredentials($pattern, IUrl $url, $encode = false, $key = ':credentials') {
$username = $url->getUsername();
$password = $url->getPassword();
$credentials = '';
if ($encode) {
$username = rawurlencode($username);
$password = rawurlencode($pas... | [
"protected",
"function",
"setCredentials",
"(",
"$",
"pattern",
",",
"IUrl",
"$",
"url",
",",
"$",
"encode",
"=",
"false",
",",
"$",
"key",
"=",
"':credentials'",
")",
"{",
"$",
"username",
"=",
"$",
"url",
"->",
"getUsername",
"(",
")",
";",
"$",
"p... | @param string $pattern
@param IUrl $url
@param bool $encode
@param string $key
@return string | [
"@param",
"string",
"$pattern",
"@param",
"IUrl",
"$url",
"@param",
"bool",
"$encode",
"@param",
"string",
"$key"
] | train | https://github.com/weew/url/blob/117be15e899cc343f22f04f5eb9e92e2164c56c1/src/Weew/Url/UrlBuilder.php#L85-L102 |
weew/url | src/Weew/Url/UrlBuilder.php | UrlBuilder.setHost | protected function setHost($pattern, IUrl $url, $encode = false, $key = ':host') {
$host = $url->getHost();
$pattern = s($pattern, [$key => $host]);
return $pattern;
} | php | protected function setHost($pattern, IUrl $url, $encode = false, $key = ':host') {
$host = $url->getHost();
$pattern = s($pattern, [$key => $host]);
return $pattern;
} | [
"protected",
"function",
"setHost",
"(",
"$",
"pattern",
",",
"IUrl",
"$",
"url",
",",
"$",
"encode",
"=",
"false",
",",
"$",
"key",
"=",
"':host'",
")",
"{",
"$",
"host",
"=",
"$",
"url",
"->",
"getHost",
"(",
")",
";",
"$",
"pattern",
"=",
"s",... | @param string $pattern
@param IUrl $url
@param bool $encode
@param string $key
@return string | [
"@param",
"string",
"$pattern",
"@param",
"IUrl",
"$url",
"@param",
"bool",
"$encode",
"@param",
"string",
"$key"
] | train | https://github.com/weew/url/blob/117be15e899cc343f22f04f5eb9e92e2164c56c1/src/Weew/Url/UrlBuilder.php#L112-L117 |
weew/url | src/Weew/Url/UrlBuilder.php | UrlBuilder.setPort | protected function setPort($pattern, IUrl $url, $encode = false, $key = ':port') {
$port = $url->getPort();
if ($port) {
$port = s(':%s', $port);
}
$pattern = s($pattern, [$key => $port]);
return $pattern;
} | php | protected function setPort($pattern, IUrl $url, $encode = false, $key = ':port') {
$port = $url->getPort();
if ($port) {
$port = s(':%s', $port);
}
$pattern = s($pattern, [$key => $port]);
return $pattern;
} | [
"protected",
"function",
"setPort",
"(",
"$",
"pattern",
",",
"IUrl",
"$",
"url",
",",
"$",
"encode",
"=",
"false",
",",
"$",
"key",
"=",
"':port'",
")",
"{",
"$",
"port",
"=",
"$",
"url",
"->",
"getPort",
"(",
")",
";",
"if",
"(",
"$",
"port",
... | @param string $pattern
@param IUrl $url
@param bool $encode
@param string $key
@return string | [
"@param",
"string",
"$pattern",
"@param",
"IUrl",
"$url",
"@param",
"bool",
"$encode",
"@param",
"string",
"$key"
] | train | https://github.com/weew/url/blob/117be15e899cc343f22f04f5eb9e92e2164c56c1/src/Weew/Url/UrlBuilder.php#L127-L137 |
weew/url | src/Weew/Url/UrlBuilder.php | UrlBuilder.setPath | protected function setPath($pattern, IUrl $url, $encode = false, $key = ':path') {
$path = $url->getPath();
$pattern = s($pattern, [$key => $path]);
return $pattern;
} | php | protected function setPath($pattern, IUrl $url, $encode = false, $key = ':path') {
$path = $url->getPath();
$pattern = s($pattern, [$key => $path]);
return $pattern;
} | [
"protected",
"function",
"setPath",
"(",
"$",
"pattern",
",",
"IUrl",
"$",
"url",
",",
"$",
"encode",
"=",
"false",
",",
"$",
"key",
"=",
"':path'",
")",
"{",
"$",
"path",
"=",
"$",
"url",
"->",
"getPath",
"(",
")",
";",
"$",
"pattern",
"=",
"s",... | @param string $pattern
@param IUrl $url
@param bool $encode
@param string $key
@return string | [
"@param",
"string",
"$pattern",
"@param",
"IUrl",
"$url",
"@param",
"bool",
"$encode",
"@param",
"string",
"$key"
] | train | https://github.com/weew/url/blob/117be15e899cc343f22f04f5eb9e92e2164c56c1/src/Weew/Url/UrlBuilder.php#L147-L152 |
weew/url | src/Weew/Url/UrlBuilder.php | UrlBuilder.setQuery | protected function setQuery($pattern, IUrl $url, $encode = false, $key = ':query') {
$query = $url->getQuery()->toString($encode);
if ($query) {
$query = s('?%s', $query);
}
$pattern = s($pattern, [$key => $query]);
return $pattern;
} | php | protected function setQuery($pattern, IUrl $url, $encode = false, $key = ':query') {
$query = $url->getQuery()->toString($encode);
if ($query) {
$query = s('?%s', $query);
}
$pattern = s($pattern, [$key => $query]);
return $pattern;
} | [
"protected",
"function",
"setQuery",
"(",
"$",
"pattern",
",",
"IUrl",
"$",
"url",
",",
"$",
"encode",
"=",
"false",
",",
"$",
"key",
"=",
"':query'",
")",
"{",
"$",
"query",
"=",
"$",
"url",
"->",
"getQuery",
"(",
")",
"->",
"toString",
"(",
"$",
... | @param string $pattern
@param IUrl $url
@param bool $encode
@param string $key
@return string | [
"@param",
"string",
"$pattern",
"@param",
"IUrl",
"$url",
"@param",
"bool",
"$encode",
"@param",
"string",
"$key"
] | train | https://github.com/weew/url/blob/117be15e899cc343f22f04f5eb9e92e2164c56c1/src/Weew/Url/UrlBuilder.php#L162-L172 |
weew/url | src/Weew/Url/UrlBuilder.php | UrlBuilder.setFragment | protected function setFragment($pattern, IUrl $url, $encode = false, $key = ':fragment') {
$fragment = $url->getFragment();
if ($fragment) {
$fragment = s('#%s', $fragment);
}
$pattern = s($pattern, [$key => $fragment]);
return $pattern;
} | php | protected function setFragment($pattern, IUrl $url, $encode = false, $key = ':fragment') {
$fragment = $url->getFragment();
if ($fragment) {
$fragment = s('#%s', $fragment);
}
$pattern = s($pattern, [$key => $fragment]);
return $pattern;
} | [
"protected",
"function",
"setFragment",
"(",
"$",
"pattern",
",",
"IUrl",
"$",
"url",
",",
"$",
"encode",
"=",
"false",
",",
"$",
"key",
"=",
"':fragment'",
")",
"{",
"$",
"fragment",
"=",
"$",
"url",
"->",
"getFragment",
"(",
")",
";",
"if",
"(",
... | @param string $pattern
@param IUrl $url
@param bool $encode
@param string $key
@return string | [
"@param",
"string",
"$pattern",
"@param",
"IUrl",
"$url",
"@param",
"bool",
"$encode",
"@param",
"string",
"$key"
] | train | https://github.com/weew/url/blob/117be15e899cc343f22f04f5eb9e92e2164c56c1/src/Weew/Url/UrlBuilder.php#L182-L192 |
ronanguilloux/SilexMarkdownServiceProvider | src/Rg/Markdown/MarkdownExtended.php | MarkdownExtended.getTitle | public function getTitle($markdown)
{
$html = "<xml>" . self::transform($markdown) . "</xml>";
$dom = new \DOMDocument;
$dom->loadXml($html);
return $dom->getElementsByTagName('h1')->item(0)->nodeValue;
} | php | public function getTitle($markdown)
{
$html = "<xml>" . self::transform($markdown) . "</xml>";
$dom = new \DOMDocument;
$dom->loadXml($html);
return $dom->getElementsByTagName('h1')->item(0)->nodeValue;
} | [
"public",
"function",
"getTitle",
"(",
"$",
"markdown",
")",
"{",
"$",
"html",
"=",
"\"<xml>\"",
".",
"self",
"::",
"transform",
"(",
"$",
"markdown",
")",
".",
"\"</xml>\"",
";",
"$",
"dom",
"=",
"new",
"\\",
"DOMDocument",
";",
"$",
"dom",
"->",
"l... | getTitle
Returns title
from a markdown source
eventually containing "====" underlined label,
usually parsed as <h1>
@param string $markdown
@return string $title | [
"getTitle",
"Returns",
"title",
"from",
"a",
"markdown",
"source",
"eventually",
"containing",
"====",
"underlined",
"label",
"usually",
"parsed",
"as",
"<h1",
">"
] | train | https://github.com/ronanguilloux/SilexMarkdownServiceProvider/blob/8266baf0b8a74a98ea32ba1417d767dca6b374b3/src/Rg/Markdown/MarkdownExtended.php#L36-L43 |
aedart/laravel-helpers | src/Traits/Redis/RedisFactoryTrait.php | RedisFactoryTrait.getRedisFactory | public function getRedisFactory(): ?Factory
{
if (!$this->hasRedisFactory()) {
$this->setRedisFactory($this->getDefaultRedisFactory());
}
return $this->redisFactory;
} | php | public function getRedisFactory(): ?Factory
{
if (!$this->hasRedisFactory()) {
$this->setRedisFactory($this->getDefaultRedisFactory());
}
return $this->redisFactory;
} | [
"public",
"function",
"getRedisFactory",
"(",
")",
":",
"?",
"Factory",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRedisFactory",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setRedisFactory",
"(",
"$",
"this",
"->",
"getDefaultRedisFactory",
"(",
")",
")",
... | Get redis factory
If no redis factory has been set, this method will
set and return a default redis factory, if any such
value is available
@see getDefaultRedisFactory()
@return Factory|null redis factory or null if none redis factory has been set | [
"Get",
"redis",
"factory"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Redis/RedisFactoryTrait.php#L53-L59 |
redaigbaria/oauth2 | src/Util/KeyAlgorithm/DefaultAlgorithm.php | DefaultAlgorithm.generate | public function generate($len = 40)
{
$stripped = '';
do {
$bytes = openssl_random_pseudo_bytes($len, $strong);
// We want to stop execution if the key fails because, well, that is bad.
if ($bytes === false || $strong === false) {
// @codeCoverage... | php | public function generate($len = 40)
{
$stripped = '';
do {
$bytes = openssl_random_pseudo_bytes($len, $strong);
// We want to stop execution if the key fails because, well, that is bad.
if ($bytes === false || $strong === false) {
// @codeCoverage... | [
"public",
"function",
"generate",
"(",
"$",
"len",
"=",
"40",
")",
"{",
"$",
"stripped",
"=",
"''",
";",
"do",
"{",
"$",
"bytes",
"=",
"openssl_random_pseudo_bytes",
"(",
"$",
"len",
",",
"$",
"strong",
")",
";",
"// We want to stop execution if the key fail... | {@inheritdoc} | [
"{"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Util/KeyAlgorithm/DefaultAlgorithm.php#L19-L35 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRelationInterfaceBuilder.php | EntityRelationInterfaceBuilder.buildSource | public function buildSource(GClass $gClass) {
if ($this->relation->isWithoutInterface()) {
return FALSE;
}
if ($this->relation->getType() === EntityRelation::ONE_TO_MANY || $this->relation->getType() === EntityRelation::MANY_TO_MANY) {
$this->createCollectionAdder($gClass);
$this->cre... | php | public function buildSource(GClass $gClass) {
if ($this->relation->isWithoutInterface()) {
return FALSE;
}
if ($this->relation->getType() === EntityRelation::ONE_TO_MANY || $this->relation->getType() === EntityRelation::MANY_TO_MANY) {
$this->createCollectionAdder($gClass);
$this->cre... | [
"public",
"function",
"buildSource",
"(",
"GClass",
"$",
"gClass",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"relation",
"->",
"isWithoutInterface",
"(",
")",
")",
"{",
"return",
"FALSE",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"relation",
"->",
"getType... | Erstellt alle Methoden des RelationInterfaces in der Angegebenen Klasse für die Source Seite | [
"Erstellt",
"alle",
"Methoden",
"des",
"RelationInterfaces",
"in",
"der",
"Angegebenen",
"Klasse",
"für",
"die",
"Source",
"Seite"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRelationInterfaceBuilder.php#L26-L40 |
djgadd/themosis-illuminate | src/Validation/ValidationServiceProvider.php | ValidationServiceProvider.boot | public function boot ()
{
ValidatorFacade::extend('valid_nonce', function ($attaribute, $value, $params, $validator) {
$action = $params[0];
return (bool) wp_verify_nonce($value, $action);
});
} | php | public function boot ()
{
ValidatorFacade::extend('valid_nonce', function ($attaribute, $value, $params, $validator) {
$action = $params[0];
return (bool) wp_verify_nonce($value, $action);
});
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"ValidatorFacade",
"::",
"extend",
"(",
"'valid_nonce'",
",",
"function",
"(",
"$",
"attaribute",
",",
"$",
"value",
",",
"$",
"params",
",",
"$",
"validator",
")",
"{",
"$",
"action",
"=",
"$",
"params",
"[... | Add valid_nonce validation rule
@return void | [
"Add",
"valid_nonce",
"validation",
"rule"
] | train | https://github.com/djgadd/themosis-illuminate/blob/13ee4c3413cddd85a2f262ac361f35c81da0c53c/src/Validation/ValidationServiceProvider.php#L23-L29 |
ppetermann/king23 | src/Mongo/Result.php | Result.current | public function current()
{
$documentData = $this->myResultCursor->current();
if (is_null($documentData)) {
return null;
}
/** @var MongoObject $document */
$document = $this->container->get(
$this->classMapInterface->getClassForResult($this->collecti... | php | public function current()
{
$documentData = $this->myResultCursor->current();
if (is_null($documentData)) {
return null;
}
/** @var MongoObject $document */
$document = $this->container->get(
$this->classMapInterface->getClassForResult($this->collecti... | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"documentData",
"=",
"$",
"this",
"->",
"myResultCursor",
"->",
"current",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"documentData",
")",
")",
"{",
"return",
"null",
";",
"}",
"/** @var MongoObjec... | Iterator::current
return current specific object
@return MongoObject
@throws Exception
@throws \MongoException | [
"Iterator",
"::",
"current",
"return",
"current",
"specific",
"object"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Mongo/Result.php#L124-L139 |
gibilogic/crud-bundle | Entity/EntityRepository.php | EntityRepository.getEntity | public function getEntity($id, $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{
return $this->getQueryBuilder(['id' => $id])
->getQuery()
->setMaxResults(1)
->getOneOrNullResult($hydrationMode);
} | php | public function getEntity($id, $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{
return $this->getQueryBuilder(['id' => $id])
->getQuery()
->setMaxResults(1)
->getOneOrNullResult($hydrationMode);
} | [
"public",
"function",
"getEntity",
"(",
"$",
"id",
",",
"$",
"hydrationMode",
"=",
"AbstractQuery",
"::",
"HYDRATE_OBJECT",
")",
"{",
"return",
"$",
"this",
"->",
"getQueryBuilder",
"(",
"[",
"'id'",
"=>",
"$",
"id",
"]",
")",
"->",
"getQuery",
"(",
")",... | Returns an entity by its ID.
@param mixed $id
@param integer $hydrationMode
@return mixed
@deprecated Deprecated since 2.0.4; to be removed in 3.0.0. Use the basic `find()` method instead | [
"Returns",
"an",
"entity",
"by",
"its",
"ID",
"."
] | train | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityRepository.php#L37-L43 |
gibilogic/crud-bundle | Entity/EntityRepository.php | EntityRepository.getEntitiesById | public function getEntitiesById(array $ids, $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{
return $this->getQueryBuilder(['id' => $ids])
->getQuery()
->execute(null, $hydrationMode);
} | php | public function getEntitiesById(array $ids, $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{
return $this->getQueryBuilder(['id' => $ids])
->getQuery()
->execute(null, $hydrationMode);
} | [
"public",
"function",
"getEntitiesById",
"(",
"array",
"$",
"ids",
",",
"$",
"hydrationMode",
"=",
"AbstractQuery",
"::",
"HYDRATE_OBJECT",
")",
"{",
"return",
"$",
"this",
"->",
"getQueryBuilder",
"(",
"[",
"'id'",
"=>",
"$",
"ids",
"]",
")",
"->",
"getQu... | Returns a list of entities extracted by their IDs.
@param array $ids
@param integer $hydrationMode
@return array | [
"Returns",
"a",
"list",
"of",
"entities",
"extracted",
"by",
"their",
"IDs",
"."
] | train | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityRepository.php#L65-L70 |
gibilogic/crud-bundle | Entity/EntityRepository.php | EntityRepository.getEntities | public function getEntities(array $options = [], $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{
$options = EntityRepositoryOptionsResolver::createAndResolve($options);
return $this->getQueryBuilder($options['filters'], $options['sorting'])
->getQuery()
->execute(null, $hyd... | php | public function getEntities(array $options = [], $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{
$options = EntityRepositoryOptionsResolver::createAndResolve($options);
return $this->getQueryBuilder($options['filters'], $options['sorting'])
->getQuery()
->execute(null, $hyd... | [
"public",
"function",
"getEntities",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"hydrationMode",
"=",
"AbstractQuery",
"::",
"HYDRATE_OBJECT",
")",
"{",
"$",
"options",
"=",
"EntityRepositoryOptionsResolver",
"::",
"createAndResolve",
"(",
"$",
"opti... | Returns a list of all the entities.
@param array $options
@param integer $hydrationMode
@return array | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"entities",
"."
] | train | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityRepository.php#L79-L85 |
gibilogic/crud-bundle | Entity/EntityRepository.php | EntityRepository.getPaginatedEntities | public function getPaginatedEntities(array $options = [], $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{
$options = PaginatedEntityRepositoryOptionsResolver::createAndResolve($options);
$queryBuilder = $this->addPagination(
$this->getQueryBuilder($options['filters'], $options['sorting... | php | public function getPaginatedEntities(array $options = [], $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{
$options = PaginatedEntityRepositoryOptionsResolver::createAndResolve($options);
$queryBuilder = $this->addPagination(
$this->getQueryBuilder($options['filters'], $options['sorting... | [
"public",
"function",
"getPaginatedEntities",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"hydrationMode",
"=",
"AbstractQuery",
"::",
"HYDRATE_OBJECT",
")",
"{",
"$",
"options",
"=",
"PaginatedEntityRepositoryOptionsResolver",
"::",
"createAndResolve",
"... | Returns a paginated list of entities.
@param array $options
@param integer $hydrationMode
@return \Doctrine\ORM\Tools\Pagination\Paginator | [
"Returns",
"a",
"paginated",
"list",
"of",
"entities",
"."
] | train | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityRepository.php#L94-L104 |
gibilogic/crud-bundle | Entity/EntityRepository.php | EntityRepository.getQueryBuilder | protected function getQueryBuilder(array $filters = [], array $sorting = [])
{
$queryBuilder = $this->getBaseQueryBuilder();
if (!empty($filters)) {
$this->addFilters($queryBuilder, $filters);
}
if (empty($sorting)) {
$this->addSorting($queryBuilder, $this->g... | php | protected function getQueryBuilder(array $filters = [], array $sorting = [])
{
$queryBuilder = $this->getBaseQueryBuilder();
if (!empty($filters)) {
$this->addFilters($queryBuilder, $filters);
}
if (empty($sorting)) {
$this->addSorting($queryBuilder, $this->g... | [
"protected",
"function",
"getQueryBuilder",
"(",
"array",
"$",
"filters",
"=",
"[",
"]",
",",
"array",
"$",
"sorting",
"=",
"[",
"]",
")",
"{",
"$",
"queryBuilder",
"=",
"$",
"this",
"->",
"getBaseQueryBuilder",
"(",
")",
";",
"if",
"(",
"!",
"empty",
... | Returns a complete QueryBuilder instance for the current entity.
@param array $filters
@param array $sorting
@return \Doctrine\ORM\QueryBuilder | [
"Returns",
"a",
"complete",
"QueryBuilder",
"instance",
"for",
"the",
"current",
"entity",
"."
] | train | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityRepository.php#L113-L127 |
gibilogic/crud-bundle | Entity/EntityRepository.php | EntityRepository.addFilters | protected function addFilters(QueryBuilder $queryBuilder, $filters = array())
{
foreach ($filters as $field => $value) {
$methodName = sprintf('add%sFilter', ucfirst($field));
if (method_exists($this, $methodName)) {
// This field has a custom filtering method
... | php | protected function addFilters(QueryBuilder $queryBuilder, $filters = array())
{
foreach ($filters as $field => $value) {
$methodName = sprintf('add%sFilter', ucfirst($field));
if (method_exists($this, $methodName)) {
// This field has a custom filtering method
... | [
"protected",
"function",
"addFilters",
"(",
"QueryBuilder",
"$",
"queryBuilder",
",",
"$",
"filters",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"methodName",
"=",
"sprintf",
... | Adds filters to the QueryBuilder instance.
@param \Doctrine\ORM\QueryBuilder $queryBuilder
@param array $filters
@return \Doctrine\ORM\QueryBuilder | [
"Adds",
"filters",
"to",
"the",
"QueryBuilder",
"instance",
"."
] | train | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityRepository.php#L136-L160 |
gibilogic/crud-bundle | Entity/EntityRepository.php | EntityRepository.addSorting | protected function addSorting(QueryBuilder $queryBuilder, array $sorting = [])
{
foreach ($sorting as $field => $sortOrder) {
if (!$this->isFieldSortable($field)) {
// Skip: invalid field
continue;
}
if (!$this->isSortOrderValid($sortOrder)... | php | protected function addSorting(QueryBuilder $queryBuilder, array $sorting = [])
{
foreach ($sorting as $field => $sortOrder) {
if (!$this->isFieldSortable($field)) {
// Skip: invalid field
continue;
}
if (!$this->isSortOrderValid($sortOrder)... | [
"protected",
"function",
"addSorting",
"(",
"QueryBuilder",
"$",
"queryBuilder",
",",
"array",
"$",
"sorting",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"sorting",
"as",
"$",
"field",
"=>",
"$",
"sortOrder",
")",
"{",
"if",
"(",
"!",
"$",
"this",
... | Adds sorting to the specified query builder.
@param \Doctrine\ORM\QueryBuilder $queryBuilder
@param array $sorting
@return \Doctrine\ORM\QueryBuilder | [
"Adds",
"sorting",
"to",
"the",
"specified",
"query",
"builder",
"."
] | train | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityRepository.php#L169-L191 |
gibilogic/crud-bundle | Entity/EntityRepository.php | EntityRepository.addPagination | protected function addPagination(QueryBuilder $queryBuilder, $elementsPerPage, $page = 1)
{
$elementsPerPage = (int)$elementsPerPage;
$page = (int)$page;
return $queryBuilder
->setMaxResults($elementsPerPage)
->setFirstResult($elementsPerPage * ($page - 1));
} | php | protected function addPagination(QueryBuilder $queryBuilder, $elementsPerPage, $page = 1)
{
$elementsPerPage = (int)$elementsPerPage;
$page = (int)$page;
return $queryBuilder
->setMaxResults($elementsPerPage)
->setFirstResult($elementsPerPage * ($page - 1));
} | [
"protected",
"function",
"addPagination",
"(",
"QueryBuilder",
"$",
"queryBuilder",
",",
"$",
"elementsPerPage",
",",
"$",
"page",
"=",
"1",
")",
"{",
"$",
"elementsPerPage",
"=",
"(",
"int",
")",
"$",
"elementsPerPage",
";",
"$",
"page",
"=",
"(",
"int",
... | Adds pagination to the specified query builder.
@param \Doctrine\ORM\QueryBuilder $queryBuilder
@param integer $elementsPerPage
@param integer $page
@return \Doctrine\ORM\QueryBuilder | [
"Adds",
"pagination",
"to",
"the",
"specified",
"query",
"builder",
"."
] | train | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityRepository.php#L201-L209 |
gibilogic/crud-bundle | Entity/EntityRepository.php | EntityRepository.hasJoin | protected function hasJoin(QueryBuilder $queryBuilder, $joinString)
{
/* @var \Doctrine\ORM\Query\Expr\Join $joinExpression */
foreach ($queryBuilder->getDQLPart('join') as $joinsList) {
foreach ($joinsList as $joinExpression) {
if ($joinExpression->getJoin() == $joinStri... | php | protected function hasJoin(QueryBuilder $queryBuilder, $joinString)
{
/* @var \Doctrine\ORM\Query\Expr\Join $joinExpression */
foreach ($queryBuilder->getDQLPart('join') as $joinsList) {
foreach ($joinsList as $joinExpression) {
if ($joinExpression->getJoin() == $joinStri... | [
"protected",
"function",
"hasJoin",
"(",
"QueryBuilder",
"$",
"queryBuilder",
",",
"$",
"joinString",
")",
"{",
"/* @var \\Doctrine\\ORM\\Query\\Expr\\Join $joinExpression */",
"foreach",
"(",
"$",
"queryBuilder",
"->",
"getDQLPart",
"(",
"'join'",
")",
"as",
"$",
"jo... | Returns TRUE if the join string is already present inside the query builder, FALSE otherwise.
@param \Doctrine\ORM\QueryBuilder $queryBuilder
@param string $joinString
@return boolean | [
"Returns",
"TRUE",
"if",
"the",
"join",
"string",
"is",
"already",
"present",
"inside",
"the",
"query",
"builder",
"FALSE",
"otherwise",
"."
] | train | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityRepository.php#L218-L230 |
2amigos/yiifoundation | widgets/JoyRide.php | JoyRide.init | public function init()
{
$this->assets = array(
'js' => YII_DEBUG ? 'foundation/foundation.joyride.js' : 'foundation.min.js'
);
Html::addCssClass($this->htmlOptions, Enum::JOYRIDE_LIST);
ArrayHelper::addValue('data-joyride', 'data-joyride', $this->htmlOptions);
$... | php | public function init()
{
$this->assets = array(
'js' => YII_DEBUG ? 'foundation/foundation.joyride.js' : 'foundation.min.js'
);
Html::addCssClass($this->htmlOptions, Enum::JOYRIDE_LIST);
ArrayHelper::addValue('data-joyride', 'data-joyride', $this->htmlOptions);
$... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"assets",
"=",
"array",
"(",
"'js'",
"=>",
"YII_DEBUG",
"?",
"'foundation/foundation.joyride.js'",
":",
"'foundation.min.js'",
")",
";",
"Html",
"::",
"addCssClass",
"(",
"$",
"this",
"->",
"htm... | Initializes the widget | [
"Initializes",
"the",
"widget"
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/JoyRide.php#L84-L95 |
2amigos/yiifoundation | widgets/JoyRide.php | JoyRide.renderStop | public function renderStop($stop)
{
$options = array();
$options['data-id'] = ArrayHelper::getValue($stop, 'id');
$options['data-text'] = ArrayHelper::getValue($stop, 'text');
$options['data-button'] = ArrayHelper::getValue($stop, 'button');
$options[... | php | public function renderStop($stop)
{
$options = array();
$options['data-id'] = ArrayHelper::getValue($stop, 'id');
$options['data-text'] = ArrayHelper::getValue($stop, 'text');
$options['data-button'] = ArrayHelper::getValue($stop, 'button');
$options[... | [
"public",
"function",
"renderStop",
"(",
"$",
"stop",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"$",
"options",
"[",
"'data-id'",
"]",
"=",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"stop",
",",
"'id'",
")",
";",
"$",
"options",
"[",
... | Renders a single stop
@param array $stop the stop configuration
@return string the resulting li tag | [
"Renders",
"a",
"single",
"stop"
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/JoyRide.php#L124-L146 |
fubhy/graphql-php | src/Type/Definition/Types/Scalars/IdType.php | IdType.coerceLiteral | public function coerceLiteral(Node $node)
{
if ($node instanceof StringValue || $node instanceof IntValue) {
return $node->get('value');
}
return NULL;
} | php | public function coerceLiteral(Node $node)
{
if ($node instanceof StringValue || $node instanceof IntValue) {
return $node->get('value');
}
return NULL;
} | [
"public",
"function",
"coerceLiteral",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"StringValue",
"||",
"$",
"node",
"instanceof",
"IntValue",
")",
"{",
"return",
"$",
"node",
"->",
"get",
"(",
"'value'",
")",
";",
"}",
"r... | {@inheritdoc} | [
"{"
] | train | https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Type/Definition/Types/Scalars/IdType.php#L28-L35 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section/Table/Cell.php | PHPWord_Section_Table_Cell.addText | public function addText($text, $styleFont = null, $styleParagraph = null) {
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
$this->_elementCollection[] = $text;
return $text;
} | php | public function addText($text, $styleFont = null, $styleParagraph = null) {
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
$this->_elementCollection[] = $text;
return $text;
} | [
"public",
"function",
"addText",
"(",
"$",
"text",
",",
"$",
"styleFont",
"=",
"null",
",",
"$",
"styleParagraph",
"=",
"null",
")",
"{",
"$",
"text",
"=",
"new",
"PHPWord_Section_Text",
"(",
"$",
"text",
",",
"$",
"styleFont",
",",
"$",
"styleParagraph"... | Add a Text Element
@param string $text
@param mixed $style
@return PHPWord_Section_Text | [
"Add",
"a",
"Text",
"Element"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section/Table/Cell.php#L110-L114 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.