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 |
|---|---|---|---|---|---|---|---|---|---|---|
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/reader.php | ezcDbSchemaXmlReader.parseDiffXml | private function parseDiffXml( SimpleXMLElement $xml )
{
$newTables = array();
foreach ( $xml->{'new-tables'}->table as $table )
{
$tableName = (string) $table->name;
$newTables[$tableName] = $this->parseTable( $table );
}
$changedTables = array();
... | php | private function parseDiffXml( SimpleXMLElement $xml )
{
$newTables = array();
foreach ( $xml->{'new-tables'}->table as $table )
{
$tableName = (string) $table->name;
$newTables[$tableName] = $this->parseTable( $table );
}
$changedTables = array();
... | [
"private",
"function",
"parseDiffXml",
"(",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"newTables",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"->",
"{",
"'new-tables'",
"}",
"->",
"table",
"as",
"$",
"table",
")",
"{",
"$",
"tableNam... | Returns the schema differences definition in $xml as an ezcDbSchemaDiff
@param SimpleXMLElement $xml
@return ezcDbSchemaDiff | [
"Returns",
"the",
"schema",
"differences",
"definition",
"in",
"$xml",
"as",
"an",
"ezcDbSchemaDiff"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/reader.php#L206-L233 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/reader.php | ezcDbSchemaXmlReader.openXmlFile | private function openXmlFile( $file )
{
if ( !file_exists( $file ) )
{
throw new ezcBaseFileNotFoundException( $file, 'schema' );
}
$xml = @simplexml_load_file( $file );
if ( !$xml )
{
throw new ezcDbSchemaInvalidSchemaException( "The schema f... | php | private function openXmlFile( $file )
{
if ( !file_exists( $file ) )
{
throw new ezcBaseFileNotFoundException( $file, 'schema' );
}
$xml = @simplexml_load_file( $file );
if ( !$xml )
{
throw new ezcDbSchemaInvalidSchemaException( "The schema f... | [
"private",
"function",
"openXmlFile",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"ezcBaseFileNotFoundException",
"(",
"$",
"file",
",",
"'schema'",
")",
";",
"}",
"$",
"xml",
"=",
"@",
... | Opens the XML file $file for parsing
@param string $file
@throws ezcBaseFileNotFoundException if the file $file could not be
found.
@throws ezcDbSchemaInvalidSchemaException if the XML in the $file is
corrupted or when the file could not be opened.
@return SimpleXML | [
"Opens",
"the",
"XML",
"file",
"$file",
"for",
"parsing"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/reader.php#L245-L259 |
technote-space/wordpress-plugin-base | src/classes/models/lib/custom_post.php | Custom_Post.get_post_type_by_slug | public function get_post_type_by_slug( $slug ) {
if ( ! isset( $this->_custom_posts_mapper[ $slug ] ) ) {
return null;
}
return $this->get_custom_post_type( $this->_custom_posts_mapper[ $slug ] );
} | php | public function get_post_type_by_slug( $slug ) {
if ( ! isset( $this->_custom_posts_mapper[ $slug ] ) ) {
return null;
}
return $this->get_custom_post_type( $this->_custom_posts_mapper[ $slug ] );
} | [
"public",
"function",
"get_post_type_by_slug",
"(",
"$",
"slug",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_custom_posts_mapper",
"[",
"$",
"slug",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"get_cust... | @param string $slug
@return \Technote\Interfaces\Helper\Custom_Post|null | [
"@param",
"string",
"$slug"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/custom_post.php#L563-L569 |
technote-space/wordpress-plugin-base | src/classes/models/lib/custom_post.php | Custom_Post.get_custom_post_type | public function get_custom_post_type( $post_type ) {
if ( ! $this->is_valid_custom_post_type( $post_type ) ) {
return null;
}
$custom_posts = $this->get_custom_posts();
return $custom_posts[ $post_type ];
} | php | public function get_custom_post_type( $post_type ) {
if ( ! $this->is_valid_custom_post_type( $post_type ) ) {
return null;
}
$custom_posts = $this->get_custom_posts();
return $custom_posts[ $post_type ];
} | [
"public",
"function",
"get_custom_post_type",
"(",
"$",
"post_type",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_valid_custom_post_type",
"(",
"$",
"post_type",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"custom_posts",
"=",
"$",
"this",
"->",
... | @param string $post_type
@return \Technote\Interfaces\Helper\Custom_Post|null | [
"@param",
"string",
"$post_type"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/custom_post.php#L587-L595 |
technote-space/wordpress-plugin-base | src/classes/models/lib/custom_post.php | Custom_Post.is_valid_update | private function is_valid_update( $post_status, $post_type ) {
return ! $this->app->utility->defined( 'DOING_AUTOSAVE' ) && in_array( $post_status, [
'publish',
'future',
'draft',
'draft',
'pending',
'private',
] ) && $this->is_valid_custom_post_type( $post_type ) && 'untrash' !== $... | php | private function is_valid_update( $post_status, $post_type ) {
return ! $this->app->utility->defined( 'DOING_AUTOSAVE' ) && in_array( $post_status, [
'publish',
'future',
'draft',
'draft',
'pending',
'private',
] ) && $this->is_valid_custom_post_type( $post_type ) && 'untrash' !== $... | [
"private",
"function",
"is_valid_update",
"(",
"$",
"post_status",
",",
"$",
"post_type",
")",
"{",
"return",
"!",
"$",
"this",
"->",
"app",
"->",
"utility",
"->",
"defined",
"(",
"'DOING_AUTOSAVE'",
")",
"&&",
"in_array",
"(",
"$",
"post_status",
",",
"["... | @since 2.9.4 Fixed: exclude untrash
@param string $post_status
@param string $post_type
@return bool | [
"@since",
"2",
".",
"9",
".",
"4",
"Fixed",
":",
"exclude",
"untrash"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/custom_post.php#L605-L614 |
technote-space/wordpress-plugin-base | src/classes/models/lib/custom_post.php | Custom_Post.uninstall | public function uninstall() {
/** @var \wpdb $wpdb */
global $wpdb;
foreach ( $this->get_custom_post_types() as $post_type ) {
$posts = $this->app->db->select( $wpdb->posts, [
'post_type' => $post_type,
] );
if ( ! empty( $posts ) ) {
foreach ( $posts as $post ) {
wp_delete_post( $p... | php | public function uninstall() {
/** @var \wpdb $wpdb */
global $wpdb;
foreach ( $this->get_custom_post_types() as $post_type ) {
$posts = $this->app->db->select( $wpdb->posts, [
'post_type' => $post_type,
] );
if ( ! empty( $posts ) ) {
foreach ( $posts as $post ) {
wp_delete_post( $p... | [
"public",
"function",
"uninstall",
"(",
")",
"{",
"/** @var \\wpdb $wpdb */",
"global",
"$",
"wpdb",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_custom_post_types",
"(",
")",
"as",
"$",
"post_type",
")",
"{",
"$",
"posts",
"=",
"$",
"this",
"->",
"app",
... | delete posts | [
"delete",
"posts"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/custom_post.php#L626-L639 |
jasny/codeception-module | src/RequestConvertor.php | RequestConvertor.createStream | protected function createStream(BrowserKitRequest $request)
{
$stream = fopen('php://temp', 'a+');
fwrite($stream, $request->getContent());
return new Stream($stream);
} | php | protected function createStream(BrowserKitRequest $request)
{
$stream = fopen('php://temp', 'a+');
fwrite($stream, $request->getContent());
return new Stream($stream);
} | [
"protected",
"function",
"createStream",
"(",
"BrowserKitRequest",
"$",
"request",
")",
"{",
"$",
"stream",
"=",
"fopen",
"(",
"'php://temp'",
",",
"'a+'",
")",
";",
"fwrite",
"(",
"$",
"stream",
",",
"$",
"request",
"->",
"getContent",
"(",
")",
")",
";... | Create the output stream handle
@param BrowserKitRequest $request
@return Stream | [
"Create",
"the",
"output",
"stream",
"handle"
] | train | https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/RequestConvertor.php#L25-L31 |
jasny/codeception-module | src/RequestConvertor.php | RequestConvertor.buildFullUri | protected function buildFullUri(BrowserKitRequest $request)
{
$uri = new Uri($request->getUri());
$queryParams = [];
parse_str($uri->getQuery(), $queryParams);
if ($request->getMethod() === 'GET') {
$queryParams = array_merge($queryParams, $request->getP... | php | protected function buildFullUri(BrowserKitRequest $request)
{
$uri = new Uri($request->getUri());
$queryParams = [];
parse_str($uri->getQuery(), $queryParams);
if ($request->getMethod() === 'GET') {
$queryParams = array_merge($queryParams, $request->getP... | [
"protected",
"function",
"buildFullUri",
"(",
"BrowserKitRequest",
"$",
"request",
")",
"{",
"$",
"uri",
"=",
"new",
"Uri",
"(",
"$",
"request",
"->",
"getUri",
"(",
")",
")",
";",
"$",
"queryParams",
"=",
"[",
"]",
";",
"parse_str",
"(",
"$",
"uri",
... | Build a full URI from a request
@param BrowserKitRequest $request
@return array [Uri, queryParams] | [
"Build",
"a",
"full",
"URI",
"from",
"a",
"request"
] | train | https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/RequestConvertor.php#L39-L52 |
jasny/codeception-module | src/RequestConvertor.php | RequestConvertor.setRequestHeaders | protected function setRequestHeaders(ServerRequestInterface $baseRequest, array $params)
{
$headers = (new ServerRequest())->withServerParams($params)->getHeaders();
$psrRequest = $baseRequest;
foreach ($headers as $header => $values) {
$psrRequest = $psrRequest->withHeader($hea... | php | protected function setRequestHeaders(ServerRequestInterface $baseRequest, array $params)
{
$headers = (new ServerRequest())->withServerParams($params)->getHeaders();
$psrRequest = $baseRequest;
foreach ($headers as $header => $values) {
$psrRequest = $psrRequest->withHeader($hea... | [
"protected",
"function",
"setRequestHeaders",
"(",
"ServerRequestInterface",
"$",
"baseRequest",
",",
"array",
"$",
"params",
")",
"{",
"$",
"headers",
"=",
"(",
"new",
"ServerRequest",
"(",
")",
")",
"->",
"withServerParams",
"(",
"$",
"params",
")",
"->",
... | Set the request headers
@param ServerRequestInterface $baseRequest
@param array $params
@retrun ServerRequestInterface | [
"Set",
"the",
"request",
"headers"
] | train | https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/RequestConvertor.php#L61-L71 |
jasny/codeception-module | src/RequestConvertor.php | RequestConvertor.determineServerParams | protected function determineServerParams(BrowserKitRequest $request, UriInterface $uri, array $queryParams)
{
return [
'REQUEST_METHOD' => $request->getMethod(),
'QUERY_STRING' => http_build_query($queryParams),
'REQUEST_URI' => (string)($uri->withScheme('')->withHost('')... | php | protected function determineServerParams(BrowserKitRequest $request, UriInterface $uri, array $queryParams)
{
return [
'REQUEST_METHOD' => $request->getMethod(),
'QUERY_STRING' => http_build_query($queryParams),
'REQUEST_URI' => (string)($uri->withScheme('')->withHost('')... | [
"protected",
"function",
"determineServerParams",
"(",
"BrowserKitRequest",
"$",
"request",
",",
"UriInterface",
"$",
"uri",
",",
"array",
"$",
"queryParams",
")",
"{",
"return",
"[",
"'REQUEST_METHOD'",
"=>",
"$",
"request",
"->",
"getMethod",
"(",
")",
",",
... | Get additional server params from request.
@internal It would be nicer if this was solved by Jasny Http Message
@param BrowserKitRequest $request
@param UriInterface $uri
@param array $queryParams
@return array | [
"Get",
"additional",
"server",
"params",
"from",
"request",
".",
"@internal",
"It",
"would",
"be",
"nicer",
"if",
"this",
"was",
"solved",
"by",
"Jasny",
"Http",
"Message"
] | train | https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/RequestConvertor.php#L82-L89 |
jasny/codeception-module | src/RequestConvertor.php | RequestConvertor.setRequestProperties | protected function setRequestProperties(
ServerRequestInterface $baseRequest,
BrowserKitRequest $request,
Stream $stream,
UriInterface $uri,
array $queryParams
) {
return $baseRequest
->withProtocolVersion('1.1')
->withBody($stream)
... | php | protected function setRequestProperties(
ServerRequestInterface $baseRequest,
BrowserKitRequest $request,
Stream $stream,
UriInterface $uri,
array $queryParams
) {
return $baseRequest
->withProtocolVersion('1.1')
->withBody($stream)
... | [
"protected",
"function",
"setRequestProperties",
"(",
"ServerRequestInterface",
"$",
"baseRequest",
",",
"BrowserKitRequest",
"$",
"request",
",",
"Stream",
"$",
"stream",
",",
"UriInterface",
"$",
"uri",
",",
"array",
"$",
"queryParams",
")",
"{",
"return",
"$",
... | Set the server request properties
@param ServerRequestInterface $baseRequest
@param BrowserKitRequest $request
@param Stream $stream
@param UriInterface $uri
@param array $queryParams
@return ServerRequestInterface | [
"Set",
"the",
"server",
"request",
"properties"
] | train | https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/RequestConvertor.php#L101-L119 |
jasny/codeception-module | src/RequestConvertor.php | RequestConvertor.convertUploadedFiles | protected function convertUploadedFiles(array $files)
{
$fileObjects = [];
foreach ($files as $fieldName => $file) {
if ($file instanceof UploadedFileInterface) {
$fileObjects[$fieldName] = $file;
} elseif (!isset($file['tmp_name']) && !isset($file['e... | php | protected function convertUploadedFiles(array $files)
{
$fileObjects = [];
foreach ($files as $fieldName => $file) {
if ($file instanceof UploadedFileInterface) {
$fileObjects[$fieldName] = $file;
} elseif (!isset($file['tmp_name']) && !isset($file['e... | [
"protected",
"function",
"convertUploadedFiles",
"(",
"array",
"$",
"files",
")",
"{",
"$",
"fileObjects",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"fieldName",
"=>",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"instanceof",
"Upl... | Convert a list of uploaded files to a Jasny PSR-7 uploaded files
@param array $files
@return UploadedFile[]|array | [
"Convert",
"a",
"list",
"of",
"uploaded",
"files",
"to",
"a",
"Jasny",
"PSR",
"-",
"7",
"uploaded",
"files"
] | train | https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/RequestConvertor.php#L127-L142 |
jasny/codeception-module | src/RequestConvertor.php | RequestConvertor.convert | public function convert(BrowserKitRequest $request, ServerRequestInterface $baseRequest)
{
$stream = $this->createStream($request);
list($uri, $queryParams) = $this->buildFullUri($request);
if ($baseRequest instanceof ServerRequest) {
$serverParams = $this->determineServ... | php | public function convert(BrowserKitRequest $request, ServerRequestInterface $baseRequest)
{
$stream = $this->createStream($request);
list($uri, $queryParams) = $this->buildFullUri($request);
if ($baseRequest instanceof ServerRequest) {
$serverParams = $this->determineServ... | [
"public",
"function",
"convert",
"(",
"BrowserKitRequest",
"$",
"request",
",",
"ServerRequestInterface",
"$",
"baseRequest",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"createStream",
"(",
"$",
"request",
")",
";",
"list",
"(",
"$",
"uri",
",",
"$",... | Convert a codeception request to a PSR-7 server request
@param BrowserKitRequest $request
@param ServerRequestInterface $baseRequest
@return ServerRequest | [
"Convert",
"a",
"codeception",
"request",
"to",
"a",
"PSR",
"-",
"7",
"server",
"request"
] | train | https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/RequestConvertor.php#L152-L165 |
inhere/php-librarys | src/Helpers/PhpException.php | PhpException.toHtml | public static function toHtml($e, $getTrace = true, $catcher = null, $clearHtml = false): string
{
if (!$getTrace) {
$message = "Error: {$e->getMessage()}";
} else {
$message = sprintf(
"<h3>%s(%d): %s</h3>\n<pre><strong>File: %s(Line %d)</strong>%s \n\n%s</pr... | php | public static function toHtml($e, $getTrace = true, $catcher = null, $clearHtml = false): string
{
if (!$getTrace) {
$message = "Error: {$e->getMessage()}";
} else {
$message = sprintf(
"<h3>%s(%d): %s</h3>\n<pre><strong>File: %s(Line %d)</strong>%s \n\n%s</pr... | [
"public",
"static",
"function",
"toHtml",
"(",
"$",
"e",
",",
"$",
"getTrace",
"=",
"true",
",",
"$",
"catcher",
"=",
"null",
",",
"$",
"clearHtml",
"=",
"false",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"getTrace",
")",
"{",
"$",
"message",
... | Converts an exception into a simple string.
@param \Exception|\Throwable $e the exception being converted
@param bool $clearHtml
@param bool $getTrace
@param null|string $catcher
@return string the string representation of the exception. | [
"Converts",
"an",
"exception",
"into",
"a",
"simple",
"string",
"."
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/PhpException.php#L34-L52 |
inhere/php-librarys | src/Helpers/PhpException.php | PhpException.toArray | public static function toArray($e, $getTrace = true, $catcher = null)
{
$data = [
'class' => \get_class($e),
'message' => $e->getMessage(),
'code' => $e->getCode(),
'file' => $e->getFile() . ':' . $e->getLine(),
];
if ($catcher) {
... | php | public static function toArray($e, $getTrace = true, $catcher = null)
{
$data = [
'class' => \get_class($e),
'message' => $e->getMessage(),
'code' => $e->getCode(),
'file' => $e->getFile() . ':' . $e->getLine(),
];
if ($catcher) {
... | [
"public",
"static",
"function",
"toArray",
"(",
"$",
"e",
",",
"$",
"getTrace",
"=",
"true",
",",
"$",
"catcher",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"[",
"'class'",
"=>",
"\\",
"get_class",
"(",
"$",
"e",
")",
",",
"'message'",
"=>",
"$",
"... | Converts an exception into a simple array.
@param \Exception|\Throwable $e the exception being converted
@param bool $getTrace
@param null|string $catcher
@return array | [
"Converts",
"an",
"exception",
"into",
"a",
"simple",
"array",
"."
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/PhpException.php#L61-L79 |
php-lug/lug | src/Bundle/GridBundle/Model/Builder/FilterBuilder.php | FilterBuilder.build | public function build(array $config)
{
return new Filter(
$this->buildName($config),
$this->buildLabel($config),
$this->buildType($config),
$this->buildForm($config),
$this->buildFormOptions($config),
$this->buildOptions($config)
... | php | public function build(array $config)
{
return new Filter(
$this->buildName($config),
$this->buildLabel($config),
$this->buildType($config),
$this->buildForm($config),
$this->buildFormOptions($config),
$this->buildOptions($config)
... | [
"public",
"function",
"build",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"new",
"Filter",
"(",
"$",
"this",
"->",
"buildName",
"(",
"$",
"config",
")",
",",
"$",
"this",
"->",
"buildLabel",
"(",
"$",
"config",
")",
",",
"$",
"this",
"->",
"b... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Model/Builder/FilterBuilder.php#L40-L50 |
php-lug/lug | src/Bundle/GridBundle/Model/Builder/FilterBuilder.php | FilterBuilder.buildForm | protected function buildForm(array $config)
{
return isset($config['form'])
? $config['form']
: ClassUtils::getClass($this->filterFormRegistry[$this->buildType($config)]);
} | php | protected function buildForm(array $config)
{
return isset($config['form'])
? $config['form']
: ClassUtils::getClass($this->filterFormRegistry[$this->buildType($config)]);
} | [
"protected",
"function",
"buildForm",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"isset",
"(",
"$",
"config",
"[",
"'form'",
"]",
")",
"?",
"$",
"config",
"[",
"'form'",
"]",
":",
"ClassUtils",
"::",
"getClass",
"(",
"$",
"this",
"->",
"filterFor... | @param mixed[] $config
@return string | [
"@param",
"mixed",
"[]",
"$config"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Model/Builder/FilterBuilder.php#L57-L62 |
blesta/composer-installer | src/Installer.php | Installer.getInstallPath | public function getInstallPath(PackageInterface $package)
{
$type = $package->getType();
$supportedType = $this->supportedType($type);
if ($supportedType === false) {
throw new InvalidArgumentException(
'Sorry the package type of this package is not supported.'
... | php | public function getInstallPath(PackageInterface $package)
{
$type = $package->getType();
$supportedType = $this->supportedType($type);
if ($supportedType === false) {
throw new InvalidArgumentException(
'Sorry the package type of this package is not supported.'
... | [
"public",
"function",
"getInstallPath",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"type",
"=",
"$",
"package",
"->",
"getType",
"(",
")",
";",
"$",
"supportedType",
"=",
"$",
"this",
"->",
"supportedType",
"(",
"$",
"type",
")",
";",
"if",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/blesta/composer-installer/blob/11672a7cbe9c74a6d5bc602ce8148ae92781ba2e/src/Installer.php#L18-L33 |
blesta/composer-installer | src/Installer.php | Installer.uninstall | public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
throw new InvalidArgumentException(
sprintf('Package is not installed: %s', $package)
);
}
$repo->removePackage($package);
... | php | public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
throw new InvalidArgumentException(
sprintf('Package is not installed: %s', $package)
);
}
$repo->removePackage($package);
... | [
"public",
"function",
"uninstall",
"(",
"InstalledRepositoryInterface",
"$",
"repo",
",",
"PackageInterface",
"$",
"package",
")",
"{",
"if",
"(",
"!",
"$",
"repo",
"->",
"hasPackage",
"(",
"$",
"package",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentExcepti... | {@inheritDoc} | [
"{"
] | train | https://github.com/blesta/composer-installer/blob/11672a7cbe9c74a6d5bc602ce8148ae92781ba2e/src/Installer.php#L38-L58 |
blesta/composer-installer | src/Installer.php | Installer.supports | public function supports($packageType)
{
$supportedType = $this->supportedType($packageType);
if ($supportedType === false) {
return false;
}
$class = 'Blesta\\Composer\\Installer\\' . $this->supportedTypes[$supportedType];
$installer = new $class(null, $this->c... | php | public function supports($packageType)
{
$supportedType = $this->supportedType($packageType);
if ($supportedType === false) {
return false;
}
$class = 'Blesta\\Composer\\Installer\\' . $this->supportedTypes[$supportedType];
$installer = new $class(null, $this->c... | [
"public",
"function",
"supports",
"(",
"$",
"packageType",
")",
"{",
"$",
"supportedType",
"=",
"$",
"this",
"->",
"supportedType",
"(",
"$",
"packageType",
")",
";",
"if",
"(",
"$",
"supportedType",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",... | {@inheritDoc} | [
"{"
] | train | https://github.com/blesta/composer-installer/blob/11672a7cbe9c74a6d5bc602ce8148ae92781ba2e/src/Installer.php#L63-L81 |
blesta/composer-installer | src/Installer.php | Installer.supportedType | protected function supportedType($type)
{
$supportedType = false;
$baseType = substr($type, 0, strpos($type, '-'));
if (array_key_exists($baseType, $this->supportedTypes)) {
$supportedType = $baseType;
}
return $supportedType;
} | php | protected function supportedType($type)
{
$supportedType = false;
$baseType = substr($type, 0, strpos($type, '-'));
if (array_key_exists($baseType, $this->supportedTypes)) {
$supportedType = $baseType;
}
return $supportedType;
} | [
"protected",
"function",
"supportedType",
"(",
"$",
"type",
")",
"{",
"$",
"supportedType",
"=",
"false",
";",
"$",
"baseType",
"=",
"substr",
"(",
"$",
"type",
",",
"0",
",",
"strpos",
"(",
"$",
"type",
",",
"'-'",
")",
")",
";",
"if",
"(",
"array... | Find the matching installer type
@param string $type
@return boolean|string | [
"Find",
"the",
"matching",
"installer",
"type"
] | train | https://github.com/blesta/composer-installer/blob/11672a7cbe9c74a6d5bc602ce8148ae92781ba2e/src/Installer.php#L89-L100 |
DesignPond/newsletter | src/Http/Controllers/Backend/StatsController.php | StatsController.show | public function show($id)
{
$statistiques = [];
$clickStats = [];
// Stats open, bounce etc.
$campagne = $this->campagne->find($id);
$campagneStats = $this->worker->statsCampagne($campagne->api_campagne_id);
if($campagneStats)
{
$statistiq... | php | public function show($id)
{
$statistiques = [];
$clickStats = [];
// Stats open, bounce etc.
$campagne = $this->campagne->find($id);
$campagneStats = $this->worker->statsCampagne($campagne->api_campagne_id);
if($campagneStats)
{
$statistiq... | [
"public",
"function",
"show",
"(",
"$",
"id",
")",
"{",
"$",
"statistiques",
"=",
"[",
"]",
";",
"$",
"clickStats",
"=",
"[",
"]",
";",
"// Stats open, bounce etc.",
"$",
"campagne",
"=",
"$",
"this",
"->",
"campagne",
"->",
"find",
"(",
"$",
"id",
"... | Display the specified resource.
GET /stats/{id}
@param int $id
@return Response | [
"Display",
"the",
"specified",
"resource",
".",
"GET",
"/",
"stats",
"/",
"{",
"id",
"}"
] | train | https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Http/Controllers/Backend/StatsController.php#L39-L64 |
blast-project/BaseEntitiesBundle | src/Loggable/Mapping/Driver/Yaml.php | Yaml.readExtendedMetadata | public function readExtendedMetadata($meta, array &$config)
{
$mapping = $this->_getMapping($meta->name);
// Entities that have the Loggable trait don't need the blast:loggable entry in the yaml file
if (ClassAnalyzer::hasTrait($meta->name, 'Blast\BaseEntitiesBundle\Entity\Traits\Loggable')... | php | public function readExtendedMetadata($meta, array &$config)
{
$mapping = $this->_getMapping($meta->name);
// Entities that have the Loggable trait don't need the blast:loggable entry in the yaml file
if (ClassAnalyzer::hasTrait($meta->name, 'Blast\BaseEntitiesBundle\Entity\Traits\Loggable')... | [
"public",
"function",
"readExtendedMetadata",
"(",
"$",
"meta",
",",
"array",
"&",
"$",
"config",
")",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"_getMapping",
"(",
"$",
"meta",
"->",
"name",
")",
";",
"// Entities that have the Loggable trait don't need the ... | {@inheritdoc} | [
"{"
] | train | https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Loggable/Mapping/Driver/Yaml.php#L49-L132 |
JBZoo/Assets | src/Asset/Collection.php | Collection.load | public function load(array $filters = [])
{
$factory = $this->_manager->getFactory();
$result = [];
foreach ($this->_source as $key => $source) {
$subAlias = $this->_alias . '-' . $key;
$asset = $factory->create($subAlias, $source, $this->_dependencies, $this->_op... | php | public function load(array $filters = [])
{
$factory = $this->_manager->getFactory();
$result = [];
foreach ($this->_source as $key => $source) {
$subAlias = $this->_alias . '-' . $key;
$asset = $factory->create($subAlias, $source, $this->_dependencies, $this->_op... | [
"public",
"function",
"load",
"(",
"array",
"$",
"filters",
"=",
"[",
"]",
")",
"{",
"$",
"factory",
"=",
"$",
"this",
"->",
"_manager",
"->",
"getFactory",
"(",
")",
";",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_so... | {@inheritdoc} | [
"{"
] | train | https://github.com/JBZoo/Assets/blob/134a109378f5b5e955dfb15e6ed2821581564991/src/Asset/Collection.php#L27-L39 |
canis-io/yii2-broadcaster | lib/models/BroadcastEventDeferred.php | BroadcastEventDeferred.serializeData | public function serializeData()
{
if (isset($this->_dataObject)) {
try {
$this->result = serialize($this->_dataObject);
} catch (\Exception $e) {
\d($this->_dataObject);
exit;
}
}
} | php | public function serializeData()
{
if (isset($this->_dataObject)) {
try {
$this->result = serialize($this->_dataObject);
} catch (\Exception $e) {
\d($this->_dataObject);
exit;
}
}
} | [
"public",
"function",
"serializeData",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_dataObject",
")",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"result",
"=",
"serialize",
"(",
"$",
"this",
"->",
"_dataObject",
")",
";",
"}",
"catch",
... | [[@doctodo method_description:serializeAction]]. | [
"[["
] | train | https://github.com/canis-io/yii2-broadcaster/blob/b8d7b5b24f2d8f4fdb29132dd85df34602dcd6b1/lib/models/BroadcastEventDeferred.php#L37-L47 |
canis-io/yii2-broadcaster | lib/models/BroadcastEventDeferred.php | BroadcastEventDeferred.getResultObject | public function getResultObject()
{
if (!isset($this->_dataObject) && !empty($this->result)) {
$this->_dataObject = unserialize($this->result);
} elseif (!isset($this->_dataObject)) {
$this->_dataObject = new Result;
}
$this->_dataObject->model = $this;
... | php | public function getResultObject()
{
if (!isset($this->_dataObject) && !empty($this->result)) {
$this->_dataObject = unserialize($this->result);
} elseif (!isset($this->_dataObject)) {
$this->_dataObject = new Result;
}
$this->_dataObject->model = $this;
... | [
"public",
"function",
"getResultObject",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_dataObject",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"result",
")",
")",
"{",
"$",
"this",
"->",
"_dataObject",
"=",
"unserialize",
"(... | Get action object.
@return [[@doctodo return_type:getActionObject]] [[@doctodo return_description:getActionObject]] | [
"Get",
"action",
"object",
"."
] | train | https://github.com/canis-io/yii2-broadcaster/blob/b8d7b5b24f2d8f4fdb29132dd85df34602dcd6b1/lib/models/BroadcastEventDeferred.php#L198-L208 |
mothership-ec/composer | src/Composer/Package/Version/VersionParser.php | VersionParser.parseNameVersionPairs | public function parseNameVersionPairs(array $pairs)
{
$pairs = array_values($pairs);
$result = array();
for ($i = 0, $count = count($pairs); $i < $count; $i++) {
$pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
if (false === strpos($pair, ' ... | php | public function parseNameVersionPairs(array $pairs)
{
$pairs = array_values($pairs);
$result = array();
for ($i = 0, $count = count($pairs); $i < $count; $i++) {
$pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
if (false === strpos($pair, ' ... | [
"public",
"function",
"parseNameVersionPairs",
"(",
"array",
"$",
"pairs",
")",
"{",
"$",
"pairs",
"=",
"array_values",
"(",
"$",
"pairs",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"count",
"=",... | Parses a name/version pairs and returns an array of pairs + the
@param array $pairs a set of package/version pairs separated by ":", "=" or " "
@return array[] array of arrays containing a name and (if provided) a version | [
"Parses",
"a",
"name",
"/",
"version",
"pairs",
"and",
"returns",
"an",
"array",
"of",
"pairs",
"+",
"the"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Package/Version/VersionParser.php#L539-L560 |
Root-XS/SudoBible | src/SudoBible.php | SudoBible.dbConnect | protected function dbConnect(array $aOptions)
{
$aOptions = array_merge(SudoBible::DB_CREDS, $aOptions);
try {
$this->db = new mysqli(
$aOptions['db_host'],
$aOptions['db_user'],
$aOptions['db_pass'],
$aOptions['db_name'],
$aOptions['db_port']
);
} catch (Exception $e) {
// Clean up ... | php | protected function dbConnect(array $aOptions)
{
$aOptions = array_merge(SudoBible::DB_CREDS, $aOptions);
try {
$this->db = new mysqli(
$aOptions['db_host'],
$aOptions['db_user'],
$aOptions['db_pass'],
$aOptions['db_name'],
$aOptions['db_port']
);
} catch (Exception $e) {
// Clean up ... | [
"protected",
"function",
"dbConnect",
"(",
"array",
"$",
"aOptions",
")",
"{",
"$",
"aOptions",
"=",
"array_merge",
"(",
"SudoBible",
"::",
"DB_CREDS",
",",
"$",
"aOptions",
")",
";",
"try",
"{",
"$",
"this",
"->",
"db",
"=",
"new",
"mysqli",
"(",
"$",... | Connect to the DB.
@param array $aOptions
@throws Exception | [
"Connect",
"to",
"the",
"DB",
"."
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBible.php#L65-L80 |
Root-XS/SudoBible | src/SudoBible.php | SudoBible.setTranslation | public function setTranslation($mTranslation)
{
$this->iTranslation = is_numeric($mTranslation)
? $mTranslation : $this->getIdFor('translation', $mTranslation);
} | php | public function setTranslation($mTranslation)
{
$this->iTranslation = is_numeric($mTranslation)
? $mTranslation : $this->getIdFor('translation', $mTranslation);
} | [
"public",
"function",
"setTranslation",
"(",
"$",
"mTranslation",
")",
"{",
"$",
"this",
"->",
"iTranslation",
"=",
"is_numeric",
"(",
"$",
"mTranslation",
")",
"?",
"$",
"mTranslation",
":",
"$",
"this",
"->",
"getIdFor",
"(",
"'translation'",
",",
"$",
"... | Set the translation preference.
@param int|string $mTranslation | [
"Set",
"the",
"translation",
"preference",
"."
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBible.php#L87-L91 |
Root-XS/SudoBible | src/SudoBible.php | SudoBible.queryFiles | protected function queryFiles($strAction)
{
if (!in_array($strAction, ['create', 'insert', 'drop']))
throw new Exception('Invalid parameter "' . $strAction . '" sent to SudoBible::queryFiles()');
$strPath = 'queries/' . $this->dbType . '/' . $strAction;
foreach (scandir($strPath) as $strFilename) {
// On... | php | protected function queryFiles($strAction)
{
if (!in_array($strAction, ['create', 'insert', 'drop']))
throw new Exception('Invalid parameter "' . $strAction . '" sent to SudoBible::queryFiles()');
$strPath = 'queries/' . $this->dbType . '/' . $strAction;
foreach (scandir($strPath) as $strFilename) {
// On... | [
"protected",
"function",
"queryFiles",
"(",
"$",
"strAction",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"strAction",
",",
"[",
"'create'",
",",
"'insert'",
",",
"'drop'",
"]",
")",
")",
"throw",
"new",
"Exception",
"(",
"'Invalid parameter \"'",
".",... | Run the query files in a given directory.
@param string $strAction create, insert, or drop
@throws Exception | [
"Run",
"the",
"query",
"files",
"in",
"a",
"given",
"directory",
"."
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBible.php#L125-L145 |
Root-XS/SudoBible | src/SudoBible.php | SudoBible.ref | public function ref($mBook, $iChapter, $iVerse = null, $mEnd1 = null, $iEnd2 = null, $iEnd3 = null)
{
// Sanitize input
$strBook = is_numeric($mBook) ? 'Book #' . $mBook : $mBook; // save for later error message
if (!is_numeric($mBook))
$mBook = $this->getIdFor('book', $mBook);
if ($mEnd1 && !is_numeric($mE... | php | public function ref($mBook, $iChapter, $iVerse = null, $mEnd1 = null, $iEnd2 = null, $iEnd3 = null)
{
// Sanitize input
$strBook = is_numeric($mBook) ? 'Book #' . $mBook : $mBook; // save for later error message
if (!is_numeric($mBook))
$mBook = $this->getIdFor('book', $mBook);
if ($mEnd1 && !is_numeric($mE... | [
"public",
"function",
"ref",
"(",
"$",
"mBook",
",",
"$",
"iChapter",
",",
"$",
"iVerse",
"=",
"null",
",",
"$",
"mEnd1",
"=",
"null",
",",
"$",
"iEnd2",
"=",
"null",
",",
"$",
"iEnd3",
"=",
"null",
")",
"{",
"// Sanitize input",
"$",
"strBook",
"=... | Return a verse, passage, or chapter.
@param int|string $mBook Name or ID of the book.
@param int $iChapter Chapter number.
@param int $iVerse Verse number.
@param int|string $mEnd1 Ending verse, chapter, or book (name or ID).
@param int $iEnd2 Ending verse or chapter.
@param int $iEnd3 Ending verse.
@throws Exception
... | [
"Return",
"a",
"verse",
"passage",
"or",
"chapter",
"."
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBible.php#L184-L282 |
Root-XS/SudoBible | src/SudoBible.php | SudoBible.topic | public function topic($mTopic, $bRandomOne = false)
{
// Sanitize input
if (is_string($mTopic))
$mTopic = $this->getIdFor('topic', $mTopic);
// Search
$q = 'SELECT tv.*, verses.`text`, books.`name` AS book_name, books.`abbr` AS book_abbr, books.`ot`, books.`nt`'
. ' FROM `sudo_bible_topic_verses` AS tv'... | php | public function topic($mTopic, $bRandomOne = false)
{
// Sanitize input
if (is_string($mTopic))
$mTopic = $this->getIdFor('topic', $mTopic);
// Search
$q = 'SELECT tv.*, verses.`text`, books.`name` AS book_name, books.`abbr` AS book_abbr, books.`ot`, books.`nt`'
. ' FROM `sudo_bible_topic_verses` AS tv'... | [
"public",
"function",
"topic",
"(",
"$",
"mTopic",
",",
"$",
"bRandomOne",
"=",
"false",
")",
"{",
"// Sanitize input",
"if",
"(",
"is_string",
"(",
"$",
"mTopic",
")",
")",
"$",
"mTopic",
"=",
"$",
"this",
"->",
"getIdFor",
"(",
"'topic'",
",",
"$",
... | Return all verses on a single topic.
@param int|string $mTopic The topic ID or name.
@param bool $bRandomOne Pick a random passage?
@return array|SudoBiblePassage | [
"Return",
"all",
"verses",
"on",
"a",
"single",
"topic",
"."
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBible.php#L291-L317 |
Root-XS/SudoBible | src/SudoBible.php | SudoBible.nextVerse | public function nextVerse($mBook, $iChapter, $iVerse)
{
$oPassage = new SudoBiblePassage([], $this);
$iBookId = is_numeric($mBook) ? $mBook : getIdFor('book', $mBook);
// Steps to try
$aSteps = [
[$iBookId, $iChapter, $iVerse + 1], // next verse in chapter
[$iBookId, $iChapter + 1, 1], // beginning of n... | php | public function nextVerse($mBook, $iChapter, $iVerse)
{
$oPassage = new SudoBiblePassage([], $this);
$iBookId = is_numeric($mBook) ? $mBook : getIdFor('book', $mBook);
// Steps to try
$aSteps = [
[$iBookId, $iChapter, $iVerse + 1], // next verse in chapter
[$iBookId, $iChapter + 1, 1], // beginning of n... | [
"public",
"function",
"nextVerse",
"(",
"$",
"mBook",
",",
"$",
"iChapter",
",",
"$",
"iVerse",
")",
"{",
"$",
"oPassage",
"=",
"new",
"SudoBiblePassage",
"(",
"[",
"]",
",",
"$",
"this",
")",
";",
"$",
"iBookId",
"=",
"is_numeric",
"(",
"$",
"mBook"... | Get the verse following the given reference.
@param int|string $mBook
@param int $iChapter
@param int $iVerse
@return SudoBiblePassage | [
"Get",
"the",
"verse",
"following",
"the",
"given",
"reference",
"."
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBible.php#L327-L346 |
Root-XS/SudoBible | src/SudoBible.php | SudoBible.getIdFor | protected function getIdFor($strType, $strNameAbbr)
{
// Validate input
if (!in_array($strType, ['book', 'translation', 'topic']))
throw new Exception('Invalid entity type "' . $strType . '"');
// Query the db to get the ID
$strTableName = 'sudo_bible_' . $strType . 's';
$q = 'SELECT `id` FROM `' . $strT... | php | protected function getIdFor($strType, $strNameAbbr)
{
// Validate input
if (!in_array($strType, ['book', 'translation', 'topic']))
throw new Exception('Invalid entity type "' . $strType . '"');
// Query the db to get the ID
$strTableName = 'sudo_bible_' . $strType . 's';
$q = 'SELECT `id` FROM `' . $strT... | [
"protected",
"function",
"getIdFor",
"(",
"$",
"strType",
",",
"$",
"strNameAbbr",
")",
"{",
"// Validate input",
"if",
"(",
"!",
"in_array",
"(",
"$",
"strType",
",",
"[",
"'book'",
",",
"'translation'",
",",
"'topic'",
"]",
")",
")",
"throw",
"new",
"E... | Get an ID, given the name.
For now, we're using this instead of a JOIN in the main query
so we can throw a useful error.
@param string $strType translation, book, or topic
@param string $strNameAbbr Name of the translation or book.
@throws Exception
@return int | [
"Get",
"an",
"ID",
"given",
"the",
"name",
"."
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBible.php#L359-L381 |
Root-XS/SudoBible | src/SudoBible.php | SudoBible.runPreparedQuery | protected function runPreparedQuery($strSql, array $aParams = [])
{
// call_user_func_array needs references, not values
$aRefParams = [];
foreach ($aParams as $k =>$v)
$aRefParams[$k] = &$aParams[$k];
// Build data type string for bind_param
$strDataTypes = '';
foreach ($aRefParams as $mValue)
$str... | php | protected function runPreparedQuery($strSql, array $aParams = [])
{
// call_user_func_array needs references, not values
$aRefParams = [];
foreach ($aParams as $k =>$v)
$aRefParams[$k] = &$aParams[$k];
// Build data type string for bind_param
$strDataTypes = '';
foreach ($aRefParams as $mValue)
$str... | [
"protected",
"function",
"runPreparedQuery",
"(",
"$",
"strSql",
",",
"array",
"$",
"aParams",
"=",
"[",
"]",
")",
"{",
"// call_user_func_array needs references, not values",
"$",
"aRefParams",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"aParams",
"as",
"$",
"k... | Run a "mysqli" prepared query, given the query string and params.
@param string $strSql Query string with "?" placeholders.
@param array $aParams Array of values to fill in for the placeholders.
@return array Result set. | [
"Run",
"a",
"mysqli",
"prepared",
"query",
"given",
"the",
"query",
"string",
"and",
"params",
"."
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBible.php#L390-L417 |
NuclearCMS/Hierarchy | src/Support/FileKeeper.php | FileKeeper.tryDelete | protected static function tryDelete($path)
{
$success = true;
try
{
if ( ! @unlink($path))
{
$success = false;
}
} catch (ErrorException $e)
{
$success = false;
}
return $success;
} | php | protected static function tryDelete($path)
{
$success = true;
try
{
if ( ! @unlink($path))
{
$success = false;
}
} catch (ErrorException $e)
{
$success = false;
}
return $success;
} | [
"protected",
"static",
"function",
"tryDelete",
"(",
"$",
"path",
")",
"{",
"$",
"success",
"=",
"true",
";",
"try",
"{",
"if",
"(",
"!",
"@",
"unlink",
"(",
"$",
"path",
")",
")",
"{",
"$",
"success",
"=",
"false",
";",
"}",
"}",
"catch",
"(",
... | Try to delete a file
@param $path
@return bool | [
"Try",
"to",
"delete",
"a",
"file"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Support/FileKeeper.php#L89-L105 |
zhengb302/LumengPHP-Db | src/LumengPHP/Db/ConnectionManager.php | ConnectionManager.getConnection | public function getConnection($name = null) {
if (is_null($name)) {
$name = $this->defaultConnectionName;
}
if (isset($this->connectionMap[$name])) {
return $this->connectionMap[$name];
}
if (!isset($this->connectionConfigs[$name])) {
throw n... | php | public function getConnection($name = null) {
if (is_null($name)) {
$name = $this->defaultConnectionName;
}
if (isset($this->connectionMap[$name])) {
return $this->connectionMap[$name];
}
if (!isset($this->connectionConfigs[$name])) {
throw n... | [
"public",
"function",
"getConnection",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"defaultConnectionName",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->... | 根据数据库连接名称返回数据库连接对象
@param string|null $name 连接名称,为null则返回默认连接
@return ConnectionInterface | [
"根据数据库连接名称返回数据库连接对象"
] | train | https://github.com/zhengb302/LumengPHP-Db/blob/47384aa37bc26352efb7ecda3c139cf8cb03db83/src/LumengPHP/Db/ConnectionManager.php#L65-L83 |
zhengb302/LumengPHP-Db | src/LumengPHP/Db/ConnectionManager.php | ConnectionManager.buildConnection | private function buildConnection($connConfig) {
//基于数组的连接配置
if (is_array($connConfig)) {
$pdoProviderClass = $connConfig['pdoProvider'];
unset($connConfig['pdoProvider']);
/* @var $conn PDOProviderInterface */
$pdoProvider = new $pdoProviderClass($connCon... | php | private function buildConnection($connConfig) {
//基于数组的连接配置
if (is_array($connConfig)) {
$pdoProviderClass = $connConfig['pdoProvider'];
unset($connConfig['pdoProvider']);
/* @var $conn PDOProviderInterface */
$pdoProvider = new $pdoProviderClass($connCon... | [
"private",
"function",
"buildConnection",
"(",
"$",
"connConfig",
")",
"{",
"//基于数组的连接配置",
"if",
"(",
"is_array",
"(",
"$",
"connConfig",
")",
")",
"{",
"$",
"pdoProviderClass",
"=",
"$",
"connConfig",
"[",
"'pdoProvider'",
"]",
";",
"unset",
"(",
"$",
"co... | 根据连接配置构造连接实例
@param array|Closure $connConfig 连接配置/回调函数
@return ConnectionInterface | [
"根据连接配置构造连接实例"
] | train | https://github.com/zhengb302/LumengPHP-Db/blob/47384aa37bc26352efb7ecda3c139cf8cb03db83/src/LumengPHP/Db/ConnectionManager.php#L91-L114 |
zhengb302/LumengPHP-Db | src/LumengPHP/Db/ConnectionManager.php | ConnectionManager.create | public static function create($connectionConfigs, LoggerInterface $logger = null) {
if (!is_null(self::$instance)) {
throw new SqlException('ConnectionManager实例已创建,不能重复创建~');
}
self::$instance = new ConnectionManager($connectionConfigs, $logger);
return self::$instance;
... | php | public static function create($connectionConfigs, LoggerInterface $logger = null) {
if (!is_null(self::$instance)) {
throw new SqlException('ConnectionManager实例已创建,不能重复创建~');
}
self::$instance = new ConnectionManager($connectionConfigs, $logger);
return self::$instance;
... | [
"public",
"static",
"function",
"create",
"(",
"$",
"connectionConfigs",
",",
"LoggerInterface",
"$",
"logger",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"self",
"::",
"$",
"instance",
")",
")",
"{",
"throw",
"new",
"SqlException",
"(",
"'Co... | 创建并返回<b>ConnectionManager</b>实例
@param array $connectionConfigs 数据库配置
@param LoggerInterface $logger 日志组件
@return ConnectionManager
@throws SqlException | [
"创建并返回<b",
">",
"ConnectionManager<",
"/",
"b",
">",
"实例"
] | train | https://github.com/zhengb302/LumengPHP-Db/blob/47384aa37bc26352efb7ecda3c139cf8cb03db83/src/LumengPHP/Db/ConnectionManager.php#L138-L145 |
philiplb/Valdi | src/Valdi/Validator/InTheFuture.php | InTheFuture.isValidComparison | protected function isValidComparison(\DateTime $date, array $datetimes, array $parameters) {
$now = new \DateTime();
return $date->getTimestamp() > $now->getTimestamp();
} | php | protected function isValidComparison(\DateTime $date, array $datetimes, array $parameters) {
$now = new \DateTime();
return $date->getTimestamp() > $now->getTimestamp();
} | [
"protected",
"function",
"isValidComparison",
"(",
"\\",
"DateTime",
"$",
"date",
",",
"array",
"$",
"datetimes",
",",
"array",
"$",
"parameters",
")",
"{",
"$",
"now",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"return",
"$",
"date",
"->",
"getTimesta... | {@inheritdoc} | [
"{"
] | train | https://github.com/philiplb/Valdi/blob/9927ec34a2cb00cec705e952d3c2374e2dc3c972/src/Valdi/Validator/InTheFuture.php#L40-L43 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php | ezcDbSchemaXmlWriter.writeField | private function writeField( $fieldName, ezcDbSchemaField $field )
{
$this->writer->startElement( 'name' );
$this->writer->text( $fieldName );
$this->writer->endElement();
$this->writer->startElement( 'type' );
$this->writer->text( $field->type );
$this->writer->endE... | php | private function writeField( $fieldName, ezcDbSchemaField $field )
{
$this->writer->startElement( 'name' );
$this->writer->text( $fieldName );
$this->writer->endElement();
$this->writer->startElement( 'type' );
$this->writer->text( $field->type );
$this->writer->endE... | [
"private",
"function",
"writeField",
"(",
"$",
"fieldName",
",",
"ezcDbSchemaField",
"$",
"field",
")",
"{",
"$",
"this",
"->",
"writer",
"->",
"startElement",
"(",
"'name'",
")",
";",
"$",
"this",
"->",
"writer",
"->",
"text",
"(",
"$",
"fieldName",
")"... | Uses the $writer object to write the field definition $field for $fieldName
@param string $fieldName
@param ezcDbSchemaField $field | [
"Uses",
"the",
"$writer",
"object",
"to",
"write",
"the",
"field",
"definition",
"$field",
"for",
"$fieldName"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php#L56-L93 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php | ezcDbSchemaXmlWriter.writeIndexField | private function writeIndexField( $fieldName, ezcDbSchemaIndexField $field )
{
$this->writer->startElement( 'name' );
$this->writer->text( $fieldName );
$this->writer->endElement();
if ( !is_null( $field->sorting ) )
{
$this->writer->startElement( 'sorting' );
... | php | private function writeIndexField( $fieldName, ezcDbSchemaIndexField $field )
{
$this->writer->startElement( 'name' );
$this->writer->text( $fieldName );
$this->writer->endElement();
if ( !is_null( $field->sorting ) )
{
$this->writer->startElement( 'sorting' );
... | [
"private",
"function",
"writeIndexField",
"(",
"$",
"fieldName",
",",
"ezcDbSchemaIndexField",
"$",
"field",
")",
"{",
"$",
"this",
"->",
"writer",
"->",
"startElement",
"(",
"'name'",
")",
";",
"$",
"this",
"->",
"writer",
"->",
"text",
"(",
"$",
"fieldNa... | Uses the $writer object to write the index field definition $field for $fieldName
@param string $fieldName
@param ezcDbSchemaIndexField $field | [
"Uses",
"the",
"$writer",
"object",
"to",
"write",
"the",
"index",
"field",
"definition",
"$field",
"for",
"$fieldName"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php#L101-L113 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php | ezcDbSchemaXmlWriter.writeIndex | private function writeIndex( $indexName, ezcDbSchemaIndex $index )
{
$this->writer->startElement( 'name' );
$this->writer->text( $indexName );
$this->writer->endElement();
if ( $index->primary )
{
$this->writer->startElement( 'primary' );
$this->write... | php | private function writeIndex( $indexName, ezcDbSchemaIndex $index )
{
$this->writer->startElement( 'name' );
$this->writer->text( $indexName );
$this->writer->endElement();
if ( $index->primary )
{
$this->writer->startElement( 'primary' );
$this->write... | [
"private",
"function",
"writeIndex",
"(",
"$",
"indexName",
",",
"ezcDbSchemaIndex",
"$",
"index",
")",
"{",
"$",
"this",
"->",
"writer",
"->",
"startElement",
"(",
"'name'",
")",
";",
"$",
"this",
"->",
"writer",
"->",
"text",
"(",
"$",
"indexName",
")"... | Uses the $writer object to write the index definition $index for $indexName
@param string $indexName
@param ezcDbSchemaIndex $index | [
"Uses",
"the",
"$writer",
"object",
"to",
"write",
"the",
"index",
"definition",
"$index",
"for",
"$indexName"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php#L121-L150 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php | ezcDbSchemaXmlWriter.writeTable | private function writeTable( $tableName, ezcDbSchemaTable $table )
{
$this->writer->startElement( 'table' );
$this->writer->startElement( 'name' );
$this->writer->text( $tableName );
$this->writer->endElement();
$this->writer->flush();
$this->writer->startElement( 'd... | php | private function writeTable( $tableName, ezcDbSchemaTable $table )
{
$this->writer->startElement( 'table' );
$this->writer->startElement( 'name' );
$this->writer->text( $tableName );
$this->writer->endElement();
$this->writer->flush();
$this->writer->startElement( 'd... | [
"private",
"function",
"writeTable",
"(",
"$",
"tableName",
",",
"ezcDbSchemaTable",
"$",
"table",
")",
"{",
"$",
"this",
"->",
"writer",
"->",
"startElement",
"(",
"'table'",
")",
";",
"$",
"this",
"->",
"writer",
"->",
"startElement",
"(",
"'name'",
")",... | Uses the $writer object to write the table definition $table for $tableName
@param string $tableName
@param ezcDbSchemaTable $table | [
"Uses",
"the",
"$writer",
"object",
"to",
"write",
"the",
"table",
"definition",
"$table",
"for",
"$tableName"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php#L158-L192 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php | ezcDbSchemaXmlWriter.writeChangedTable | private function writeChangedTable( $tableName, ezcDbSchemaTableDiff $changedTable )
{
$this->writer->startElement( 'table' );
$this->writer->startElement( 'name' );
$this->writer->text( $tableName );
$this->writer->endElement();
$this->writer->flush();
// added fiel... | php | private function writeChangedTable( $tableName, ezcDbSchemaTableDiff $changedTable )
{
$this->writer->startElement( 'table' );
$this->writer->startElement( 'name' );
$this->writer->text( $tableName );
$this->writer->endElement();
$this->writer->flush();
// added fiel... | [
"private",
"function",
"writeChangedTable",
"(",
"$",
"tableName",
",",
"ezcDbSchemaTableDiff",
"$",
"changedTable",
")",
"{",
"$",
"this",
"->",
"writer",
"->",
"startElement",
"(",
"'table'",
")",
";",
"$",
"this",
"->",
"writer",
"->",
"startElement",
"(",
... | Uses the $writer object to write the table changes definition $changedTable for $tableName
@param string $tableName
@param ezcDbSchemaTableDiff $changedTable | [
"Uses",
"the",
"$writer",
"object",
"to",
"write",
"the",
"table",
"changes",
"definition",
"$changedTable",
"for",
"$tableName"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php#L200-L302 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php | ezcDbSchemaXmlWriter.saveToFile | public function saveToFile( $file, ezcDbSchema $dbSchema )
{
$schema = $dbSchema->getSchema();
$data = $dbSchema->getData();
$this->writer = new XMLWriter();
if ( ! @$this->writer->openUri( $file ) )
{
throw new ezcBaseFilePermissionException( $file, ezcBaseFileE... | php | public function saveToFile( $file, ezcDbSchema $dbSchema )
{
$schema = $dbSchema->getSchema();
$data = $dbSchema->getData();
$this->writer = new XMLWriter();
if ( ! @$this->writer->openUri( $file ) )
{
throw new ezcBaseFilePermissionException( $file, ezcBaseFileE... | [
"public",
"function",
"saveToFile",
"(",
"$",
"file",
",",
"ezcDbSchema",
"$",
"dbSchema",
")",
"{",
"$",
"schema",
"=",
"$",
"dbSchema",
"->",
"getSchema",
"(",
")",
";",
"$",
"data",
"=",
"$",
"dbSchema",
"->",
"getData",
"(",
")",
";",
"$",
"this"... | Writes the schema definition in $dbSchema to the file $file.
@param string $file
@param ezcDbSchema $dbSchema
@todo throw exception when file can not be opened | [
"Writes",
"the",
"schema",
"definition",
"in",
"$dbSchema",
"to",
"the",
"file",
"$file",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php#L311-L334 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php | ezcDbSchemaXmlWriter.saveDiffToFile | public function saveDiffToFile( $file, ezcDbSchemaDiff $dbSchema )
{
$this->writer = new XMLWriter();
if ( ! @$this->writer->openUri( $file ) )
{
throw new ezcBaseFilePermissionException( $file, ezcBaseFileException::WRITE );
}
$this->writer->startDocument( '1.0',... | php | public function saveDiffToFile( $file, ezcDbSchemaDiff $dbSchema )
{
$this->writer = new XMLWriter();
if ( ! @$this->writer->openUri( $file ) )
{
throw new ezcBaseFilePermissionException( $file, ezcBaseFileException::WRITE );
}
$this->writer->startDocument( '1.0',... | [
"public",
"function",
"saveDiffToFile",
"(",
"$",
"file",
",",
"ezcDbSchemaDiff",
"$",
"dbSchema",
")",
"{",
"$",
"this",
"->",
"writer",
"=",
"new",
"XMLWriter",
"(",
")",
";",
"if",
"(",
"!",
"@",
"$",
"this",
"->",
"writer",
"->",
"openUri",
"(",
... | Writes the schema difference definition in $dbSchema to the file $file.
@param string $file
@param ezcDbSchemaDiff $dbSchema
@todo throw exception when file can not be opened | [
"Writes",
"the",
"schema",
"difference",
"definition",
"in",
"$dbSchema",
"to",
"the",
"file",
"$file",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/xml/writer.php#L343-L398 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/reader.php | ezcDbSchemaPgsqlReader.fetchTableIndexes | protected function fetchTableIndexes( $tableName )
{
$indexBuffer = array();
$resultArray = array();
// fetching index info from PostgreSQL
$getIndexSQL = "SELECT relname, pg_index.indisunique, pg_index.indisprimary,
pg_index.indkey, pg_index.indrelid... | php | protected function fetchTableIndexes( $tableName )
{
$indexBuffer = array();
$resultArray = array();
// fetching index info from PostgreSQL
$getIndexSQL = "SELECT relname, pg_index.indisunique, pg_index.indisprimary,
pg_index.indkey, pg_index.indrelid... | [
"protected",
"function",
"fetchTableIndexes",
"(",
"$",
"tableName",
")",
"{",
"$",
"indexBuffer",
"=",
"array",
"(",
")",
";",
"$",
"resultArray",
"=",
"array",
"(",
")",
";",
"// fetching index info from PostgreSQL",
"$",
"getIndexSQL",
"=",
"\"SELECT relname, p... | Loops over all the indexes in the table $table and extracts information.
This method extracts information about the table $tableName's indexes
from the database and returns this schema as an array of
ezcDbSchemaIndex objects. The key in the array is the index' name.
@param string $tableName
@return array(string=>ezc... | [
"Loops",
"over",
"all",
"the",
"indexes",
"in",
"the",
"table",
"$table",
"and",
"extracts",
"information",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/pgsql/reader.php#L246-L319 |
bluetree-service/event | src/Event/Base/EventLog.php | EventLog.makeLogEvent | public function makeLogEvent($name, $eventListener, $status)
{
if ($this->options['log_events']
&& ($this->options['log_all_events']
|| in_array($name, $this->logEvents, true)
)
) {
$this->loggerInstance->makeLog(
[
... | php | public function makeLogEvent($name, $eventListener, $status)
{
if ($this->options['log_events']
&& ($this->options['log_all_events']
|| in_array($name, $this->logEvents, true)
)
) {
$this->loggerInstance->makeLog(
[
... | [
"public",
"function",
"makeLogEvent",
"(",
"$",
"name",
",",
"$",
"eventListener",
",",
"$",
"status",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"options",
"[",
"'log_events'",
"]",
"&&",
"(",
"$",
"this",
"->",
"options",
"[",
"'log_all_events'",
"]",
"... | check that event data can be logged and create log message
@param string $name
@param mixed $eventListener
@param bool|string $status
@return $this | [
"check",
"that",
"event",
"data",
"can",
"be",
"logged",
"and",
"create",
"log",
"message"
] | train | https://github.com/bluetree-service/event/blob/64ef4c77af6284fc22748285d5e527edbdbed69b/src/Event/Base/EventLog.php#L56-L73 |
thienhungho/yii2-product-management | src/modules/ProductManage/controllers/ProductTypeMetaController.php | ProductTypeMetaController.actionIndex | public function actionIndex($type)
{
$searchModel = new ProductTypeMetaSearch();
$queryParams = request()->queryParams;
$queryParams['ProductTypeMetaSearch']['product_type'] = $type;
$dataProvider = $searchModel->search($queryParams);
return $this->render('index', [
... | php | public function actionIndex($type)
{
$searchModel = new ProductTypeMetaSearch();
$queryParams = request()->queryParams;
$queryParams['ProductTypeMetaSearch']['product_type'] = $type;
$dataProvider = $searchModel->search($queryParams);
return $this->render('index', [
... | [
"public",
"function",
"actionIndex",
"(",
"$",
"type",
")",
"{",
"$",
"searchModel",
"=",
"new",
"ProductTypeMetaSearch",
"(",
")",
";",
"$",
"queryParams",
"=",
"request",
"(",
")",
"->",
"queryParams",
";",
"$",
"queryParams",
"[",
"'ProductTypeMetaSearch'",... | @param $type
@return string | [
"@param",
"$type"
] | train | https://github.com/thienhungho/yii2-product-management/blob/72e1237bba123faf671e44491bd93077b50adde9/src/modules/ProductManage/controllers/ProductTypeMetaController.php#L34-L45 |
thienhungho/yii2-product-management | src/modules/ProductManage/controllers/ProductTypeMetaController.php | ProductTypeMetaController.actionCreate | public function actionCreate($type)
{
$model = new ProductTypeMeta();
$model->product_type = $type;
if ($model->loadAll(request()->post())) {
$model->product_type = $type;
if ($model->saveAll()) {
return $this->redirect(['update', 'id' => $mod... | php | public function actionCreate($type)
{
$model = new ProductTypeMeta();
$model->product_type = $type;
if ($model->loadAll(request()->post())) {
$model->product_type = $type;
if ($model->saveAll()) {
return $this->redirect(['update', 'id' => $mod... | [
"public",
"function",
"actionCreate",
"(",
"$",
"type",
")",
"{",
"$",
"model",
"=",
"new",
"ProductTypeMeta",
"(",
")",
";",
"$",
"model",
"->",
"product_type",
"=",
"$",
"type",
";",
"if",
"(",
"$",
"model",
"->",
"loadAll",
"(",
"request",
"(",
")... | @param $type
@return string|\yii\web\Response
@throws \yii\db\Exception | [
"@param",
"$type"
] | train | https://github.com/thienhungho/yii2-product-management/blob/72e1237bba123faf671e44491bd93077b50adde9/src/modules/ProductManage/controllers/ProductTypeMetaController.php#L66-L81 |
thienhungho/yii2-product-management | src/modules/ProductManage/controllers/ProductTypeMetaController.php | ProductTypeMetaController.findModel | protected function findModel($id)
{
if (($model = ProductTypeMeta::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
}
} | php | protected function findModel($id)
{
if (($model = ProductTypeMeta::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
}
} | [
"protected",
"function",
"findModel",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"(",
"$",
"model",
"=",
"ProductTypeMeta",
"::",
"findOne",
"(",
"$",
"id",
")",
")",
"!==",
"null",
")",
"{",
"return",
"$",
"model",
";",
"}",
"else",
"{",
"throw",
"new",... | Finds the ProductTypeMeta model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.
@param integer $id
@return ProductTypeMeta the loaded model
@throws NotFoundHttpException if the model cannot be found | [
"Finds",
"the",
"ProductTypeMeta",
"model",
"based",
"on",
"its",
"primary",
"key",
"value",
".",
"If",
"the",
"model",
"is",
"not",
"found",
"a",
"404",
"HTTP",
"exception",
"will",
"be",
"thrown",
"."
] | train | https://github.com/thienhungho/yii2-product-management/blob/72e1237bba123faf671e44491bd93077b50adde9/src/modules/ProductManage/controllers/ProductTypeMetaController.php#L182-L189 |
xiewulong/yii2-fileupload | oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php | DebugUniversalClassLoader.enable | public static function enable()
{
if (!is_array($functions = spl_autoload_functions())) {
return;
}
foreach ($functions as $function) {
spl_autoload_unregister($function);
}
foreach ($functions as $function) {
if (is_array($function) && $... | php | public static function enable()
{
if (!is_array($functions = spl_autoload_functions())) {
return;
}
foreach ($functions as $function) {
spl_autoload_unregister($function);
}
foreach ($functions as $function) {
if (is_array($function) && $... | [
"public",
"static",
"function",
"enable",
"(",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"functions",
"=",
"spl_autoload_functions",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"functions",
"as",
"$",
"function",
")",
"{",
... | Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones. | [
"Replaces",
"all",
"regular",
"UniversalClassLoader",
"instances",
"by",
"a",
"DebugUniversalClassLoader",
"ones",
"."
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php#L24-L48 |
xiewulong/yii2-fileupload | oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php | DebugUniversalClassLoader.loadClass | public function loadClass($class)
{
if ($file = $this->findFile($class)) {
require $file;
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
throw new \RuntimeException(sprintf... | php | public function loadClass($class)
{
if ($file = $this->findFile($class)) {
require $file;
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
throw new \RuntimeException(sprintf... | [
"public",
"function",
"loadClass",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"file",
"=",
"$",
"this",
"->",
"findFile",
"(",
"$",
"class",
")",
")",
"{",
"require",
"$",
"file",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class",
",",
"fa... | {@inheritDoc} | [
"{"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php#L53-L62 |
Danack/GithubArtaxService | lib/GithubService/Model/RepoStatsPunchCardInfo.php | RepoStatsPunchCardInfo.createFromData | static function createFromData($data) {
$instance = new static();
$instance->day = $data[0];
$instance->hour = $data[1];
$instance->numberCommits = $data[2];
return $instance;
} | php | static function createFromData($data) {
$instance = new static();
$instance->day = $data[0];
$instance->hour = $data[1];
$instance->numberCommits = $data[2];
return $instance;
} | [
"static",
"function",
"createFromData",
"(",
"$",
"data",
")",
"{",
"$",
"instance",
"=",
"new",
"static",
"(",
")",
";",
"$",
"instance",
"->",
"day",
"=",
"$",
"data",
"[",
"0",
"]",
";",
"$",
"instance",
"->",
"hour",
"=",
"$",
"data",
"[",
"1... | Number of commits | [
"Number",
"of",
"commits"
] | train | https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/Model/RepoStatsPunchCardInfo.php#L22-L30 |
raideer/twitch-api | src/Wrapper.php | Wrapper.registerResource | public function registerResource(Resources\Resource $resource)
{
$this->resources[strtolower($resource->getName())] = $resource;
} | php | public function registerResource(Resources\Resource $resource)
{
$this->resources[strtolower($resource->getName())] = $resource;
} | [
"public",
"function",
"registerResource",
"(",
"Resources",
"\\",
"Resource",
"$",
"resource",
")",
"{",
"$",
"this",
"->",
"resources",
"[",
"strtolower",
"(",
"$",
"resource",
"->",
"getName",
"(",
")",
")",
"]",
"=",
"$",
"resource",
";",
"}"
] | Registers a resource.
@param ResourcesResource $resource
@return void | [
"Registers",
"a",
"resource",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Wrapper.php#L71-L74 |
raideer/twitch-api | src/Wrapper.php | Wrapper.authorize | public function authorize($args)
{
$numArgs = func_num_args();
if ($numArgs === 0) {
throw new \InvalidArgumentException('Wrapper->authorize expects atleast 1 argument!');
return;
}
if ($numArgs === 1) {
$arg1 = func_get_arg(0);
if ($arg1 instanceof O... | php | public function authorize($args)
{
$numArgs = func_num_args();
if ($numArgs === 0) {
throw new \InvalidArgumentException('Wrapper->authorize expects atleast 1 argument!');
return;
}
if ($numArgs === 1) {
$arg1 = func_get_arg(0);
if ($arg1 instanceof O... | [
"public",
"function",
"authorize",
"(",
"$",
"args",
")",
"{",
"$",
"numArgs",
"=",
"func_num_args",
"(",
")",
";",
"if",
"(",
"$",
"numArgs",
"===",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Wrapper->authorize expects atleast 1 a... | Enables the authorized requests.
@param string $args Access token
OR
@param OAuthResponse $args Object returned by OAuth->getResponse()
OR
@param string $arg1 Access Token
@param array $arg2 Array of registered scopes
@return void | [
"Enables",
"the",
"authorized",
"requests",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Wrapper.php#L118-L158 |
raideer/twitch-api | src/Wrapper.php | Wrapper.hasScope | public function hasScope($name, $strict = true)
{
if (!$strict) {
if (empty($this->registeredScopes)) {
return true;
}
}
return in_array($name, $this->registeredScopes);
} | php | public function hasScope($name, $strict = true)
{
if (!$strict) {
if (empty($this->registeredScopes)) {
return true;
}
}
return in_array($name, $this->registeredScopes);
} | [
"public",
"function",
"hasScope",
"(",
"$",
"name",
",",
"$",
"strict",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"strict",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"registeredScopes",
")",
")",
"{",
"return",
"true",
";",
"}",
"}"... | Checks if scope is registered.
@param string $name Scope name
@param bool $strict If false and registeredScopes array is empty, function will return true.
Used by Resources. If an array of registered scopes is passed in
Wrapper->authorize() function, authorized requests will check if scope is
registered without ... | [
"Checks",
"if",
"scope",
"is",
"registered",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Wrapper.php#L171-L180 |
raideer/twitch-api | src/Wrapper.php | Wrapper.checkScope | public function checkScope($name, $strict = false)
{
if (!$this->hasScope($name, $strict)) {
throw new Exceptions\OutOfScopeException("Scope $name is not registered!");
}
} | php | public function checkScope($name, $strict = false)
{
if (!$this->hasScope($name, $strict)) {
throw new Exceptions\OutOfScopeException("Scope $name is not registered!");
}
} | [
"public",
"function",
"checkScope",
"(",
"$",
"name",
",",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasScope",
"(",
"$",
"name",
",",
"$",
"strict",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"OutOfScopeExcep... | Checks if scope is registered
Throws an exception if scope doesn't exist.
@param string $name Scope name
@param bool $strict
@return void | [
"Checks",
"if",
"scope",
"is",
"registered",
"Throws",
"an",
"exception",
"if",
"scope",
"doesn",
"t",
"exist",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Wrapper.php#L191-L196 |
raideer/twitch-api | src/Wrapper.php | Wrapper.resource | public function resource($name)
{
if (!isset($this->resources[$name])) {
throw new Exceptions\ResourceException("Resource $name does not exist!");
return;
}
return $this->resources[$name];
} | php | public function resource($name)
{
if (!isset($this->resources[$name])) {
throw new Exceptions\ResourceException("Resource $name does not exist!");
return;
}
return $this->resources[$name];
} | [
"public",
"function",
"resource",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"ResourceException",
"(",
"\"Resource $name does not exist... | Returns an API resource.
@param string $name Name of the resource
@return Raideer\TwitchApi\Resources\Resource | [
"Returns",
"an",
"API",
"resource",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Wrapper.php#L223-L232 |
raideer/twitch-api | src/Wrapper.php | Wrapper.request | public function request($type, $target, $options = [], $authorized = false)
{
$headers = [
'Accept' => 'application/vnd.twitchtv.v3+json',
];
if ($authorized) {
$headers['Authorization'] = 'OAuth '.$this->accessToken;
}
$options = array_merge_recursive(['headers' => $head... | php | public function request($type, $target, $options = [], $authorized = false)
{
$headers = [
'Accept' => 'application/vnd.twitchtv.v3+json',
];
if ($authorized) {
$headers['Authorization'] = 'OAuth '.$this->accessToken;
}
$options = array_merge_recursive(['headers' => $head... | [
"public",
"function",
"request",
"(",
"$",
"type",
",",
"$",
"target",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"authorized",
"=",
"false",
")",
"{",
"$",
"headers",
"=",
"[",
"'Accept'",
"=>",
"'application/vnd.twitchtv.v3+json'",
",",
"]",
";",
... | Makes a GuzzleHttp request.
@param requestType $type GET, POST, PUT, DELETE
@param string $target Target URL
@param array $options Request options
@param bool $authorized Attach Authorization headers
@return array JsonDecoded body contents | [
"Makes",
"a",
"GuzzleHttp",
"request",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Wrapper.php#L268-L297 |
ComposePress/core | src/Abstracts/Manager.php | Manager.get_module | public function get_module( $name ) {
if ( null === $name ) {
return false;
}
if ( isset( $this->modules[ $name ] ) ) {
return $this->modules[ $name ];
}
$name = "\\{$name}";
if ( isset( $this->modules[ $name ] ) ) {
return $this->modules[ $name ];
}
return false;
} | php | public function get_module( $name ) {
if ( null === $name ) {
return false;
}
if ( isset( $this->modules[ $name ] ) ) {
return $this->modules[ $name ];
}
$name = "\\{$name}";
if ( isset( $this->modules[ $name ] ) ) {
return $this->modules[ $name ];
}
return false;
} | [
"public",
"function",
"get_module",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"modules",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
... | @param $name
@return bool|mixed | [
"@param",
"$name"
] | train | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Abstracts/Manager.php#L71-L84 |
Isset/pushnotification | src/PushNotification/Type/Apple/AppleNotifier.php | AppleNotifier.sendMessage | protected function sendMessage(Message $message, string $connectionName = null): MessageEnvelope
{
/* @var AppleMessage $message */
try {
$envelope = $this->createMessageEnvelope($message);
$connection = $this->getConnectionHandler()->getConnection($connectionName);
... | php | protected function sendMessage(Message $message, string $connectionName = null): MessageEnvelope
{
/* @var AppleMessage $message */
try {
$envelope = $this->createMessageEnvelope($message);
$connection = $this->getConnectionHandler()->getConnection($connectionName);
... | [
"protected",
"function",
"sendMessage",
"(",
"Message",
"$",
"message",
",",
"string",
"$",
"connectionName",
"=",
"null",
")",
":",
"MessageEnvelope",
"{",
"/* @var AppleMessage $message */",
"try",
"{",
"$",
"envelope",
"=",
"$",
"this",
"->",
"createMessageEnve... | @param Message $message
@param string|null $connectionName
@throws ConnectionHandlerException
@throws ConnectionException
@throws AppleNotifyFailedException
@return MessageEnvelope | [
"@param",
"Message",
"$message",
"@param",
"string|null",
"$connectionName"
] | train | https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/Type/Apple/AppleNotifier.php#L44-L63 |
Isset/pushnotification | src/PushNotification/Type/Apple/AppleNotifier.php | AppleNotifier.flushQueueItem | protected function flushQueueItem(string $connectionName, MessageEnvelopeQueue $queue)
{
if ($queue->isEmpty()) {
return;
}
$connection = $this->getConnectionHandler()->getConnection($connectionName);
/* @var AppleConnection $connection */
foreach ($queue->getQue... | php | protected function flushQueueItem(string $connectionName, MessageEnvelopeQueue $queue)
{
if ($queue->isEmpty()) {
return;
}
$connection = $this->getConnectionHandler()->getConnection($connectionName);
/* @var AppleConnection $connection */
foreach ($queue->getQue... | [
"protected",
"function",
"flushQueueItem",
"(",
"string",
"$",
"connectionName",
",",
"MessageEnvelopeQueue",
"$",
"queue",
")",
"{",
"if",
"(",
"$",
"queue",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"connection",
"=",
"$",
"this",
"... | @param string $connectionName
@param MessageEnvelopeQueue $queue
@throws AppleNotifyFailedException
@throws ConnectionHandlerException
@throws ConnectionException | [
"@param",
"string",
"$connectionName",
"@param",
"MessageEnvelopeQueue",
"$queue"
] | train | https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/Type/Apple/AppleNotifier.php#L73-L95 |
Isset/pushnotification | src/PushNotification/Type/Apple/AppleNotifier.php | AppleNotifier.handleErrorResponse | private function handleErrorResponse(string $connectionName, MessageEnvelopeQueue $queue, Response $response)
{
$error = $response->getResponse();
if (false === is_array($error) or !array_key_exists('identifier', $error)) {
$queue->traverseWith(function (MessageEnvelope $messageEnvelope)... | php | private function handleErrorResponse(string $connectionName, MessageEnvelopeQueue $queue, Response $response)
{
$error = $response->getResponse();
if (false === is_array($error) or !array_key_exists('identifier', $error)) {
$queue->traverseWith(function (MessageEnvelope $messageEnvelope)... | [
"private",
"function",
"handleErrorResponse",
"(",
"string",
"$",
"connectionName",
",",
"MessageEnvelopeQueue",
"$",
"queue",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"error",
"=",
"$",
"response",
"->",
"getResponse",
"(",
")",
";",
"if",
"(",
"fal... | @param string $connectionName
@param MessageEnvelopeQueue $queue
@param Response $response
@throws AppleNotifyFailedException
@throws ConnectionException
@throws ConnectionHandlerException | [
"@param",
"string",
"$connectionName",
"@param",
"MessageEnvelopeQueue",
"$queue",
"@param",
"Response",
"$response"
] | train | https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/Type/Apple/AppleNotifier.php#L117-L139 |
yeaha/owl-core | src/Crontab.php | Crontab.start | public function start()
{
$try = $this->tryStart();
$this->log('debug', 'try start', [
'result' => (int) $try,
]);
if (!$try) {
return false;
}
$this->log('info', 'Job start');
// 把进程ID和开始时间记录到上下文中
$this->setContext(self::KEY... | php | public function start()
{
$try = $this->tryStart();
$this->log('debug', 'try start', [
'result' => (int) $try,
]);
if (!$try) {
return false;
}
$this->log('info', 'Job start');
// 把进程ID和开始时间记录到上下文中
$this->setContext(self::KEY... | [
"public",
"function",
"start",
"(",
")",
"{",
"$",
"try",
"=",
"$",
"this",
"->",
"tryStart",
"(",
")",
";",
"$",
"this",
"->",
"log",
"(",
"'debug'",
",",
"'try start'",
",",
"[",
"'result'",
"=>",
"(",
"int",
")",
"$",
"try",
",",
"]",
")",
"... | 执行任务
@return bool | [
"执行任务"
] | train | https://github.com/yeaha/owl-core/blob/fd7531c0a5c0142300a96160bd079f2e2d92fe4c/src/Crontab.php#L25-L57 |
yeaha/owl-core | src/Crontab.php | Crontab.stop | public function stop()
{
$this->removeContext(self::KEY_PROC_ID);
$this->removeContext(self::KEY_PROC_TIME);
$this->saveContext();
$this->log('info', 'Job execute completed');
} | php | public function stop()
{
$this->removeContext(self::KEY_PROC_ID);
$this->removeContext(self::KEY_PROC_TIME);
$this->saveContext();
$this->log('info', 'Job execute completed');
} | [
"public",
"function",
"stop",
"(",
")",
"{",
"$",
"this",
"->",
"removeContext",
"(",
"self",
"::",
"KEY_PROC_ID",
")",
";",
"$",
"this",
"->",
"removeContext",
"(",
"self",
"::",
"KEY_PROC_TIME",
")",
";",
"$",
"this",
"->",
"saveContext",
"(",
")",
"... | 任务执行完毕. | [
"任务执行完毕",
"."
] | train | https://github.com/yeaha/owl-core/blob/fd7531c0a5c0142300a96160bd079f2e2d92fe4c/src/Crontab.php#L62-L69 |
yeaha/owl-core | src/Crontab.php | Crontab.tryStart | protected function tryStart()
{
// 检查是否达到预定时间
try {
if (!$this->testTimer()) {
return false;
}
} catch (\Exception $ex) {
$this->log('error', 'Job testTimer() error', [
'error' => $ex->getMessage(),
]);
... | php | protected function tryStart()
{
// 检查是否达到预定时间
try {
if (!$this->testTimer()) {
return false;
}
} catch (\Exception $ex) {
$this->log('error', 'Job testTimer() error', [
'error' => $ex->getMessage(),
]);
... | [
"protected",
"function",
"tryStart",
"(",
")",
"{",
"// 检查是否达到预定时间",
"try",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"testTimer",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"$",
"this"... | 尝试开始任务
@return bool | [
"尝试开始任务"
] | train | https://github.com/yeaha/owl-core/blob/fd7531c0a5c0142300a96160bd079f2e2d92fe4c/src/Crontab.php#L76-L128 |
josegonzalez/cakephp-sanction | Lib/Panel/PermitPanel.php | PermitPanel.beforeRender | public function beforeRender(Controller $controller) {
if (empty($controller->Permit->user)) {
$controller->Permit->user = $controller->Toolbar->Session->read($controller->Permit->settings['path']);
}
return array(
'user' => $controller->Permit->user,
'routes' => $controller->Permit->routes,
'executed... | php | public function beforeRender(Controller $controller) {
if (empty($controller->Permit->user)) {
$controller->Permit->user = $controller->Toolbar->Session->read($controller->Permit->settings['path']);
}
return array(
'user' => $controller->Permit->user,
'routes' => $controller->Permit->routes,
'executed... | [
"public",
"function",
"beforeRender",
"(",
"Controller",
"$",
"controller",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"controller",
"->",
"Permit",
"->",
"user",
")",
")",
"{",
"$",
"controller",
"->",
"Permit",
"->",
"user",
"=",
"$",
"controller",
"->",
... | Prepare output vars before Controller Rendering.
@param \Controller|object $controller Controller reference.
@return array | [
"Prepare",
"output",
"vars",
"before",
"Controller",
"Rendering",
"."
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Lib/Panel/PermitPanel.php#L14-L23 |
o2system/email | src/Spool.php | Spool.send | public function send(Message $message)
{
$protocolClass = '\O2System\Email\Protocols\\' . ucfirst($this->config->offsetGet('protocol')) . 'Protocol';
if (class_exists($protocolClass)) {
$protocol = new $protocolClass($this);
if ($protocol instanceof AbstractProtocol)... | php | public function send(Message $message)
{
$protocolClass = '\O2System\Email\Protocols\\' . ucfirst($this->config->offsetGet('protocol')) . 'Protocol';
if (class_exists($protocolClass)) {
$protocol = new $protocolClass($this);
if ($protocol instanceof AbstractProtocol)... | [
"public",
"function",
"send",
"(",
"Message",
"$",
"message",
")",
"{",
"$",
"protocolClass",
"=",
"'\\O2System\\Email\\Protocols\\\\'",
".",
"ucfirst",
"(",
"$",
"this",
"->",
"config",
"->",
"offsetGet",
"(",
"'protocol'",
")",
")",
".",
"'Protocol'",
";",
... | Spool::send
@param \O2System\Email\Message $message
@return bool | [
"Spool",
"::",
"send"
] | train | https://github.com/o2system/email/blob/7c64b73f539cac8df4b2aaef474b29b949067898/src/Spool.php#L134-L147 |
krakphp/job | src/Queue/Doctrine/JobRepository.php | JobRepository.addJob | public function addJob(Job\WrappedJob $job, $queue) {
$qb = $this->conn->createQueryBuilder();
$qb->insert($this->table_name);
$qb->values([
'status' => ':status',
'job' => ':job',
'name' => ':name',
'queue' => ':queue',
'created_at' =>... | php | public function addJob(Job\WrappedJob $job, $queue) {
$qb = $this->conn->createQueryBuilder();
$qb->insert($this->table_name);
$qb->values([
'status' => ':status',
'job' => ':job',
'name' => ':name',
'queue' => ':queue',
'created_at' =>... | [
"public",
"function",
"addJob",
"(",
"Job",
"\\",
"WrappedJob",
"$",
"job",
",",
"$",
"queue",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"conn",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"qb",
"->",
"insert",
"(",
"$",
"this",
"->",
"table... | add a new wrapped job | [
"add",
"a",
"new",
"wrapped",
"job"
] | train | https://github.com/krakphp/job/blob/0c16020c1baa13d91f819ecba8334861ba7c4d6c/src/Queue/Doctrine/JobRepository.php#L32-L61 |
krakphp/job | src/Queue/Doctrine/JobRepository.php | JobRepository.processJob | public function processJob(Job\WrappedJob $job) {
$data = $job->get('_doctrine');
$qb = $this->conn->createQueryBuilder();
$qb->update($this->table_name);
$qb->set('status', ':status');
$qb->set('processed_at', ':processed_at');
$qb->where('id = :id');
$qb->setPar... | php | public function processJob(Job\WrappedJob $job) {
$data = $job->get('_doctrine');
$qb = $this->conn->createQueryBuilder();
$qb->update($this->table_name);
$qb->set('status', ':status');
$qb->set('processed_at', ':processed_at');
$qb->where('id = :id');
$qb->setPar... | [
"public",
"function",
"processJob",
"(",
"Job",
"\\",
"WrappedJob",
"$",
"job",
")",
"{",
"$",
"data",
"=",
"$",
"job",
"->",
"get",
"(",
"'_doctrine'",
")",
";",
"$",
"qb",
"=",
"$",
"this",
"->",
"conn",
"->",
"createQueryBuilder",
"(",
")",
";",
... | process job | [
"process",
"job"
] | train | https://github.com/krakphp/job/blob/0c16020c1baa13d91f819ecba8334861ba7c4d6c/src/Queue/Doctrine/JobRepository.php#L80-L93 |
krakphp/job | src/Queue/Doctrine/JobRepository.php | JobRepository.getAvailableJobs | public function getAvailableJobs($queue, $max = 10) {
$qb = $this->conn->createQueryBuilder();
$qb->select('*');
$qb->from($this->table_name);
$qb->where('status = :status AND queue = :queue AND available_at <= :now');
$qb->orderBy('status');
$qb->setParameters([
... | php | public function getAvailableJobs($queue, $max = 10) {
$qb = $this->conn->createQueryBuilder();
$qb->select('*');
$qb->from($this->table_name);
$qb->where('status = :status AND queue = :queue AND available_at <= :now');
$qb->orderBy('status');
$qb->setParameters([
... | [
"public",
"function",
"getAvailableJobs",
"(",
"$",
"queue",
",",
"$",
"max",
"=",
"10",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"conn",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"qb",
"->",
"select",
"(",
"'*'",
")",
";",
"$",
"qb",
"... | get available jobs | [
"get",
"available",
"jobs"
] | train | https://github.com/krakphp/job/blob/0c16020c1baa13d91f819ecba8334861ba7c4d6c/src/Queue/Doctrine/JobRepository.php#L96-L110 |
lukasz-adamski/teamspeak3-framework | src/TeamSpeak3/Transport/UDP.php | UDP.connect | public function connect()
{
if($this->stream !== null) return;
$host = strval($this->config["host"]);
$port = strval($this->config["port"]);
$address = "udp://" . (strstr($host, ":") !== FALSE ? "[" . $host . "]" : $host) . ":" . $port;
$timeout = (int) $this->config["timeout"];
$this->stre... | php | public function connect()
{
if($this->stream !== null) return;
$host = strval($this->config["host"]);
$port = strval($this->config["port"]);
$address = "udp://" . (strstr($host, ":") !== FALSE ? "[" . $host . "]" : $host) . ":" . $port;
$timeout = (int) $this->config["timeout"];
$this->stre... | [
"public",
"function",
"connect",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"stream",
"!==",
"null",
")",
"return",
";",
"$",
"host",
"=",
"strval",
"(",
"$",
"this",
"->",
"config",
"[",
"\"host\"",
"]",
")",
";",
"$",
"port",
"=",
"strval",
"... | Connects to a remote server.
@throws Exception
@return void | [
"Connects",
"to",
"a",
"remote",
"server",
"."
] | train | https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Transport/UDP.php#L44-L63 |
alevilar/ristorantino-vendor | Risto/Controller/Component/RistoAuthComponent.php | RistoAuthComponent.initialize | public function initialize(Controller $controller) {
parent::initialize($controller);
$loginUrl = array(
'plugin' => 'users',
'controller' => 'users',
'action' => 'login',
'admin' => false,
);
if ( !empty( $controller->reque... | php | public function initialize(Controller $controller) {
parent::initialize($controller);
$loginUrl = array(
'plugin' => 'users',
'controller' => 'users',
'action' => 'login',
'admin' => false,
);
if ( !empty( $controller->reque... | [
"public",
"function",
"initialize",
"(",
"Controller",
"$",
"controller",
")",
"{",
"parent",
"::",
"initialize",
"(",
"$",
"controller",
")",
";",
"$",
"loginUrl",
"=",
"array",
"(",
"'plugin'",
"=>",
"'users'",
",",
"'controller'",
"=>",
"'users'",
",",
... | Initializes AuthComponent for use in the controller.
@param Controller $controller A reference to the instantiating controller object
@return void | [
"Initializes",
"AuthComponent",
"for",
"use",
"in",
"the",
"controller",
"."
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Risto/Controller/Component/RistoAuthComponent.php#L57-L72 |
alevilar/ristorantino-vendor | Risto/Controller/Component/RistoAuthComponent.php | RistoAuthComponent.isAuthorized | public function isAuthorized($user = null, CakeRequest $request = null) {
if (empty($user) && !$this->user()) {
return false;
}
if (empty($user)) {
$user = $this->user();
}
if (empty($request)) {
$request = $this->request;
}
if (empty($this->_authorizeObjects)) {
$this->constructAuthorize();
... | php | public function isAuthorized($user = null, CakeRequest $request = null) {
if (empty($user) && !$this->user()) {
return false;
}
if (empty($user)) {
$user = $this->user();
}
if (empty($request)) {
$request = $this->request;
}
if (empty($this->_authorizeObjects)) {
$this->constructAuthorize();
... | [
"public",
"function",
"isAuthorized",
"(",
"$",
"user",
"=",
"null",
",",
"CakeRequest",
"$",
"request",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"user",
")",
"&&",
"!",
"$",
"this",
"->",
"user",
"(",
")",
")",
"{",
"return",
"false",
... | Al contrario que el isAuthorized que viene en CakePhp
este se fija si algun Adapter retorna false, y entonces retorna false.
el orioginal de Cake hace al reves: con que venga un true. ya le da acceso
a todos
@param array|null $user The user to check the authorization of. If empty the user in the session will be used.... | [
"Al",
"contrario",
"que",
"el",
"isAuthorized",
"que",
"viene",
"en",
"CakePhp",
"este",
"se",
"fija",
"si",
"algun",
"Adapter",
"retorna",
"false",
"y",
"entonces",
"retorna",
"false",
"."
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Risto/Controller/Component/RistoAuthComponent.php#L86-L105 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.register_post_type | private function register_post_type() {
$post_type = $this->get_post_type();
$this->_post_type_obj = register_post_type( $post_type, $this->get_post_type_args() );
if ( is_wp_error( $this->_post_type_obj ) ) {
$this->app->log( $this->_post_type_obj );
return;
}
add_filter( "views_edit-{$post... | php | private function register_post_type() {
$post_type = $this->get_post_type();
$this->_post_type_obj = register_post_type( $post_type, $this->get_post_type_args() );
if ( is_wp_error( $this->_post_type_obj ) ) {
$this->app->log( $this->_post_type_obj );
return;
}
add_filter( "views_edit-{$post... | [
"private",
"function",
"register_post_type",
"(",
")",
"{",
"$",
"post_type",
"=",
"$",
"this",
"->",
"get_post_type",
"(",
")",
";",
"$",
"this",
"->",
"_post_type_obj",
"=",
"register_post_type",
"(",
"$",
"post_type",
",",
"$",
"this",
"->",
"get_post_typ... | register post type
@since 2.9.7 Changed: move register post type from model
@since 2.9.10 Changed: visibility (public to private) | [
"register",
"post",
"type"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L77-L99 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.insert | public function insert( $data, $convert_name = true ) {
$_data = [];
$_data['post_type'] = $this->get_post_type();
$_data['post_title'] = $this->app->utility->array_get( $data, 'post_title', '' );
$_data['post_content'] = $this->app->utility->array_get( $data, 'post_content', '' );
$_data... | php | public function insert( $data, $convert_name = true ) {
$_data = [];
$_data['post_type'] = $this->get_post_type();
$_data['post_title'] = $this->app->utility->array_get( $data, 'post_title', '' );
$_data['post_content'] = $this->app->utility->array_get( $data, 'post_content', '' );
$_data... | [
"public",
"function",
"insert",
"(",
"$",
"data",
",",
"$",
"convert_name",
"=",
"true",
")",
"{",
"$",
"_data",
"=",
"[",
"]",
";",
"$",
"_data",
"[",
"'post_type'",
"]",
"=",
"$",
"this",
"->",
"get_post_type",
"(",
")",
";",
"$",
"_data",
"[",
... | @since 2.9.3
@param array $data
@param bool $convert_name
@return array|bool|int | [
"@since",
"2",
".",
"9",
".",
"3"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L109-L131 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.update | public function update( $data, $where, $convert_name = true ) {
if ( empty( $where['id'] ) && empty( $where['post_id'] ) ) {
return false;
}
if ( ! empty( $where['id'] ) ) {
$d = $this->get_data( $where['id'] );
} else {
$d = $this->get_related_data( $where['post_id'] );
}
if ( empty( $d ) ) {
r... | php | public function update( $data, $where, $convert_name = true ) {
if ( empty( $where['id'] ) && empty( $where['post_id'] ) ) {
return false;
}
if ( ! empty( $where['id'] ) ) {
$d = $this->get_data( $where['id'] );
} else {
$d = $this->get_related_data( $where['post_id'] );
}
if ( empty( $d ) ) {
r... | [
"public",
"function",
"update",
"(",
"$",
"data",
",",
"$",
"where",
",",
"$",
"convert_name",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"where",
"[",
"'id'",
"]",
")",
"&&",
"empty",
"(",
"$",
"where",
"[",
"'post_id'",
"]",
")",
")",... | @since 2.9.3
@param array $data
@param array $where
@param bool $convert_name
@return array|bool|int | [
"@since",
"2",
".",
"9",
".",
"3"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L142-L177 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.user_can | public function user_can( $capability ) {
if ( ! ( $this->_post_type_obj instanceof \WP_Post_Type ) ) {
return false;
}
return ! empty( $this->_post_type_obj->cap->$capability );
} | php | public function user_can( $capability ) {
if ( ! ( $this->_post_type_obj instanceof \WP_Post_Type ) ) {
return false;
}
return ! empty( $this->_post_type_obj->cap->$capability );
} | [
"public",
"function",
"user_can",
"(",
"$",
"capability",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"_post_type_obj",
"instanceof",
"\\",
"WP_Post_Type",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"!",
"empty",
"(",
"$",
"this",
"->"... | @since 2.9.10
@param $capability
@return bool | [
"@since",
"2",
".",
"9",
".",
"10"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L218-L224 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.get_post_type_args | public function get_post_type_args( $capabilities = null ) {
if ( ! isset( $capabilities ) ) {
$capabilities = $this->get_capabilities();
}
return $this->apply_custom_post_filters( 'args', [
'labels' => $this->get_post_type_labels(),
'description' => '',
'public' => ... | php | public function get_post_type_args( $capabilities = null ) {
if ( ! isset( $capabilities ) ) {
$capabilities = $this->get_capabilities();
}
return $this->apply_custom_post_filters( 'args', [
'labels' => $this->get_post_type_labels(),
'description' => '',
'public' => ... | [
"public",
"function",
"get_post_type_args",
"(",
"$",
"capabilities",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"capabilities",
")",
")",
"{",
"$",
"capabilities",
"=",
"$",
"this",
"->",
"get_capabilities",
"(",
")",
";",
"}",
"return",
... | @param null|array $capabilities
@return array | [
"@param",
"null|array",
"$capabilities"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L241-L264 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.posts_search | public function posts_search(
/** @noinspection PhpUnusedParameterInspection */
$search, $wp_query
) {
if ( ! $wp_query->is_search() || ! $wp_query->is_main_query() || ! is_admin() || empty( $wp_query->query_vars['search_terms'] ) ) {
return $search;
}
$fields = $this->get_search_fields();
if ( empty( ... | php | public function posts_search(
/** @noinspection PhpUnusedParameterInspection */
$search, $wp_query
) {
if ( ! $wp_query->is_search() || ! $wp_query->is_main_query() || ! is_admin() || empty( $wp_query->query_vars['search_terms'] ) ) {
return $search;
}
$fields = $this->get_search_fields();
if ( empty( ... | [
"public",
"function",
"posts_search",
"(",
"/** @noinspection PhpUnusedParameterInspection */",
"$",
"search",
",",
"$",
"wp_query",
")",
"{",
"if",
"(",
"!",
"$",
"wp_query",
"->",
"is_search",
"(",
")",
"||",
"!",
"$",
"wp_query",
"->",
"is_main_query",
"(",
... | @param string $search
@param \WP_Query $wp_query
@return string | [
"@param",
"string",
"$search",
"@param",
"\\",
"WP_Query",
"$wp_query"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L338-L386 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.posts_join | public function posts_join(
/** @noinspection PhpUnusedParameterInspection */
$join, $wp_query
) {
/** @var \wpdb $wpdb */
global $wpdb;
$table = $this->app->db->get_table( $this->get_related_table_name() );
$join .= " INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID ";
return $join;
} | php | public function posts_join(
/** @noinspection PhpUnusedParameterInspection */
$join, $wp_query
) {
/** @var \wpdb $wpdb */
global $wpdb;
$table = $this->app->db->get_table( $this->get_related_table_name() );
$join .= " INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID ";
return $join;
} | [
"public",
"function",
"posts_join",
"(",
"/** @noinspection PhpUnusedParameterInspection */",
"$",
"join",
",",
"$",
"wp_query",
")",
"{",
"/** @var \\wpdb $wpdb */",
"global",
"$",
"wpdb",
";",
"$",
"table",
"=",
"$",
"this",
"->",
"app",
"->",
"db",
"->",
"get... | @param string $join
@param \WP_Query $wp_query
@return string | [
"@param",
"string",
"$join",
"@param",
"\\",
"WP_Query",
"$wp_query"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L401-L411 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.manage_posts_columns | public function manage_posts_columns( $columns, $sortable = false ) {
if ( ! $sortable ) {
$title = $this->get_post_column_title();
! isset( $title ) and isset( $columns['title'] ) and $title = $columns['title'];
$date = isset( $columns['date'] ) ? $columns['date'] : null;
unset( $columns['date'] );
}
... | php | public function manage_posts_columns( $columns, $sortable = false ) {
if ( ! $sortable ) {
$title = $this->get_post_column_title();
! isset( $title ) and isset( $columns['title'] ) and $title = $columns['title'];
$date = isset( $columns['date'] ) ? $columns['date'] : null;
unset( $columns['date'] );
}
... | [
"public",
"function",
"manage_posts_columns",
"(",
"$",
"columns",
",",
"$",
"sortable",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"sortable",
")",
"{",
"$",
"title",
"=",
"$",
"this",
"->",
"get_post_column_title",
"(",
")",
";",
"!",
"isset",
"(",... | @param array $columns
@param bool $sortable
@return array | [
"@param",
"array",
"$columns",
"@param",
"bool",
"$sortable"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L419-L436 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.pre_filter_posts_columns | protected function pre_filter_posts_columns( $columns, $sortable = false ) {
// for cocoon
unset( $columns['thumbnail'] );
unset( $columns['memo'] );
$_columns = $this->app->db->get_columns( $this->get_related_table_name() );
foreach ( $this->get_manage_posts_columns() as $k => $v ) {
if ( $sortable && ( ... | php | protected function pre_filter_posts_columns( $columns, $sortable = false ) {
// for cocoon
unset( $columns['thumbnail'] );
unset( $columns['memo'] );
$_columns = $this->app->db->get_columns( $this->get_related_table_name() );
foreach ( $this->get_manage_posts_columns() as $k => $v ) {
if ( $sortable && ( ... | [
"protected",
"function",
"pre_filter_posts_columns",
"(",
"$",
"columns",
",",
"$",
"sortable",
"=",
"false",
")",
"{",
"// for cocoon",
"unset",
"(",
"$",
"columns",
"[",
"'thumbnail'",
"]",
")",
";",
"unset",
"(",
"$",
"columns",
"[",
"'memo'",
"]",
")",... | @since 2.8.5 Fixed: hide unnecessary columns
@param array $columns
@param bool $sortable
@return array | [
"@since",
"2",
".",
"8",
".",
"5",
"Fixed",
":",
"hide",
"unnecessary",
"columns"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L453-L481 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.set_post_data | protected function set_post_data( $data, $post ) {
$data['post_title'] = $post->post_title;
$data['post'] = $post;
if ( $this->user_can( 'read_post' ) ) {
$data['edit_link'] = get_edit_post_link( $post->ID );
}
foreach ( $this->get_data_field_settings() as $k => $v ) {
$data[ $k ] = $this->saniti... | php | protected function set_post_data( $data, $post ) {
$data['post_title'] = $post->post_title;
$data['post'] = $post;
if ( $this->user_can( 'read_post' ) ) {
$data['edit_link'] = get_edit_post_link( $post->ID );
}
foreach ( $this->get_data_field_settings() as $k => $v ) {
$data[ $k ] = $this->saniti... | [
"protected",
"function",
"set_post_data",
"(",
"$",
"data",
",",
"$",
"post",
")",
"{",
"$",
"data",
"[",
"'post_title'",
"]",
"=",
"$",
"post",
"->",
"post_title",
";",
"$",
"data",
"[",
"'post'",
"]",
"=",
"$",
"post",
";",
"if",
"(",
"$",
"this"... | @param array $data
@param \WP_Post $post
@return array | [
"@param",
"array",
"$data",
"@param",
"\\",
"WP_Post",
"$post"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L560-L572 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.get_related_data | public function get_related_data( $post_id ) {
if ( ! isset( $this->_related_data[ $post_id ] ) ) {
$table = $this->get_related_table_name();
$data = $this->app->db->select_row( $table, [
'post_id' => $post_id,
] );
if ( empty( $data ) ) {
$data = false;
} else {
$post = get_post( $post_id... | php | public function get_related_data( $post_id ) {
if ( ! isset( $this->_related_data[ $post_id ] ) ) {
$table = $this->get_related_table_name();
$data = $this->app->db->select_row( $table, [
'post_id' => $post_id,
] );
if ( empty( $data ) ) {
$data = false;
} else {
$post = get_post( $post_id... | [
"public",
"function",
"get_related_data",
"(",
"$",
"post_id",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_related_data",
"[",
"$",
"post_id",
"]",
")",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"get_related_table_name",
"(",
")"... | @param int $post_id
@return array|false | [
"@param",
"int",
"$post_id"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L579-L600 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.get_data | public function get_data( $id, $is_valid = true ) {
$table = $this->get_related_table_name();
$data = $this->app->db->select_row( $table, [
'id' => $id,
] );
if ( empty( $data ) ) {
return false;
}
$post_id = $data['post_id'];
$post = get_post( $post_id );
if ( empty( $post ) || $post->post_ty... | php | public function get_data( $id, $is_valid = true ) {
$table = $this->get_related_table_name();
$data = $this->app->db->select_row( $table, [
'id' => $id,
] );
if ( empty( $data ) ) {
return false;
}
$post_id = $data['post_id'];
$post = get_post( $post_id );
if ( empty( $post ) || $post->post_ty... | [
"public",
"function",
"get_data",
"(",
"$",
"id",
",",
"$",
"is_valid",
"=",
"true",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"get_related_table_name",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"app",
"->",
"db",
"->",
"select_row",
... | @param int $id
@param bool $is_valid
@return array|false | [
"@param",
"int",
"$id",
"@param",
"bool",
"$is_valid"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L608-L623 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.list_data | public function list_data( $is_valid = true, $per_page = null, $page = 1, $where = [], $orderby = null ) {
/** @var \wpdb $wpdb */
global $wpdb;
$table = $this->get_related_table_name();
$limit = $per_page;
$page = max( 1, $page );
$table = [
[ $table, 't' ],
[
[ $wpdb->posts,... | php | public function list_data( $is_valid = true, $per_page = null, $page = 1, $where = [], $orderby = null ) {
/** @var \wpdb $wpdb */
global $wpdb;
$table = $this->get_related_table_name();
$limit = $per_page;
$page = max( 1, $page );
$table = [
[ $table, 't' ],
[
[ $wpdb->posts,... | [
"public",
"function",
"list_data",
"(",
"$",
"is_valid",
"=",
"true",
",",
"$",
"per_page",
"=",
"null",
",",
"$",
"page",
"=",
"1",
",",
"$",
"where",
"=",
"[",
"]",
",",
"$",
"orderby",
"=",
"null",
")",
"{",
"/** @var \\wpdb $wpdb */",
"global",
"... | @param bool $is_valid
@param int|null $per_page
@param int $page
@param array $where
@param null|array $orderby
@return array | [
"@param",
"bool",
"$is_valid",
"@param",
"int|null",
"$per_page",
"@param",
"int",
"$page",
"@param",
"array",
"$where",
"@param",
"null|array",
"$orderby"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L634-L685 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.update_data | public function update_data( $params, $where, $post, $update ) {
$table = $this->get_related_table_name();
$params = array_merge( $params, $this->get_update_data_params( $post, $update ) );
list( $params, $where ) = $this->update_misc( $params, $where, $post, $update );
return $this->app->db->insert_or_update... | php | public function update_data( $params, $where, $post, $update ) {
$table = $this->get_related_table_name();
$params = array_merge( $params, $this->get_update_data_params( $post, $update ) );
list( $params, $where ) = $this->update_misc( $params, $where, $post, $update );
return $this->app->db->insert_or_update... | [
"public",
"function",
"update_data",
"(",
"$",
"params",
",",
"$",
"where",
",",
"$",
"post",
",",
"$",
"update",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"get_related_table_name",
"(",
")",
";",
"$",
"params",
"=",
"array_merge",
"(",
"$",
"p... | @param array $params
@param array $where
@param \WP_Post $post
@param bool $update
@return int|false | [
"@param",
"array",
"$params",
"@param",
"array",
"$where",
"@param",
"\\",
"WP_Post",
"$post",
"@param",
"bool",
"$update"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L704-L710 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.get_update_data_params | public function get_update_data_params(
/** @noinspection PhpUnusedParameterInspection */
$post, $update
) {
$params = [];
foreach ( $this->get_data_field_settings() as $k => $v ) {
$params[ $k ] = $this->get_post_field( $k, $update || ! $v['required'] ? null : $v['default'], null, $v );
$params[ $k ] = ... | php | public function get_update_data_params(
/** @noinspection PhpUnusedParameterInspection */
$post, $update
) {
$params = [];
foreach ( $this->get_data_field_settings() as $k => $v ) {
$params[ $k ] = $this->get_post_field( $k, $update || ! $v['required'] ? null : $v['default'], null, $v );
$params[ $k ] = ... | [
"public",
"function",
"get_update_data_params",
"(",
"/** @noinspection PhpUnusedParameterInspection */",
"$",
"post",
",",
"$",
"update",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_data_field_settings",
"(",
")",
"as",
... | @since 2.9.6 Improved: behavior of column which has default and nullable
@param \WP_Post $post
@param bool $update
@return array | [
"@since",
"2",
".",
"9",
".",
"6",
"Improved",
":",
"behavior",
"of",
"column",
"which",
"has",
"default",
"and",
"nullable"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L754-L769 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.delete_data | public function delete_data( $post_id ) {
$table = $this->get_related_table_name();
$this->delete_misc( $post_id );
return $this->app->db->delete( $table, [
'post_id' => $post_id,
] );
} | php | public function delete_data( $post_id ) {
$table = $this->get_related_table_name();
$this->delete_misc( $post_id );
return $this->app->db->delete( $table, [
'post_id' => $post_id,
] );
} | [
"public",
"function",
"delete_data",
"(",
"$",
"post_id",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"get_related_table_name",
"(",
")",
";",
"$",
"this",
"->",
"delete_misc",
"(",
"$",
"post_id",
")",
";",
"return",
"$",
"this",
"->",
"app",
"->"... | @param int $post_id
@return bool|false|int | [
"@param",
"int",
"$post_id"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L785-L792 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.get_validation_var | protected function get_validation_var( $key, $post_array ) {
return $this->app->utility->array_get( $post_array, $this->get_post_field_name( $key ) );
} | php | protected function get_validation_var( $key, $post_array ) {
return $this->app->utility->array_get( $post_array, $this->get_post_field_name( $key ) );
} | [
"protected",
"function",
"get_validation_var",
"(",
"$",
"key",
",",
"$",
"post_array",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"->",
"utility",
"->",
"array_get",
"(",
"$",
"post_array",
",",
"$",
"this",
"->",
"get_post_field_name",
"(",
"$",
"key"... | @since 2.9.0
@param string $key
@param array $post_array
@return mixed | [
"@since",
"2",
".",
"9",
".",
"0"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L825-L827 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.get_post_field | protected function get_post_field( $key, $default = null, $post_array = null, $setting = [], $filter = true ) {
if ( isset( $post_array ) ) {
$value = $this->app->utility->array_get( $post_array, $this->get_post_field_name( $key ), $default );
} else {
$value = $this->app->input->post( $this->get_post_field_n... | php | protected function get_post_field( $key, $default = null, $post_array = null, $setting = [], $filter = true ) {
if ( isset( $post_array ) ) {
$value = $this->app->utility->array_get( $post_array, $this->get_post_field_name( $key ), $default );
} else {
$value = $this->app->input->post( $this->get_post_field_n... | [
"protected",
"function",
"get_post_field",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
",",
"$",
"post_array",
"=",
"null",
",",
"$",
"setting",
"=",
"[",
"]",
",",
"$",
"filter",
"=",
"true",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"post_ar... | @since 2.9.0 Changed: consider null setting
@since 2.9.0 Added: filter value
@param string $key
@param mixed $default
@param array|null $post_array
@param array $setting
@param bool $filter
@return mixed | [
"@since",
"2",
".",
"9",
".",
"0",
"Changed",
":",
"consider",
"null",
"setting",
"@since",
"2",
".",
"9",
".",
"0",
"Added",
":",
"filter",
"value"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L841-L857 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.output_edit_form | public function output_edit_form( $post ) {
$params = $this->get_edit_form_params( $post );
$this->before_output_edit_form( $post, $params );
$this->add_style_view( 'admin/style/custom_post', $params );
$this->add_style_view( 'admin/style/custom_post/' . $this->get_post_type_slug(), $params );
$this->add_scri... | php | public function output_edit_form( $post ) {
$params = $this->get_edit_form_params( $post );
$this->before_output_edit_form( $post, $params );
$this->add_style_view( 'admin/style/custom_post', $params );
$this->add_style_view( 'admin/style/custom_post/' . $this->get_post_type_slug(), $params );
$this->add_scri... | [
"public",
"function",
"output_edit_form",
"(",
"$",
"post",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"get_edit_form_params",
"(",
"$",
"post",
")",
";",
"$",
"this",
"->",
"before_output_edit_form",
"(",
"$",
"post",
",",
"$",
"params",
")",
";",... | @since 2.8.3 Added: default form view
@since 2.9.0 Improved: not load view if no column
@param \WP_Post $post | [
"@since",
"2",
".",
"8",
".",
"3",
"Added",
":",
"default",
"form",
"view",
"@since",
"2",
".",
"9",
".",
"0",
"Improved",
":",
"not",
"load",
"view",
"if",
"no",
"column"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L922-L937 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.get_edit_form_params | protected function get_edit_form_params( $post ) {
return $this->filter_edit_form_params( [
'post' => $post,
'data' => $this->get_related_data( $post->ID ),
'prefix' => $this->get_post_field_name_prefix(),
'columns' => $this->filter_table_columns( $this->get_table_columns() ),
], $post );
} | php | protected function get_edit_form_params( $post ) {
return $this->filter_edit_form_params( [
'post' => $post,
'data' => $this->get_related_data( $post->ID ),
'prefix' => $this->get_post_field_name_prefix(),
'columns' => $this->filter_table_columns( $this->get_table_columns() ),
], $post );
} | [
"protected",
"function",
"get_edit_form_params",
"(",
"$",
"post",
")",
"{",
"return",
"$",
"this",
"->",
"filter_edit_form_params",
"(",
"[",
"'post'",
"=>",
"$",
"post",
",",
"'data'",
"=>",
"$",
"this",
"->",
"get_related_data",
"(",
"$",
"post",
"->",
... | @since 2.8.3 Added: columns parameter
@param \WP_Post $post
@return array | [
"@since",
"2",
".",
"8",
".",
"3",
"Added",
":",
"columns",
"parameter"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L969-L976 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.validate_input | public function validate_input( $post_array = null ) {
! isset( $post_array ) and $post_array = $this->app->input->post();
$errors = [];
foreach ( $this->get_data_field_settings() as $k => $v ) {
$param = $this->get_post_field( $k, null, $post_array, $v );
$param = $this->sanitize_input( $param, $v['t... | php | public function validate_input( $post_array = null ) {
! isset( $post_array ) and $post_array = $this->app->input->post();
$errors = [];
foreach ( $this->get_data_field_settings() as $k => $v ) {
$param = $this->get_post_field( $k, null, $post_array, $v );
$param = $this->sanitize_input( $param, $v['t... | [
"public",
"function",
"validate_input",
"(",
"$",
"post_array",
"=",
"null",
")",
"{",
"!",
"isset",
"(",
"$",
"post_array",
")",
"and",
"$",
"post_array",
"=",
"$",
"this",
"->",
"app",
"->",
"input",
"->",
"post",
"(",
")",
";",
"$",
"errors",
"=",... | @since 2.9.0 Improved: validation
@param array|null $post_array
@return array | [
"@since",
"2",
".",
"9",
".",
"0",
"Improved",
":",
"validation"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L1022-L1041 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.get_error_messages | public function get_error_messages(
/** @noinspection PhpUnusedParameterInspection */
$key, $errors
) {
$columns = $this->app->db->get_columns( $this->get_related_table_name() );
unset( $columns['id'] );
$columns = $this->app->utility->array_combine( $columns, 'name' );
return array_map( function ( $d ) u... | php | public function get_error_messages(
/** @noinspection PhpUnusedParameterInspection */
$key, $errors
) {
$columns = $this->app->db->get_columns( $this->get_related_table_name() );
unset( $columns['id'] );
$columns = $this->app->utility->array_combine( $columns, 'name' );
return array_map( function ( $d ) u... | [
"public",
"function",
"get_error_messages",
"(",
"/** @noinspection PhpUnusedParameterInspection */",
"$",
"key",
",",
"$",
"errors",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"app",
"->",
"db",
"->",
"get_columns",
"(",
"$",
"this",
"->",
"get_related_t... | @param string $key
@param array $errors
@return array | [
"@param",
"string",
"$key",
"@param",
"array",
"$errors"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L1082-L1095 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.table_column_to_name | protected function table_column_to_name( $key, $columns ) {
$name = $this->get_table_column_name( $key );
if ( isset( $name ) ) {
return $name;
}
return isset( $columns[ $key ]['comment'] ) ? $columns[ $key ]['comment'] : $key;
} | php | protected function table_column_to_name( $key, $columns ) {
$name = $this->get_table_column_name( $key );
if ( isset( $name ) ) {
return $name;
}
return isset( $columns[ $key ]['comment'] ) ? $columns[ $key ]['comment'] : $key;
} | [
"protected",
"function",
"table_column_to_name",
"(",
"$",
"key",
",",
"$",
"columns",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"get_table_column_name",
"(",
"$",
"key",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"name",
")",
")",
"{",
"return",
"... | @param string $key
@param array $columns
@return string | [
"@param",
"string",
"$key",
"@param",
"array",
"$columns"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L1103-L1110 |
technote-space/wordpress-plugin-base | src/traits/helper/custom_post.php | Custom_Post.get_edit_post_link | public function get_edit_post_link( $post_id ) {
if ( ! $post = get_post( $post_id ) ) {
return admin_url( 'edit.php?post_type=' . $this->get_post_type() );
}
$post_type_object = get_post_type_object( $post->post_type );
if ( ! $post_type_object ) {
return admin_url( 'edit.php?post_type=' . $this->get_pos... | php | public function get_edit_post_link( $post_id ) {
if ( ! $post = get_post( $post_id ) ) {
return admin_url( 'edit.php?post_type=' . $this->get_post_type() );
}
$post_type_object = get_post_type_object( $post->post_type );
if ( ! $post_type_object ) {
return admin_url( 'edit.php?post_type=' . $this->get_pos... | [
"public",
"function",
"get_edit_post_link",
"(",
"$",
"post_id",
")",
"{",
"if",
"(",
"!",
"$",
"post",
"=",
"get_post",
"(",
"$",
"post_id",
")",
")",
"{",
"return",
"admin_url",
"(",
"'edit.php?post_type='",
".",
"$",
"this",
"->",
"get_post_type",
"(",
... | @param int $post_id
@return string | [
"@param",
"int",
"$post_id"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/helper/custom_post.php#L1138-L1149 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.