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 |
|---|---|---|---|---|---|---|---|---|---|---|
cpliakas/search-framework | src/Search/Framework/SchemaLoader.php | SchemaLoader.load | public function load()
{
$log = $this->_agent->getLogger();
$context = array('collection' => $this->_collection->getId());
// Allow the schema to be loaded from another source.
$event = new SchemaLoaderEvent($this->_agent, $this->_collection);
$this->_agent->dispatchEvent(Se... | php | public function load()
{
$log = $this->_agent->getLogger();
$context = array('collection' => $this->_collection->getId());
// Allow the schema to be loaded from another source.
$event = new SchemaLoaderEvent($this->_agent, $this->_collection);
$this->_agent->dispatchEvent(Se... | [
"public",
"function",
"load",
"(",
")",
"{",
"$",
"log",
"=",
"$",
"this",
"->",
"_agent",
"->",
"getLogger",
"(",
")",
";",
"$",
"context",
"=",
"array",
"(",
"'collection'",
"=>",
"$",
"this",
"->",
"_collection",
"->",
"getId",
"(",
")",
")",
";... | Parses configuration options from YAML configuration files related to the
configurable object.
This method throws the SearchEvents::CONFIG_LOAD event. If configurations
are loaded during this event, processing stops and the directories are
not scanned for configuration files.
@return array
An associative array of opt... | [
"Parses",
"configuration",
"options",
"from",
"YAML",
"configuration",
"files",
"related",
"to",
"the",
"configurable",
"object",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/SchemaLoader.php#L74-L104 |
LIN3S/WPFoundation | src/LIN3S/WPFoundation/Configuration/Mailer/Mailer.php | Mailer.mailer | public function mailer($phpMailer)
{
if (MAILER_SMTP) {
$phpMailer->isSMTP();
$phpMailer->SMTPAuth = true;
}
$phpMailer->Host = MAILER_HOST;
$phpMailer->Port = MAILER_PORT;
$phpMailer->Username = MAILER_USERNAME;
$phpMailer->Password = MAILER_P... | php | public function mailer($phpMailer)
{
if (MAILER_SMTP) {
$phpMailer->isSMTP();
$phpMailer->SMTPAuth = true;
}
$phpMailer->Host = MAILER_HOST;
$phpMailer->Port = MAILER_PORT;
$phpMailer->Username = MAILER_USERNAME;
$phpMailer->Password = MAILER_P... | [
"public",
"function",
"mailer",
"(",
"$",
"phpMailer",
")",
"{",
"if",
"(",
"MAILER_SMTP",
")",
"{",
"$",
"phpMailer",
"->",
"isSMTP",
"(",
")",
";",
"$",
"phpMailer",
"->",
"SMTPAuth",
"=",
"true",
";",
"}",
"$",
"phpMailer",
"->",
"Host",
"=",
"MAI... | Configures the mailer according to the parameters in "wp-config-custom.php".
@param object $phpMailer The PhpMailer instance | [
"Configures",
"the",
"mailer",
"according",
"to",
"the",
"parameters",
"in",
"wp",
"-",
"config",
"-",
"custom",
".",
"php",
"."
] | train | https://github.com/LIN3S/WPFoundation/blob/4f5674b0544b770809f1ffa7bd7d8fdfe013e4bf/src/LIN3S/WPFoundation/Configuration/Mailer/Mailer.php#L46-L58 |
codezero-be/flash | src/FlashServiceProvider.php | FlashServiceProvider.register | public function register()
{
$this->registerSessionStore();
$this->registerTranslator();
$this->registerFlasher();
$this->registerFlash();
$this->registerFlashAlias();
} | php | public function register()
{
$this->registerSessionStore();
$this->registerTranslator();
$this->registerFlasher();
$this->registerFlash();
$this->registerFlashAlias();
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"registerSessionStore",
"(",
")",
";",
"$",
"this",
"->",
"registerTranslator",
"(",
")",
";",
"$",
"this",
"->",
"registerFlasher",
"(",
")",
";",
"$",
"this",
"->",
"registerFlash",
"(... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/FlashServiceProvider.php#L24-L31 |
codezero-be/flash | src/FlashServiceProvider.php | FlashServiceProvider.registerFlash | private function registerFlash()
{
$this->app->singleton('CodeZero\Flash\Flash', function () {
$config = config('flash');
$session = app()->make('CodeZero\Flash\SessionStore\SessionStore');
$translator = app()->make('CodeZero\Flash\Translator\Translator');
re... | php | private function registerFlash()
{
$this->app->singleton('CodeZero\Flash\Flash', function () {
$config = config('flash');
$session = app()->make('CodeZero\Flash\SessionStore\SessionStore');
$translator = app()->make('CodeZero\Flash\Translator\Translator');
re... | [
"private",
"function",
"registerFlash",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'CodeZero\\Flash\\Flash'",
",",
"function",
"(",
")",
"{",
"$",
"config",
"=",
"config",
"(",
"'flash'",
")",
";",
"$",
"session",
"=",
"app",
"(",
... | Register the Flash binding.
@return void | [
"Register",
"the",
"Flash",
"binding",
"."
] | train | https://github.com/codezero-be/flash/blob/ad65fd730ab5a594f9cf9e8c62b2c16c1eae3ce0/src/FlashServiceProvider.php#L77-L86 |
wpup/digster | src/engines/class-twig-engine.php | Twig_Engine.add_extension | public function add_extension( Twig_ExtensionInterface $extension ) {
$env = $this->instance();
$exts = $env->getExtensions();
if ( isset( $exts[$extension->getName()] ) ) {
return;
}
try {
$env->addExtension( $extension );
} catch ( LogicException $e ) {
return;
}
} | php | public function add_extension( Twig_ExtensionInterface $extension ) {
$env = $this->instance();
$exts = $env->getExtensions();
if ( isset( $exts[$extension->getName()] ) ) {
return;
}
try {
$env->addExtension( $extension );
} catch ( LogicException $e ) {
return;
}
} | [
"public",
"function",
"add_extension",
"(",
"Twig_ExtensionInterface",
"$",
"extension",
")",
"{",
"$",
"env",
"=",
"$",
"this",
"->",
"instance",
"(",
")",
";",
"$",
"exts",
"=",
"$",
"env",
"->",
"getExtensions",
"(",
")",
";",
"if",
"(",
"isset",
"(... | Add extension if it don't exists.
@param \Twig_ExtensionInterface $extension | [
"Add",
"extension",
"if",
"it",
"don",
"t",
"exists",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/engines/class-twig-engine.php#L34-L47 |
wpup/digster | src/engines/class-twig-engine.php | Twig_Engine.boot | private function boot() {
list( $locations, $config ) = $this->get_engine_config();
$loader = new Twig_Loader_Filesystem( $locations );
$env = new Twig_Environment( $loader, $config );
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
$env->addExtension( new Twig_Extension_Debug() );
}
return $env;
} | php | private function boot() {
list( $locations, $config ) = $this->get_engine_config();
$loader = new Twig_Loader_Filesystem( $locations );
$env = new Twig_Environment( $loader, $config );
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
$env->addExtension( new Twig_Extension_Debug() );
}
return $env;
} | [
"private",
"function",
"boot",
"(",
")",
"{",
"list",
"(",
"$",
"locations",
",",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"get_engine_config",
"(",
")",
";",
"$",
"loader",
"=",
"new",
"Twig_Loader_Filesystem",
"(",
"$",
"locations",
")",
";",
"$",... | Boot Twig environment.
@return \Twig_Environment | [
"Boot",
"Twig",
"environment",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/engines/class-twig-engine.php#L54-L65 |
wpup/digster | src/engines/class-twig-engine.php | Twig_Engine.instance | public function instance() {
if ( ! isset( self::$environment ) ) {
self::$environment = $this->boot();
}
return self::$environment;
} | php | public function instance() {
if ( ! isset( self::$environment ) ) {
self::$environment = $this->boot();
}
return self::$environment;
} | [
"public",
"function",
"instance",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"environment",
")",
")",
"{",
"self",
"::",
"$",
"environment",
"=",
"$",
"this",
"->",
"boot",
"(",
")",
";",
"}",
"return",
"self",
"::",
"$",
"en... | Get the Twig environment instance.
@return \Twig_Environment | [
"Get",
"the",
"Twig",
"environment",
"instance",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/engines/class-twig-engine.php#L72-L78 |
wpup/digster | src/engines/class-twig-engine.php | Twig_Engine.register_extensions | public function register_extensions() {
$extensions = func_get_args();
foreach ( $extensions as $extension ) {
if ( $extension instanceof Twig_ExtensionInterface ) {
$this->add_extension( $extension );
} else if ( is_string( $extension ) && class_exists( $extension ) ) {
$this->add_extension( new $ex... | php | public function register_extensions() {
$extensions = func_get_args();
foreach ( $extensions as $extension ) {
if ( $extension instanceof Twig_ExtensionInterface ) {
$this->add_extension( $extension );
} else if ( is_string( $extension ) && class_exists( $extension ) ) {
$this->add_extension( new $ex... | [
"public",
"function",
"register_extensions",
"(",
")",
"{",
"$",
"extensions",
"=",
"func_get_args",
"(",
")",
";",
"foreach",
"(",
"$",
"extensions",
"as",
"$",
"extension",
")",
"{",
"if",
"(",
"$",
"extension",
"instanceof",
"Twig_ExtensionInterface",
")",
... | Register Twig extensions that use `Twig_ExtensionInterface`. | [
"Register",
"Twig",
"extensions",
"that",
"use",
"Twig_ExtensionInterface",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/engines/class-twig-engine.php#L101-L115 |
wpup/digster | src/engines/class-twig-engine.php | Twig_Engine.render | public function render( $view, array $data = [] ) {
if ( in_array( $view, $this->extensions ) ) {
return '';
}
try {
return $this->instance()->render( $view, $data );
} catch ( Twig_Error $e ) {
do_action( 'digster/twig_render_exception', $e );
$this->render_error( $e );
}
} | php | public function render( $view, array $data = [] ) {
if ( in_array( $view, $this->extensions ) ) {
return '';
}
try {
return $this->instance()->render( $view, $data );
} catch ( Twig_Error $e ) {
do_action( 'digster/twig_render_exception', $e );
$this->render_error( $e );
}
} | [
"public",
"function",
"render",
"(",
"$",
"view",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"view",
",",
"$",
"this",
"->",
"extensions",
")",
")",
"{",
"return",
"''",
";",
"}",
"try",
"{",
"return",
... | Get the rendered view string.
@param string $view
@param array $data | [
"Get",
"the",
"rendered",
"view",
"string",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/engines/class-twig-engine.php#L123-L134 |
wpup/digster | src/engines/class-twig-engine.php | Twig_Engine.render_error | protected function render_error( Twig_Error $e ) {
$title = 'Error';
$message = 'An error occurred while rendering the template for this page. Turn on the "debug" option for more information.';
$file = '';
$code = '';
list( $locations, $config ) = $this->get_engine_config();
if ( $config['debug'] ... | php | protected function render_error( Twig_Error $e ) {
$title = 'Error';
$message = 'An error occurred while rendering the template for this page. Turn on the "debug" option for more information.';
$file = '';
$code = '';
list( $locations, $config ) = $this->get_engine_config();
if ( $config['debug'] ... | [
"protected",
"function",
"render_error",
"(",
"Twig_Error",
"$",
"e",
")",
"{",
"$",
"title",
"=",
"'Error'",
";",
"$",
"message",
"=",
"'An error occurred while rendering the template for this page. Turn on the \"debug\" option for more information.'",
";",
"$",
"file",
"=... | Render error view.
@param \Twig_Error $e | [
"Render",
"error",
"view",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/engines/class-twig-engine.php#L141-L202 |
eleven-lab/php-ogc | src/DataTypes/LineString.php | LineString.fromArray | public static function fromArray(array $points)
{
$parsed_points = array_map(function($p){
if( !is_array($p) or sizeof($p) != 2)
throw new GeoSpatialException('Error: array of array containing lat, lon expected.');
return new Point($p[0], $p[1]);
}, $points);
... | php | public static function fromArray(array $points)
{
$parsed_points = array_map(function($p){
if( !is_array($p) or sizeof($p) != 2)
throw new GeoSpatialException('Error: array of array containing lat, lon expected.');
return new Point($p[0], $p[1]);
}, $points);
... | [
"public",
"static",
"function",
"fromArray",
"(",
"array",
"$",
"points",
")",
"{",
"$",
"parsed_points",
"=",
"array_map",
"(",
"function",
"(",
"$",
"p",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"p",
")",
"or",
"sizeof",
"(",
"$",
"p",
")"... | A Linestring could be constructed with an array of points-array.
es. [[lat, lon], [lat, lon], [lat, lon], ..]
@param array $points
@return LineString | [
"A",
"Linestring",
"could",
"be",
"constructed",
"with",
"an",
"array",
"of",
"points",
"-",
"array",
"."
] | train | https://github.com/eleven-lab/php-ogc/blob/ba15cea3ba71a65f14f3cadcb08bfce34f4489ce/src/DataTypes/LineString.php#L49-L57 |
eleven-lab/php-ogc | src/DataTypes/LineString.php | LineString.fromString | public static function fromString($points, $points_separator = ",", $coords_separator = " ")
{
if($points_separator == $coords_separator)
throw new GeoSpatialException("Error: separators must be different");
$parsed_points = array_map(function($p) use ($coords_separator){
ret... | php | public static function fromString($points, $points_separator = ",", $coords_separator = " ")
{
if($points_separator == $coords_separator)
throw new GeoSpatialException("Error: separators must be different");
$parsed_points = array_map(function($p) use ($coords_separator){
ret... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"points",
",",
"$",
"points_separator",
"=",
"\",\"",
",",
"$",
"coords_separator",
"=",
"\" \"",
")",
"{",
"if",
"(",
"$",
"points_separator",
"==",
"$",
"coords_separator",
")",
"throw",
"new",
"GeoSp... | A Linestring could be instantiated using a string where points are divided by a "," and coordinates
are divided by " ". Separators must be different.
es. "lat lon, lat lon"
@param $points
@param string $points_separator
@param string $coords_separator
@throws GeoSpatialException
@return LineString | [
"A",
"Linestring",
"could",
"be",
"instantiated",
"using",
"a",
"string",
"where",
"points",
"are",
"divided",
"by",
"a",
"and",
"coordinates",
"are",
"divided",
"by",
".",
"Separators",
"must",
"be",
"different",
".",
"es",
".",
"lat",
"lon",
"lat",
"lon"... | train | https://github.com/eleven-lab/php-ogc/blob/ba15cea3ba71a65f14f3cadcb08bfce34f4489ce/src/DataTypes/LineString.php#L70-L78 |
eleven-lab/php-ogc | src/DataTypes/LineString.php | LineString.isCircular | public function isCircular()
{
return count($this->points) > 3 && $this->points[0] == $this->points[ count($this->points) -1 ];
} | php | public function isCircular()
{
return count($this->points) > 3 && $this->points[0] == $this->points[ count($this->points) -1 ];
} | [
"public",
"function",
"isCircular",
"(",
")",
"{",
"return",
"count",
"(",
"$",
"this",
"->",
"points",
")",
">",
"3",
"&&",
"$",
"this",
"->",
"points",
"[",
"0",
"]",
"==",
"$",
"this",
"->",
"points",
"[",
"count",
"(",
"$",
"this",
"->",
"poi... | Check if the LineString is circular, that is the first and the last Point are the same.
@return bool | [
"Check",
"if",
"the",
"LineString",
"is",
"circular",
"that",
"is",
"the",
"first",
"and",
"the",
"last",
"Point",
"are",
"the",
"same",
"."
] | train | https://github.com/eleven-lab/php-ogc/blob/ba15cea3ba71a65f14f3cadcb08bfce34f4489ce/src/DataTypes/LineString.php#L115-L118 |
eleven-lab/php-ogc | src/DataTypes/LineString.php | LineString.lenght | public function lenght($provider = "haversine")
{
$length = 0;
for($i = 0; $i < count($this)-2 ; $i++ ){
$length += Point::distance($this->points[$i], $this->points[$i+1], $provider);
}
return $length;
} | php | public function lenght($provider = "haversine")
{
$length = 0;
for($i = 0; $i < count($this)-2 ; $i++ ){
$length += Point::distance($this->points[$i], $this->points[$i+1], $provider);
}
return $length;
} | [
"public",
"function",
"lenght",
"(",
"$",
"provider",
"=",
"\"haversine\"",
")",
"{",
"$",
"length",
"=",
"0",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
"this",
")",
"-",
"2",
";",
"$",
"i",
"++",
")",
"{",
... | Return the lenght of the linestring expressed in meters.
@return int | [
"Return",
"the",
"lenght",
"of",
"the",
"linestring",
"expressed",
"in",
"meters",
"."
] | train | https://github.com/eleven-lab/php-ogc/blob/ba15cea3ba71a65f14f3cadcb08bfce34f4489ce/src/DataTypes/LineString.php#L126-L134 |
eleven-lab/php-ogc | src/DataTypes/LineString.php | LineString.insertPoint | public function insertPoint(Point $p)
{
//echo "aggiungo punto p:$p\n";
//echo "lunghezz attuale ls: " . count($this)."\n";
// Se il punto è già presente nella LineString non faccio modifiche
if(array_search($p, $this->points) !== false){
//echo "punto già presente";... | php | public function insertPoint(Point $p)
{
//echo "aggiungo punto p:$p\n";
//echo "lunghezz attuale ls: " . count($this)."\n";
// Se il punto è già presente nella LineString non faccio modifiche
if(array_search($p, $this->points) !== false){
//echo "punto già presente";... | [
"public",
"function",
"insertPoint",
"(",
"Point",
"$",
"p",
")",
"{",
"//echo \"aggiungo punto p:$p\\n\";",
"//echo \"lunghezz attuale ls: \" . count($this).\"\\n\";",
"// Se il punto è già presente nella LineString non faccio modifiche",
"if",
"(",
"array_search",
"(",
"$",
"p",
... | /*
Insert a Point into the LineString,
Per ogni step p1-p2 dei punti che compongono la LineString, calcolo d1=d(p,p1) e d2=d(p,p2).
Seleziono lo step come candidato all'inserimento se d1+d2 <= d(p1,p2)*soglia_di_tolleranza.
TODO: aggiungere condizione più forte oltre a quella con la coppia di punti in osservazione, ... | [
"/",
"*",
"Insert",
"a",
"Point",
"into",
"the",
"LineString"
] | train | https://github.com/eleven-lab/php-ogc/blob/ba15cea3ba71a65f14f3cadcb08bfce34f4489ce/src/DataTypes/LineString.php#L151-L183 |
eleven-lab/php-ogc | src/DataTypes/LineString.php | LineString.split | public function split(Point $split)
{
// if the point split is the first or the last, we returns the whole linestring
reset($this->points);
if( $this->points[0] == $split){
return [$split, $this];
}
if ($this->points[count($this->points)-1] == $split){
... | php | public function split(Point $split)
{
// if the point split is the first or the last, we returns the whole linestring
reset($this->points);
if( $this->points[0] == $split){
return [$split, $this];
}
if ($this->points[count($this->points)-1] == $split){
... | [
"public",
"function",
"split",
"(",
"Point",
"$",
"split",
")",
"{",
"// if the point split is the first or the last, we returns the whole linestring",
"reset",
"(",
"$",
"this",
"->",
"points",
")",
";",
"if",
"(",
"$",
"this",
"->",
"points",
"[",
"0",
"]",
"=... | Split the LineString object on the given Point, if present, and returns a tuple (array with two object) composed
by Points, LineStrings or null..
If the given Point is the first of the LineString, it returns the Point as first element of the tuple, and the
remaining LineString as second element of the tuple. Same beha... | [
"Split",
"the",
"LineString",
"object",
"on",
"the",
"given",
"Point",
"if",
"present",
"and",
"returns",
"a",
"tuple",
"(",
"array",
"with",
"two",
"object",
")",
"composed",
"by",
"Points",
"LineStrings",
"or",
"null",
".."
] | train | https://github.com/eleven-lab/php-ogc/blob/ba15cea3ba71a65f14f3cadcb08bfce34f4489ce/src/DataTypes/LineString.php#L233-L259 |
crysalead/net | src/Part.php | Part.encoding | public function encoding($encoding = null)
{
if (!func_num_args()) {
return $this->_encoding;
}
$this->_encoding = $encoding ? strtolower($encoding) : null;
return $this;
} | php | public function encoding($encoding = null)
{
if (!func_num_args()) {
return $this->_encoding;
}
$this->_encoding = $encoding ? strtolower($encoding) : null;
return $this;
} | [
"public",
"function",
"encoding",
"(",
"$",
"encoding",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"func_num_args",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_encoding",
";",
"}",
"$",
"this",
"->",
"_encoding",
"=",
"$",
"encoding",
"?",
"strtol... | Get/set the encoding.
@param string $encoding
@return string The encoding. | [
"Get",
"/",
"set",
"the",
"encoding",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Part.php#L42-L49 |
crysalead/net | src/Part.php | Part.flush | public function flush($encode = true)
{
$this->_ensureReadable(false);
$content = stream_get_contents($this->_resource);
return $encode && $this->_encoding ? Mime::encode($content, $this->_encoding) : $content;
} | php | public function flush($encode = true)
{
$this->_ensureReadable(false);
$content = stream_get_contents($this->_resource);
return $encode && $this->_encoding ? Mime::encode($content, $this->_encoding) : $content;
} | [
"public",
"function",
"flush",
"(",
"$",
"encode",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"_ensureReadable",
"(",
"false",
")",
";",
"$",
"content",
"=",
"stream_get_contents",
"(",
"$",
"this",
"->",
"_resource",
")",
";",
"return",
"$",
"encode",
... | Return the remaining data from the stream.
@param string $encode Indicate if the returned data must ben encoded or not
@return string | [
"Return",
"the",
"remaining",
"data",
"from",
"the",
"stream",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Part.php#L70-L75 |
liuguangw/mvc | src/file/LocalFileAdapter.php | LocalFileAdapter.createPublicInstance | public static function createPublicInstance(string $publicPath, string $pathPrefix = ''): LocalFileAdapter
{
$saveDir = PUBLIC_PATH . '/./' . $publicPath;
$httpContext = Application::$app->appContext . '/' . $publicPath;
return new static($saveDir, $httpContext, $pathPrefix);
} | php | public static function createPublicInstance(string $publicPath, string $pathPrefix = ''): LocalFileAdapter
{
$saveDir = PUBLIC_PATH . '/./' . $publicPath;
$httpContext = Application::$app->appContext . '/' . $publicPath;
return new static($saveDir, $httpContext, $pathPrefix);
} | [
"public",
"static",
"function",
"createPublicInstance",
"(",
"string",
"$",
"publicPath",
",",
"string",
"$",
"pathPrefix",
"=",
"''",
")",
":",
"LocalFileAdapter",
"{",
"$",
"saveDir",
"=",
"PUBLIC_PATH",
".",
"'/./'",
".",
"$",
"publicPath",
";",
"$",
"htt... | 工厂方法
@param string $publicPath
公共目录下目录名,如upload、upload/image
@param string $pathPrefix
保存路径前缀
@return LocalFileAdapter | [
"工厂方法"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/file/LocalFileAdapter.php#L36-L41 |
liuguangw/mvc | src/file/LocalFileAdapter.php | LocalFileAdapter.buildDistDir | private function buildDistDir(string $distPath): void
{
$distDir = dirname($distPath);
if (! is_dir($distDir)) {
if (@mkdir($distDir, 0755, true) === false) {
throw new \Exception('创建目录' . $distDir . '失败');
}
}
} | php | private function buildDistDir(string $distPath): void
{
$distDir = dirname($distPath);
if (! is_dir($distDir)) {
if (@mkdir($distDir, 0755, true) === false) {
throw new \Exception('创建目录' . $distDir . '失败');
}
}
} | [
"private",
"function",
"buildDistDir",
"(",
"string",
"$",
"distPath",
")",
":",
"void",
"{",
"$",
"distDir",
"=",
"dirname",
"(",
"$",
"distPath",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"distDir",
")",
")",
"{",
"if",
"(",
"@",
"mkdir",
"("... | 构建目标目录
@param string $distPath
目标文件路径
@return void | [
"构建目标目录"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/file/LocalFileAdapter.php#L50-L58 |
raphaelstolt/composer-travis-lint | src/Travis/Api.php | Api.post | public function post($travisConfiguration)
{
$headers = [
'Accept: application/vnd.travis-ci.2+json',
'Content-Type: text/yaml',
'Content-Length: ' . strlen($travisConfiguration),
];
curl_setopt($this->curlChannel, CURLOPT_USERAGENT, self::CURL_USERAGENT)... | php | public function post($travisConfiguration)
{
$headers = [
'Accept: application/vnd.travis-ci.2+json',
'Content-Type: text/yaml',
'Content-Length: ' . strlen($travisConfiguration),
];
curl_setopt($this->curlChannel, CURLOPT_USERAGENT, self::CURL_USERAGENT)... | [
"public",
"function",
"post",
"(",
"$",
"travisConfiguration",
")",
"{",
"$",
"headers",
"=",
"[",
"'Accept: application/vnd.travis-ci.2+json'",
",",
"'Content-Type: text/yaml'",
",",
"'Content-Length: '",
".",
"strlen",
"(",
"$",
"travisConfiguration",
")",
",",
"]",... | Posts the Travis CI configuration to the Travis CI Api.
@param string $travisConfiguration The content of .travis.yml.
@throws ConnectivityFailure
@throws NonExpectedReponseStructure
@return Stolt\Composer\Travis\Api\Result The post/lint result. | [
"Posts",
"the",
"Travis",
"CI",
"configuration",
"to",
"the",
"Travis",
"CI",
"Api",
"."
] | train | https://github.com/raphaelstolt/composer-travis-lint/blob/e6e005350b3c8981826aa718bc2282ddfd03caef/src/Travis/Api.php#L33-L92 |
incraigulous/contentful-sdk | src/ManagementResources/Entries.php | Entries.contentType | function contentType($contentType)
{
$this->requestDecorator->addHeader('X-Contentful-Content-Type', $contentType);
$this->requestDecorator->addParameter('content_type', '=', $contentType);
return $this;
} | php | function contentType($contentType)
{
$this->requestDecorator->addHeader('X-Contentful-Content-Type', $contentType);
$this->requestDecorator->addParameter('content_type', '=', $contentType);
return $this;
} | [
"function",
"contentType",
"(",
"$",
"contentType",
")",
"{",
"$",
"this",
"->",
"requestDecorator",
"->",
"addHeader",
"(",
"'X-Contentful-Content-Type'",
",",
"$",
"contentType",
")",
";",
"$",
"this",
"->",
"requestDecorator",
"->",
"addParameter",
"(",
"'con... | Target content type.
@param $contentType
@return $this | [
"Target",
"content",
"type",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementResources/Entries.php#L28-L33 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertyHandlerHelper.php | PropertyHandlerHelper.handlers | public function handlers()
{
if ($this->_handlers === null) {
$this->_handlers = Yii::$app->cache->lazy(function () {
$models = PropertyHandlers::find()
->orderBy(['sort_order' => SORT_ASC])
->all();
$handlers = [];
... | php | public function handlers()
{
if ($this->_handlers === null) {
$this->_handlers = Yii::$app->cache->lazy(function () {
$models = PropertyHandlers::find()
->orderBy(['sort_order' => SORT_ASC])
->all();
$handlers = [];
... | [
"public",
"function",
"handlers",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_handlers",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_handlers",
"=",
"Yii",
"::",
"$",
"app",
"->",
"cache",
"->",
"lazy",
"(",
"function",
"(",
")",
"{",
"$",
"... | Retrieves handlers from database.
Uses lazy cache.
@return \DevGroup\DataStructure\propertyHandler\AbstractPropertyHandler[] | [
"Retrieves",
"handlers",
"from",
"database",
".",
"Uses",
"lazy",
"cache",
"."
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertyHandlerHelper.php#L47-L65 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertyHandlerHelper.php | PropertyHandlerHelper.handlerById | public function handlerById($id)
{
if (isset($this->_handlers[$id])) {
return $this->_handlers[$id];
}
throw new \Exception("Property handler with id {$id} not found");
} | php | public function handlerById($id)
{
if (isset($this->_handlers[$id])) {
return $this->_handlers[$id];
}
throw new \Exception("Property handler with id {$id} not found");
} | [
"public",
"function",
"handlerById",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_handlers",
"[",
"$",
"id",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_handlers",
"[",
"$",
"id",
"]",
";",
"}",
"throw",
"new",
... | Returns handler by ID
@param integer $id
@return \DevGroup\DataStructure\propertyHandler\AbstractPropertyHandler
@throws \Exception | [
"Returns",
"handler",
"by",
"ID"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertyHandlerHelper.php#L75-L81 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertyHandlerHelper.php | PropertyHandlerHelper.handlerIdByClassName | public function handlerIdByClassName($className)
{
foreach ($this->handlers() as $id => $class) {
if ($class->className() === $className) {
return $id;
}
}
throw new Exception("Handler with classname {$className} not found.");
} | php | public function handlerIdByClassName($className)
{
foreach ($this->handlers() as $id => $class) {
if ($class->className() === $className) {
return $id;
}
}
throw new Exception("Handler with classname {$className} not found.");
} | [
"public",
"function",
"handlerIdByClassName",
"(",
"$",
"className",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"handlers",
"(",
")",
"as",
"$",
"id",
"=>",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"class",
"->",
"className",
"(",
")",
"===",
"$",
... | Returns handler id bu it's class name
@param string $className
@return int
@throws Exception | [
"Returns",
"handler",
"id",
"bu",
"it",
"s",
"class",
"name"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertyHandlerHelper.php#L91-L100 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Common.php | Common.drupal_add_library | public function drupal_add_library($module = null, $name = null, $every_page = null)
{
return drupal_add_library($module, $name, $every_page);
} | php | public function drupal_add_library($module = null, $name = null, $every_page = null)
{
return drupal_add_library($module, $name, $every_page);
} | [
"public",
"function",
"drupal_add_library",
"(",
"$",
"module",
"=",
"null",
",",
"$",
"name",
"=",
"null",
",",
"$",
"every_page",
"=",
"null",
")",
"{",
"return",
"drupal_add_library",
"(",
"$",
"module",
",",
"$",
"name",
",",
"$",
"every_page",
")",
... | Adds multiple JavaScript or CSS files at the same time.
A library defines a set of JavaScript and/or CSS files, optionally using
settings, and optionally requiring another library. For example, a library
can be a jQuery plugin, a JavaScript framework, or a CSS framework. This
function allows modules to load a library ... | [
"Adds",
"multiple",
"JavaScript",
"or",
"CSS",
"files",
"at",
"the",
"same",
"time",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Common.php#L325-L328 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Common.php | Common.format_date | public function format_date($timestamp, $type = 'medium', $format = '', $timezone = null, $langcode = null)
{
return format_date($timestamp, $type, $format, $timezone, $langcode);
} | php | public function format_date($timestamp, $type = 'medium', $format = '', $timezone = null, $langcode = null)
{
return format_date($timestamp, $type, $format, $timezone, $langcode);
} | [
"public",
"function",
"format_date",
"(",
"$",
"timestamp",
",",
"$",
"type",
"=",
"'medium'",
",",
"$",
"format",
"=",
"''",
",",
"$",
"timezone",
"=",
"null",
",",
"$",
"langcode",
"=",
"null",
")",
"{",
"return",
"format_date",
"(",
"$",
"timestamp"... | Formats a date, using a date type or a custom date format string.
@param $timestamp
A UNIX timestamp to format.
@param $type
(optional) The format to use, one of:
- 'short', 'medium', or 'long' (the corresponding built-in date formats).
- The name of a date type defined by a module in hook_date_format_types(),
if it's... | [
"Formats",
"a",
"date",
"using",
"a",
"date",
"type",
"or",
"a",
"custom",
"date",
"format",
"string",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Common.php#L747-L750 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Common.php | Common.watchdog | public function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = null)
{
return watchdog($type, $message, $variables, $severity, $link);
} | php | public function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = null)
{
return watchdog($type, $message, $variables, $severity, $link);
} | [
"public",
"function",
"watchdog",
"(",
"$",
"type",
",",
"$",
"message",
",",
"$",
"variables",
"=",
"array",
"(",
")",
",",
"$",
"severity",
"=",
"WATCHDOG_NOTICE",
",",
"$",
"link",
"=",
"null",
")",
"{",
"return",
"watchdog",
"(",
"$",
"type",
","... | Logs a system message.
@param string $type The category to which this message belongs. Can be any string, but the
general practice is to use the name of the module calling watchdog().
@param string $message The message to store in the log. Keep $message translatable
by not concatenating dynamic values into ... | [
"Logs",
"a",
"system",
"message",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Common.php#L1004-L1007 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ContentSets.php | HTMLPurifier_ContentSets.convertToLookup | protected function convertToLookup($string) {
$array = explode('|', str_replace(' ', '', $string));
$ret = array();
foreach ($array as $i => $k) {
$ret[$k] = true;
}
return $ret;
} | php | protected function convertToLookup($string) {
$array = explode('|', str_replace(' ', '', $string));
$ret = array();
foreach ($array as $i => $k) {
$ret[$k] = true;
}
return $ret;
} | [
"protected",
"function",
"convertToLookup",
"(",
"$",
"string",
")",
"{",
"$",
"array",
"=",
"explode",
"(",
"'|'",
",",
"str_replace",
"(",
"' '",
",",
"''",
",",
"$",
"string",
")",
")",
";",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"foreach",
"(... | Converts a string list of elements separated by pipes into
a lookup array.
@param $string List of elements
@return Lookup array of elements | [
"Converts",
"a",
"string",
"list",
"of",
"elements",
"separated",
"by",
"pipes",
"into",
"a",
"lookup",
"array",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ContentSets.php#L144-L151 |
markwatkinson/luminous | src/Luminous/Scanners/PerlScanner.php | PerlScanner.consumeString | public function consumeString($delimiter, $type)
{
$close = Utils::balanceDelimiter($delimiter);
$balanced = $close !== $delimiter;
$patterns = array('/(?<!\\\\)((?:\\\\\\\\)*)(' . preg_quote($close, '/') . ')/');
if ($balanced) {
$patterns[] = '/(?<!\\\\)((?:\\\\\\\\)*... | php | public function consumeString($delimiter, $type)
{
$close = Utils::balanceDelimiter($delimiter);
$balanced = $close !== $delimiter;
$patterns = array('/(?<!\\\\)((?:\\\\\\\\)*)(' . preg_quote($close, '/') . ')/');
if ($balanced) {
$patterns[] = '/(?<!\\\\)((?:\\\\\\\\)*... | [
"public",
"function",
"consumeString",
"(",
"$",
"delimiter",
",",
"$",
"type",
")",
"{",
"$",
"close",
"=",
"Utils",
"::",
"balanceDelimiter",
"(",
"$",
"delimiter",
")",
";",
"$",
"balanced",
"=",
"$",
"close",
"!==",
"$",
"delimiter",
";",
"$",
"pat... | expects the initial opening delim to already have been consumed | [
"expects",
"the",
"initial",
"opening",
"delim",
"to",
"already",
"have",
"been",
"consumed"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/PerlScanner.php#L31-L83 |
markwatkinson/luminous | src/Luminous/Scanners/PerlScanner.php | PerlScanner.isDelimiter | public function isDelimiter()
{
for ($i = count($this->tokens) - 1; $i >= 0; $i--) {
$t = $this->tokens[$i];
if ($t[0] === null || $t[0] === 'COMMENT') {
continue;
} elseif ($t[0] === 'OPENER' || $t[0] === 'OPERATOR') {
return true;
... | php | public function isDelimiter()
{
for ($i = count($this->tokens) - 1; $i >= 0; $i--) {
$t = $this->tokens[$i];
if ($t[0] === null || $t[0] === 'COMMENT') {
continue;
} elseif ($t[0] === 'OPENER' || $t[0] === 'OPERATOR') {
return true;
... | [
"public",
"function",
"isDelimiter",
"(",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"count",
"(",
"$",
"this",
"->",
"tokens",
")",
"-",
"1",
";",
"$",
"i",
">=",
"0",
";",
"$",
"i",
"--",
")",
"{",
"$",
"t",
"=",
"$",
"this",
"->",
"tokens",
"[... | by looking behind in the token stream. | [
"by",
"looking",
"behind",
"in",
"the",
"token",
"stream",
"."
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/PerlScanner.php#L87-L121 |
markwatkinson/luminous | src/Luminous/Scanners/PerlScanner.php | PerlScanner.slashOverride | public function slashOverride($matches)
{
$this->pos($this->pos() + strlen($matches[0]));
// this can catch '//', which I THINK is an operator but I could be wrong.
if (strlen($matches[0]) === 2 || !$this->isDelimiter()) {
$this->record($matches[0], 'OPERATOR');
} else {
... | php | public function slashOverride($matches)
{
$this->pos($this->pos() + strlen($matches[0]));
// this can catch '//', which I THINK is an operator but I could be wrong.
if (strlen($matches[0]) === 2 || !$this->isDelimiter()) {
$this->record($matches[0], 'OPERATOR');
} else {
... | [
"public",
"function",
"slashOverride",
"(",
"$",
"matches",
")",
"{",
"$",
"this",
"->",
"pos",
"(",
"$",
"this",
"->",
"pos",
"(",
")",
"+",
"strlen",
"(",
"$",
"matches",
"[",
"0",
"]",
")",
")",
";",
"// this can catch '//', which I THINK is an operator... | operators. | [
"operators",
"."
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/PerlScanner.php#L125-L138 |
markwatkinson/luminous | src/Luminous/Scanners/PerlScanner.php | PerlScanner.strOverride | public function strOverride($matches)
{
$this->pos($this->pos() + strlen($matches[0]));
$this->record($matches[0], 'DELIMITER');
$f = $matches[1];
$type = 'STRING';
if ($f === 'm' || $f === 'qr' || $f === 's' || $f === 'tr' || $f === 'y') {
$type = 'REGEX';
... | php | public function strOverride($matches)
{
$this->pos($this->pos() + strlen($matches[0]));
$this->record($matches[0], 'DELIMITER');
$f = $matches[1];
$type = 'STRING';
if ($f === 'm' || $f === 'qr' || $f === 's' || $f === 'tr' || $f === 'y') {
$type = 'REGEX';
... | [
"public",
"function",
"strOverride",
"(",
"$",
"matches",
")",
"{",
"$",
"this",
"->",
"pos",
"(",
"$",
"this",
"->",
"pos",
"(",
")",
"+",
"strlen",
"(",
"$",
"matches",
"[",
"0",
"]",
")",
")",
";",
"$",
"this",
"->",
"record",
"(",
"$",
"mat... | e.g. m"hello", m'hello', m/hello/, m(hello), m(he()l()o()) | [
"e",
".",
"g",
".",
"m",
"hello",
"m",
"hello",
"m",
"/",
"hello",
"/",
"m",
"(",
"hello",
")",
"m",
"(",
"he",
"()",
"l",
"()",
"o",
"()",
")"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/PerlScanner.php#L142-L182 |
markwatkinson/luminous | src/Luminous/Scanners/PerlScanner.php | PerlScanner.heredocOverride | public function heredocOverride($matches)
{
list($group, $op, $quote1, $delim, $quote2) = $matches;
$this->record($op, 'OPERATOR');
// Now, if $quote1 is '\', then $quote2 is empty. If quote2 is empty
// but quote1 is not '\', this is not a heredoc.
if ($quote1 === '\\' && $q... | php | public function heredocOverride($matches)
{
list($group, $op, $quote1, $delim, $quote2) = $matches;
$this->record($op, 'OPERATOR');
// Now, if $quote1 is '\', then $quote2 is empty. If quote2 is empty
// but quote1 is not '\', this is not a heredoc.
if ($quote1 === '\\' && $q... | [
"public",
"function",
"heredocOverride",
"(",
"$",
"matches",
")",
"{",
"list",
"(",
"$",
"group",
",",
"$",
"op",
",",
"$",
"quote1",
",",
"$",
"delim",
",",
"$",
"quote2",
")",
"=",
"$",
"matches",
";",
"$",
"this",
"->",
"record",
"(",
"$",
"o... | away. | [
"away",
"."
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/PerlScanner.php#L189-L212 |
markwatkinson/luminous | src/Luminous/Scanners/PerlScanner.php | PerlScanner.heredocRealOverride | public function heredocRealOverride($matches)
{
$this->record($matches[0], null);
$this->posShift(strlen($matches[0]));
// don't need this anymore
$this->removePattern('HEREDOC_NL');
assert($this->heredoc !== null);
$delim = preg_quote($this->heredoc);
$substr... | php | public function heredocRealOverride($matches)
{
$this->record($matches[0], null);
$this->posShift(strlen($matches[0]));
// don't need this anymore
$this->removePattern('HEREDOC_NL');
assert($this->heredoc !== null);
$delim = preg_quote($this->heredoc);
$substr... | [
"public",
"function",
"heredocRealOverride",
"(",
"$",
"matches",
")",
"{",
"$",
"this",
"->",
"record",
"(",
"$",
"matches",
"[",
"0",
"]",
",",
"null",
")",
";",
"$",
"this",
"->",
"posShift",
"(",
"strlen",
"(",
"$",
"matches",
"[",
"0",
"]",
")... | this override handles the actual heredoc text | [
"this",
"override",
"handles",
"the",
"actual",
"heredoc",
"text"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/PerlScanner.php#L215-L233 |
markwatkinson/luminous | src/Luminous/Scanners/PerlScanner.php | PerlScanner.termOverride | public function termOverride($matches)
{
$this->record($matches[0], 'DELIMITER');
$this->pos($this->pos() + strlen($matches[0]));
$this->record($this->rest(), null);
$this->terminate();
} | php | public function termOverride($matches)
{
$this->record($matches[0], 'DELIMITER');
$this->pos($this->pos() + strlen($matches[0]));
$this->record($this->rest(), null);
$this->terminate();
} | [
"public",
"function",
"termOverride",
"(",
"$",
"matches",
")",
"{",
"$",
"this",
"->",
"record",
"(",
"$",
"matches",
"[",
"0",
"]",
",",
"'DELIMITER'",
")",
";",
"$",
"this",
"->",
"pos",
"(",
"$",
"this",
"->",
"pos",
"(",
")",
"+",
"strlen",
... | halts highlighting on __DATA__ and __END__ | [
"halts",
"highlighting",
"on",
"__DATA__",
"and",
"__END__"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/PerlScanner.php#L236-L242 |
markwatkinson/luminous | src/Luminous/Scanners/PerlScanner.php | PerlScanner.podCutOverride | public function podCutOverride($matches)
{
$line = $this->scan('/^=.*/m');
assert($line !== null);
$term = '/^=cut$|\\z/m';
$substr = $this->scanUntil($term);
assert($substr !== null);
$end = $this->scan($term);
assert($end !== null);
$this->record($li... | php | public function podCutOverride($matches)
{
$line = $this->scan('/^=.*/m');
assert($line !== null);
$term = '/^=cut$|\\z/m';
$substr = $this->scanUntil($term);
assert($substr !== null);
$end = $this->scan($term);
assert($end !== null);
$this->record($li... | [
"public",
"function",
"podCutOverride",
"(",
"$",
"matches",
")",
"{",
"$",
"line",
"=",
"$",
"this",
"->",
"scan",
"(",
"'/^=.*/m'",
")",
";",
"assert",
"(",
"$",
"line",
"!==",
"null",
")",
";",
"$",
"term",
"=",
"'/^=cut$|\\\\z/m'",
";",
"$",
"sub... | we do it the old fashioned way | [
"we",
"do",
"it",
"the",
"old",
"fashioned",
"way"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/PerlScanner.php#L246-L256 |
christophe-brachet/aspi-framework | src/Framework/Routing/Router.php | Router.generate | public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
{
if (isset($parameters['locale'])) {
$locale = $this->getLocale($parameters);
if (isset($parameters['locale'])) {
unset($parameters['locale']);
}
if (... | php | public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
{
if (isset($parameters['locale'])) {
$locale = $this->getLocale($parameters);
if (isset($parameters['locale'])) {
unset($parameters['locale']);
}
if (... | [
"public",
"function",
"generate",
"(",
"$",
"name",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"$",
"referenceType",
"=",
"self",
"::",
"ABSOLUTE_PATH",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"parameters",
"[",
"'locale'",
"]",
")",
")",
"... | Generates a URL from the given parameters.
@param string $name The name of the route
@param array $parameters An array of parameters
@param bool|int $referenceType The type of reference to be generated (one of the constants)
@return string The generated URL
@throws \InvalidArgumentException When the route... | [
"Generates",
"a",
"URL",
"from",
"the",
"given",
"parameters",
"."
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Routing/Router.php#L56-L77 |
christophe-brachet/aspi-framework | src/Framework/Routing/Router.php | Router.generateI18n | protected function generateI18n($name, $locale, $parameters, $referenceType = self::ABSOLUTE_PATH)
{
try {
return $this->generator->generate(
$this->routeNameInflector->inflect($name, $locale),
$parameters,
$referenceType
);
} c... | php | protected function generateI18n($name, $locale, $parameters, $referenceType = self::ABSOLUTE_PATH)
{
try {
return $this->generator->generate(
$this->routeNameInflector->inflect($name, $locale),
$parameters,
$referenceType
);
} c... | [
"protected",
"function",
"generateI18n",
"(",
"$",
"name",
",",
"$",
"locale",
",",
"$",
"parameters",
",",
"$",
"referenceType",
"=",
"self",
"::",
"ABSOLUTE_PATH",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"generator",
"->",
"generate",
"(",
"... | Generates a I18N URL from the given parameter
@param string $name The name of the I18N route
@param string $locale The locale of the I18N route
@param array $parameters An array of parameters
@param bool|int $referenceType The type of reference to be generated (one of the constants)
@return string Th... | [
"Generates",
"a",
"I18N",
"URL",
"from",
"the",
"given",
"parameter"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Routing/Router.php#L120-L131 |
christophe-brachet/aspi-framework | src/Framework/Routing/Router.php | Router.getLocale | protected function getLocale($parameters)
{
if (isset($parameters['locale'])) {
return $parameters['locale'];
}
if ($this->getContext()->hasParameter('_locale')) {
return $this->getContext()->getParameter('_locale');
}
return $this->defaultLocale;
... | php | protected function getLocale($parameters)
{
if (isset($parameters['locale'])) {
return $parameters['locale'];
}
if ($this->getContext()->hasParameter('_locale')) {
return $this->getContext()->getParameter('_locale');
}
return $this->defaultLocale;
... | [
"protected",
"function",
"getLocale",
"(",
"$",
"parameters",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"parameters",
"[",
"'locale'",
"]",
")",
")",
"{",
"return",
"$",
"parameters",
"[",
"'locale'",
"]",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getCo... | Determine the locale to be used with this request
@param array $parameters the parameters determined by the route
@return string | [
"Determine",
"the",
"locale",
"to",
"be",
"used",
"with",
"this",
"request"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Routing/Router.php#L139-L148 |
gorkalaucirica/HipchatAPIv2Client | Model/Room.php | Room.parseJson | public function parseJson($json)
{
$this->id = $json['id'];
$this->name = $json['name'];
$this->links = $json['links'];
if (isset($json['xmpp_jid'])) {
$this->xmppJid = $json['xmpp_jid'];
//Statistics need to be implemented
$this->created = new \D... | php | public function parseJson($json)
{
$this->id = $json['id'];
$this->name = $json['name'];
$this->links = $json['links'];
if (isset($json['xmpp_jid'])) {
$this->xmppJid = $json['xmpp_jid'];
//Statistics need to be implemented
$this->created = new \D... | [
"public",
"function",
"parseJson",
"(",
"$",
"json",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"json",
"[",
"'id'",
"]",
";",
"$",
"this",
"->",
"name",
"=",
"$",
"json",
"[",
"'name'",
"]",
";",
"$",
"this",
"->",
"links",
"=",
"$",
"json",... | Parses response given by the API and maps the fields to Room object
@param array $json json_decoded response in json given by the server
@return void | [
"Parses",
"response",
"given",
"by",
"the",
"API",
"and",
"maps",
"the",
"fields",
"to",
"Room",
"object"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/Model/Room.php#L57-L78 |
gorkalaucirica/HipchatAPIv2Client | Model/Room.php | Room.toJson | public function toJson()
{
$json = array();
$json['name'] = $this->getName();
$json['privacy'] = $this->getPrivacy();
//Parameters for PUT call (Room already exists)
if ($this->getId()) {
$json['is_archived'] = $this->isArchived();
$json['is_guest_acc... | php | public function toJson()
{
$json = array();
$json['name'] = $this->getName();
$json['privacy'] = $this->getPrivacy();
//Parameters for PUT call (Room already exists)
if ($this->getId()) {
$json['is_archived'] = $this->isArchived();
$json['is_guest_acc... | [
"public",
"function",
"toJson",
"(",
")",
"{",
"$",
"json",
"=",
"array",
"(",
")",
";",
"$",
"json",
"[",
"'name'",
"]",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"json",
"[",
"'privacy'",
"]",
"=",
"$",
"this",
"->",
"getPrivacy",
... | Serializes Room object
@return array | [
"Serializes",
"Room",
"object"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/Model/Room.php#L85-L104 |
ssnepenthe/soter | src/class-check-site-job.php | Check_Site_Job.run | public function run() {
try {
$vulnerabilities = $this->checker->check_site( $this->options->ignored_packages );
do_action( 'soter_site_check_complete', $vulnerabilities );
$this->options->get_store()->set( 'last_scan_hash', $vulnerabilities->hash() );
} catch ( \RuntimeException $e ) {
// Gross?
$... | php | public function run() {
try {
$vulnerabilities = $this->checker->check_site( $this->options->ignored_packages );
do_action( 'soter_site_check_complete', $vulnerabilities );
$this->options->get_store()->set( 'last_scan_hash', $vulnerabilities->hash() );
} catch ( \RuntimeException $e ) {
// Gross?
$... | [
"public",
"function",
"run",
"(",
")",
"{",
"try",
"{",
"$",
"vulnerabilities",
"=",
"$",
"this",
"->",
"checker",
"->",
"check_site",
"(",
"$",
"this",
"->",
"options",
"->",
"ignored_packages",
")",
";",
"do_action",
"(",
"'soter_site_check_complete'",
","... | Run the site check.
@return void | [
"Run",
"the",
"site",
"check",
"."
] | train | https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-check-site-job.php#L51-L73 |
ssnepenthe/soter | src/class-check-site-job.php | Check_Site_Job.render_html_error_email | public function render_html_error_email( $exception, CssToInlineStyles $inliner = null ) {
$plates = _soter_instance( 'plates' );
$html = $plates->render( 'emails/html/error.php', [
'message' => $exception->getMessage(),
] );
$css = $plates->render( 'emails/style.css' );
$inliner = $inliner ?: new CssToInl... | php | public function render_html_error_email( $exception, CssToInlineStyles $inliner = null ) {
$plates = _soter_instance( 'plates' );
$html = $plates->render( 'emails/html/error.php', [
'message' => $exception->getMessage(),
] );
$css = $plates->render( 'emails/style.css' );
$inliner = $inliner ?: new CssToInl... | [
"public",
"function",
"render_html_error_email",
"(",
"$",
"exception",
",",
"CssToInlineStyles",
"$",
"inliner",
"=",
"null",
")",
"{",
"$",
"plates",
"=",
"_soter_instance",
"(",
"'plates'",
")",
";",
"$",
"html",
"=",
"$",
"plates",
"->",
"render",
"(",
... | Render the contents of the HTML error notification.
@param \RuntimeException $exception Exception instance.
@param CssToInlineStyles|null $inliner Style inliner.
@return string | [
"Render",
"the",
"contents",
"of",
"the",
"HTML",
"error",
"notification",
"."
] | train | https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-check-site-job.php#L83-L92 |
sifophp/sifo-common-instance | controllers/manager/rebuild.php | ManagerRebuildController.rebuildFiles | protected function rebuildFiles( Array $files )
{
// Generate the dependencies declaration file.
DependencyInjector::getInstance()->generateDependenciesDeclaration();
$this->setLayout( 'manager/templates.tpl' );
$output = array( );
$instance_inheritance = array_unique( \Sifo\Domains::getInsta... | php | protected function rebuildFiles( Array $files )
{
// Generate the dependencies declaration file.
DependencyInjector::getInstance()->generateDependenciesDeclaration();
$this->setLayout( 'manager/templates.tpl' );
$output = array( );
$instance_inheritance = array_unique( \Sifo\Domains::getInsta... | [
"protected",
"function",
"rebuildFiles",
"(",
"Array",
"$",
"files",
")",
"{",
"// Generate the dependencies declaration file.",
"DependencyInjector",
"::",
"getInstance",
"(",
")",
"->",
"generateDependenciesDeclaration",
"(",
")",
";",
"$",
"this",
"->",
"setLayout",
... | Writes all the configurattion files to disk.
Input expected is:
array( 'filename' => array( 'folder_to_parse1', 'folder_to_parse2', '...' ) )
@param array $files
@return array Array of contents write to each file. | [
"Writes",
"all",
"the",
"configurattion",
"files",
"to",
"disk",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/manager/rebuild.php#L37-L103 |
sifophp/sifo-common-instance | controllers/manager/rebuild.php | ManagerRebuildController.getClassTypeStandarized | private function getClassTypeStandarized( $path )
{
$class = '';
$ctrl_parts = explode( '/', $path );
while ( $class_name = array_shift( $ctrl_parts ) )
{
$class .= ucfirst( $class_name );
}
return $class;
} | php | private function getClassTypeStandarized( $path )
{
$class = '';
$ctrl_parts = explode( '/', $path );
while ( $class_name = array_shift( $ctrl_parts ) )
{
$class .= ucfirst( $class_name );
}
return $class;
} | [
"private",
"function",
"getClassTypeStandarized",
"(",
"$",
"path",
")",
"{",
"$",
"class",
"=",
"''",
";",
"$",
"ctrl_parts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"path",
")",
";",
"while",
"(",
"$",
"class_name",
"=",
"array_shift",
"(",
"$",
"ctrl_... | Converts something like home/index.ctrl.php to HomeIndex.
@param string $path
@return string | [
"Converts",
"something",
"like",
"home",
"/",
"index",
".",
"ctrl",
".",
"php",
"to",
"HomeIndex",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/manager/rebuild.php#L157-L169 |
terdia/legato-framework | src/Console/Command.php | Command.setArguments | public function setArguments($name, $required = false, $description = 'Argument description')
{
$required ? $required = InputArgument::REQUIRED : $required = InputArgument::OPTIONAL;
$this->addArgument($name, $required, $description);
} | php | public function setArguments($name, $required = false, $description = 'Argument description')
{
$required ? $required = InputArgument::REQUIRED : $required = InputArgument::OPTIONAL;
$this->addArgument($name, $required, $description);
} | [
"public",
"function",
"setArguments",
"(",
"$",
"name",
",",
"$",
"required",
"=",
"false",
",",
"$",
"description",
"=",
"'Argument description'",
")",
"{",
"$",
"required",
"?",
"$",
"required",
"=",
"InputArgument",
"::",
"REQUIRED",
":",
"$",
"required",... | Add argument to a command.
@param $name, the argument name
@param bool $required, is it required
@param string $description | [
"Add",
"argument",
"to",
"a",
"command",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Console/Command.php#L49-L53 |
terdia/legato-framework | src/Console/Command.php | Command.setOption | public function setOption($name, $shortcut = null, $inputRequired = false, $description = 'option does what?')
{
$inputRequired ? $inputRequired = InputOption::VALUE_REQUIRED :
$inputRequired = InputOption::VALUE_OPTIONAL;
$this->addOption($name, $shortcut, $inputRequired, $description)... | php | public function setOption($name, $shortcut = null, $inputRequired = false, $description = 'option does what?')
{
$inputRequired ? $inputRequired = InputOption::VALUE_REQUIRED :
$inputRequired = InputOption::VALUE_OPTIONAL;
$this->addOption($name, $shortcut, $inputRequired, $description)... | [
"public",
"function",
"setOption",
"(",
"$",
"name",
",",
"$",
"shortcut",
"=",
"null",
",",
"$",
"inputRequired",
"=",
"false",
",",
"$",
"description",
"=",
"'option does what?'",
")",
"{",
"$",
"inputRequired",
"?",
"$",
"inputRequired",
"=",
"InputOption... | Add options to command.
@param $name, the option name
@param null $shortcut
@param bool $inputRequired, whether it is required
@param $description, description | [
"Add",
"options",
"to",
"command",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Console/Command.php#L63-L69 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies.offsetSet | public function offsetSet($name, $value)
{
$cookie = $this->_classes['cookie'];
$value = $this->_autobox($name, $value);
if (!$value instanceof $cookie) {
throw new RuntimeException("Error, only `{$cookie}` instances are allowed in this collection.");
}
$hash = $n... | php | public function offsetSet($name, $value)
{
$cookie = $this->_classes['cookie'];
$value = $this->_autobox($name, $value);
if (!$value instanceof $cookie) {
throw new RuntimeException("Error, only `{$cookie}` instances are allowed in this collection.");
}
$hash = $n... | [
"public",
"function",
"offsetSet",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"cookie",
"=",
"$",
"this",
"->",
"_classes",
"[",
"'cookie'",
"]",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"_autobox",
"(",
"$",
"name",
",",
"$",
"value",
... | Adds a cookie to the collection.
@param string $name The cookie name.
@param object $value The cookie.
@return object The setted cookie. | [
"Adds",
"a",
"cookie",
"to",
"the",
"collection",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L69-L81 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies.offsetGet | public function offsetGet($name)
{
$data = [];
if (!isset($this->_hashes[$name])) {
throw new RuntimeException("Unexisting Set-Cookie `'{$name}'`.");
}
foreach ($this->_hashes[$name] as $key => $hash) {
$data[] = $this->_data[$hash];
}
return $... | php | public function offsetGet($name)
{
$data = [];
if (!isset($this->_hashes[$name])) {
throw new RuntimeException("Unexisting Set-Cookie `'{$name}'`.");
}
foreach ($this->_hashes[$name] as $key => $hash) {
$data[] = $this->_data[$hash];
}
return $... | [
"public",
"function",
"offsetGet",
"(",
"$",
"name",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_hashes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unexisting... | Gets a set-cookie.
@param string $name The cookie name.
@param object $value The cookie.
@return object The setted cookie. | [
"Gets",
"a",
"set",
"-",
"cookie",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L91-L101 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies.offsetUnset | public function offsetUnset($name)
{
if (!isset($this->_hashes[$name])) {
return;
}
foreach ($this->_hashes[$name] as $hash) {
unset($this->_data[$hash]);
unset($this->_names[$hash]);
}
unset($this->_hashes[$name]);
} | php | public function offsetUnset($name)
{
if (!isset($this->_hashes[$name])) {
return;
}
foreach ($this->_hashes[$name] as $hash) {
unset($this->_data[$hash]);
unset($this->_names[$hash]);
}
unset($this->_hashes[$name]);
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_hashes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"_hashes",
"[",
"$",
"name",... | Removes all set-cookies of a specific name.
@param string $name The cookie name. | [
"Removes",
"all",
"set",
"-",
"cookies",
"of",
"a",
"specific",
"name",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L119-L129 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies._autobox | protected function _autobox($name, $value)
{
if (is_object($value)) {
return $value;
}
$cookie = $this->_classes['cookie'];
if (!is_array($value)) {
$value = ['value' => $value];
}
$value['name'] = $name;
return new $cookie($value);
... | php | protected function _autobox($name, $value)
{
if (is_object($value)) {
return $value;
}
$cookie = $this->_classes['cookie'];
if (!is_array($value)) {
$value = ['value' => $value];
}
$value['name'] = $name;
return new $cookie($value);
... | [
"protected",
"function",
"_autobox",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"$",
"cookie",
"=",
"$",
"this",
"->",
"_classes",
"[",
"'cookie'",
"]",... | Autoboxes a cookie value.
@param mixed $value The cookie value.
@return object The cookie instance. | [
"Autoboxes",
"a",
"cookie",
"value",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L158-L169 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies.flushExpired | public function flushExpired()
{
foreach ($this->_hashes as $name => $hashes) {
foreach ($hashes as $key => $hash) {
$cookie = $this->_data[$hash];
if ($cookie->expired()) {
unset($this->_data[$hash]);
unset($this->_names[$h... | php | public function flushExpired()
{
foreach ($this->_hashes as $name => $hashes) {
foreach ($hashes as $key => $hash) {
$cookie = $this->_data[$hash];
if ($cookie->expired()) {
unset($this->_data[$hash]);
unset($this->_names[$h... | [
"public",
"function",
"flushExpired",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_hashes",
"as",
"$",
"name",
"=>",
"$",
"hashes",
")",
"{",
"foreach",
"(",
"$",
"hashes",
"as",
"$",
"key",
"=>",
"$",
"hash",
")",
"{",
"$",
"cookie",
"=",
... | Removes expired cookies.
@return object Returns `$this`. | [
"Removes",
"expired",
"cookies",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L176-L192 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies.clear | public function clear($domain = null, $path = null, $name = null)
{
if (!$domain) {
$this->_data = [];
return;
} elseif (!$path) {
$this->_data = array_filter(
$this->_data,
function ($cookie) use ($path, $domain) {
... | php | public function clear($domain = null, $path = null, $name = null)
{
if (!$domain) {
$this->_data = [];
return;
} elseif (!$path) {
$this->_data = array_filter(
$this->_data,
function ($cookie) use ($path, $domain) {
... | [
"public",
"function",
"clear",
"(",
"$",
"domain",
"=",
"null",
",",
"$",
"path",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"domain",
")",
"{",
"$",
"this",
"->",
"_data",
"=",
"[",
"]",
";",
"return",
";",
"}... | Remove some cookies from the Jar.
@param string $domain A domain name.
@param string $path A path name.
@param string $name A cookie name.
@return self | [
"Remove",
"some",
"cookies",
"from",
"the",
"Jar",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L202-L233 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies.clearSessionCookies | public function clearSessionCookies()
{
$this->_data = array_filter(
$this->_data,
function ($cookie) {
return !$cookie->discard() && $cookie->expires();
}
);
return $this;
} | php | public function clearSessionCookies()
{
$this->_data = array_filter(
$this->_data,
function ($cookie) {
return !$cookie->discard() && $cookie->expires();
}
);
return $this;
} | [
"public",
"function",
"clearSessionCookies",
"(",
")",
"{",
"$",
"this",
"->",
"_data",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"_data",
",",
"function",
"(",
"$",
"cookie",
")",
"{",
"return",
"!",
"$",
"cookie",
"->",
"discard",
"(",
")",
"&&",
... | Clear session based cookies.
@return self | [
"Clear",
"session",
"based",
"cookies",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L240-L249 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies.add | public function add($cookie)
{
// If the name string is empty (but not 0), ignore the set-cookie
// string entirely.
$name = $cookie->name();
if (!$name && $name !== '0') {
return false;
}
// Only allow cookies with set and valid domain, name, value
... | php | public function add($cookie)
{
// If the name string is empty (but not 0), ignore the set-cookie
// string entirely.
$name = $cookie->name();
if (!$name && $name !== '0') {
return false;
}
// Only allow cookies with set and valid domain, name, value
... | [
"public",
"function",
"add",
"(",
"$",
"cookie",
")",
"{",
"// If the name string is empty (but not 0), ignore the set-cookie",
"// string entirely.",
"$",
"name",
"=",
"$",
"cookie",
"->",
"name",
"(",
")",
";",
"if",
"(",
"!",
"$",
"name",
"&&",
"$",
"name",
... | Add a cookie.
@param SetCookie $cookie The cookie to add.
@return boolean | [
"Add",
"a",
"cookie",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L257-L320 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies.fetchCookies | public function fetchCookies($request, $response)
{
foreach ($response->cookies($request) as $cookie) {
$this->add($cookie);
}
return $this;
} | php | public function fetchCookies($request, $response)
{
foreach ($response->cookies($request) as $cookie) {
$this->add($cookie);
}
return $this;
} | [
"public",
"function",
"fetchCookies",
"(",
"$",
"request",
",",
"$",
"response",
")",
"{",
"foreach",
"(",
"$",
"response",
"->",
"cookies",
"(",
"$",
"request",
")",
"as",
"$",
"cookie",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"$",
"cookie",
")",
... | Collect the Set-Cookie header from a response.
@param RequestInterface $request The request.
@param ResponseInterface $response The response.
@return self | [
"Collect",
"the",
"Set",
"-",
"Cookie",
"header",
"from",
"a",
"response",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L329-L335 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies._pathFrom | protected function _pathFrom(RequestInterface $request)
{
$uriPath = $request->path();
if ($uriPath === '') {
return '/';
}
if (strpos($uriPath, '/') !== 0) {
return '/';
}
if ($uriPath === '/') {
return '/';
}
if ((... | php | protected function _pathFrom(RequestInterface $request)
{
$uriPath = $request->path();
if ($uriPath === '') {
return '/';
}
if (strpos($uriPath, '/') !== 0) {
return '/';
}
if ($uriPath === '/') {
return '/';
}
if ((... | [
"protected",
"function",
"_pathFrom",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"$",
"uriPath",
"=",
"$",
"request",
"->",
"path",
"(",
")",
";",
"if",
"(",
"$",
"uriPath",
"===",
"''",
")",
"{",
"return",
"'/'",
";",
"}",
"if",
"(",
"strpos... | Computes cookie path following RFC 6265 section 5.1.4
@link https://tools.ietf.org/html/rfc6265#section-5.1.4
@param RequestInterface $request
@return string | [
"Computes",
"cookie",
"path",
"following",
"RFC",
"6265",
"section",
"5",
".",
"1",
".",
"4"
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L345-L362 |
crysalead/net | src/Http/Cookie/Cookies.php | Cookies.toArray | public static function toArray($cookies, $options = [])
{
$data = [];
foreach ($cookies as $name => $cookie) {
$data[$name][] = $cookie->data();
}
return $data;
} | php | public static function toArray($cookies, $options = [])
{
$data = [];
foreach ($cookies as $name => $cookie) {
$data[$name][] = $cookie->data();
}
return $data;
} | [
"public",
"static",
"function",
"toArray",
"(",
"$",
"cookies",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"cookies",
"as",
"$",
"name",
"=>",
"$",
"cookie",
")",
"{",
"$",
"data",
"[",
"... | Exports set-cookies.
@param Traversable $setCookies The set-cookies.
@param array $options Options.
@return array The export array. | [
"Exports",
"set",
"-",
"cookies",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookies.php#L381-L388 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Loader/Loader.php | Loader.load | public function load($resource)
{
if ($this->cacher->check($resource)) {
return $this->cacher->retrieve($resource);
}
$this->reader->open($resource);
/** @var \Yosmanyga\Validation\Resource\Definition\ObjectDefinition[] $definitions */
$definitions = [];
... | php | public function load($resource)
{
if ($this->cacher->check($resource)) {
return $this->cacher->retrieve($resource);
}
$this->reader->open($resource);
/** @var \Yosmanyga\Validation\Resource\Definition\ObjectDefinition[] $definitions */
$definitions = [];
... | [
"public",
"function",
"load",
"(",
"$",
"resource",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacher",
"->",
"check",
"(",
"$",
"resource",
")",
")",
"{",
"return",
"$",
"this",
"->",
"cacher",
"->",
"retrieve",
"(",
"$",
"resource",
")",
";",
"}",
... | @param \Yosmanyga\Resource\Resource $resource
@return \Yosmanyga\Validation\Validator\ObjectValidator[] | [
"@param",
"\\",
"Yosmanyga",
"\\",
"Resource",
"\\",
"Resource",
"$resource"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Loader/Loader.php#L61-L88 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Loader/Loader.php | Loader.fillObjectValidators | protected function fillObjectValidators($definitions, $validators)
{
foreach ($definitions as $class => $definition) {
foreach ($definition->validators['properties'] as $property => $validatorsDefinitions) {
foreach ($validatorsDefinitions as $validatorDefinition) {
... | php | protected function fillObjectValidators($definitions, $validators)
{
foreach ($definitions as $class => $definition) {
foreach ($definition->validators['properties'] as $property => $validatorsDefinitions) {
foreach ($validatorsDefinitions as $validatorDefinition) {
... | [
"protected",
"function",
"fillObjectValidators",
"(",
"$",
"definitions",
",",
"$",
"validators",
")",
"{",
"foreach",
"(",
"$",
"definitions",
"as",
"$",
"class",
"=>",
"$",
"definition",
")",
"{",
"foreach",
"(",
"$",
"definition",
"->",
"validators",
"[",... | @param \Yosmanyga\Validation\Resource\Definition\ObjectDefinition[] $definitions
@param \Yosmanyga\Validation\Validator\ObjectValidator[] $validators
@return \Yosmanyga\Validation\Validator\ObjectValidator[] | [
"@param",
"\\",
"Yosmanyga",
"\\",
"Validation",
"\\",
"Resource",
"\\",
"Definition",
"\\",
"ObjectDefinition",
"[]",
"$definitions",
"@param",
"\\",
"Yosmanyga",
"\\",
"Validation",
"\\",
"Validator",
"\\",
"ObjectValidator",
"[]",
"$validators"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Loader/Loader.php#L96-L112 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/util/FractalWrapper.php | FractalWrapper.toResource | public static function toResource($obj, $transformer): ResourceAbstract
{
if (!$obj)
return new NullResource();
$resource = null;
try {
if (is_array($obj)) {
$resource = new Collection($obj, new $transformer(), get_class($obj[0]));
} else {... | php | public static function toResource($obj, $transformer): ResourceAbstract
{
if (!$obj)
return new NullResource();
$resource = null;
try {
if (is_array($obj)) {
$resource = new Collection($obj, new $transformer(), get_class($obj[0]));
} else {... | [
"public",
"static",
"function",
"toResource",
"(",
"$",
"obj",
",",
"$",
"transformer",
")",
":",
"ResourceAbstract",
"{",
"if",
"(",
"!",
"$",
"obj",
")",
"return",
"new",
"NullResource",
"(",
")",
";",
"$",
"resource",
"=",
"null",
";",
"try",
"{",
... | Transform the given object or array with the given transformer to a Resource.
@param $obj
@param $transformer
@return ResourceAbstract
@throws DWDLibException | [
"Transform",
"the",
"given",
"object",
"or",
"array",
"with",
"the",
"given",
"transformer",
"to",
"a",
"Resource",
"."
] | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/util/FractalWrapper.php#L36-L51 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/util/FractalWrapper.php | FractalWrapper.toArray | public static function toArray(ResourceAbstract $resource, $serializer = DataArraySerializer::class)
{
$manager = new Manager();
$manager->setSerializer(new $serializer());
return $manager->createData($resource)->toArray();
} | php | public static function toArray(ResourceAbstract $resource, $serializer = DataArraySerializer::class)
{
$manager = new Manager();
$manager->setSerializer(new $serializer());
return $manager->createData($resource)->toArray();
} | [
"public",
"static",
"function",
"toArray",
"(",
"ResourceAbstract",
"$",
"resource",
",",
"$",
"serializer",
"=",
"DataArraySerializer",
"::",
"class",
")",
"{",
"$",
"manager",
"=",
"new",
"Manager",
"(",
")",
";",
"$",
"manager",
"->",
"setSerializer",
"("... | Uses the given serializer and transformer to transform $this into an array of the expected format.
@param ResourceInterface $resource
@param string $transformer
@return array | [
"Uses",
"the",
"given",
"serializer",
"and",
"transformer",
"to",
"transform",
"$this",
"into",
"an",
"array",
"of",
"the",
"expected",
"format",
"."
] | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/util/FractalWrapper.php#L58-L63 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/util/FractalWrapper.php | FractalWrapper.toJson | public static function toJson(ResourceAbstract $resource, $options = 0, $serializer = DataArraySerializer::class)
{
$manager = new Manager();
$manager->setSerializer(new $serializer());
return $manager->createData($resource)->toJson($options);
} | php | public static function toJson(ResourceAbstract $resource, $options = 0, $serializer = DataArraySerializer::class)
{
$manager = new Manager();
$manager->setSerializer(new $serializer());
return $manager->createData($resource)->toJson($options);
} | [
"public",
"static",
"function",
"toJson",
"(",
"ResourceAbstract",
"$",
"resource",
",",
"$",
"options",
"=",
"0",
",",
"$",
"serializer",
"=",
"DataArraySerializer",
"::",
"class",
")",
"{",
"$",
"manager",
"=",
"new",
"Manager",
"(",
")",
";",
"$",
"ma... | Uses the given serializer and transformer to transform $this into an array of the expected format.
@param ResourceInterface $resource
@param string $serializer
@return string | [
"Uses",
"the",
"given",
"serializer",
"and",
"transformer",
"to",
"transform",
"$this",
"into",
"an",
"array",
"of",
"the",
"expected",
"format",
"."
] | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/util/FractalWrapper.php#L70-L75 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.getLinks | public function getLinks()
{
if ( is_null( $this->getUrlBase() ) )
{
trigger_error( 'Pagination getLinks: Is necessary to set URL base for the page link with \'setUrlBase( $url )\' method.' );
return false;
}
if ( is_null( $this->layout_template ) )
{
trigger_error( 'Pagination getLinks: Is necessa... | php | public function getLinks()
{
if ( is_null( $this->getUrlBase() ) )
{
trigger_error( 'Pagination getLinks: Is necessary to set URL base for the page link with \'setUrlBase( $url )\' method.' );
return false;
}
if ( is_null( $this->layout_template ) )
{
trigger_error( 'Pagination getLinks: Is necessa... | [
"public",
"function",
"getLinks",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"getUrlBase",
"(",
")",
")",
")",
"{",
"trigger_error",
"(",
"'Pagination getLinks: Is necessary to set URL base for the page link with \\'setUrlBase( $url )\\' method.'",
")",
... | Get pagination data.
@return array | [
"Get",
"pagination",
"data",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L214-L244 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.getPaginationData | protected function getPaginationData()
{
// Choose page range ( window ) and set start/end page range.
$this->setPageRange();
// Set previous/next page number.
$this->setPrevNumPage();
$this->setNextNumPage();
$pagination['template'] = $this->layout_template;
$pagination['items_total'] = $this->getNu... | php | protected function getPaginationData()
{
// Choose page range ( window ) and set start/end page range.
$this->setPageRange();
// Set previous/next page number.
$this->setPrevNumPage();
$this->setNextNumPage();
$pagination['template'] = $this->layout_template;
$pagination['items_total'] = $this->getNu... | [
"protected",
"function",
"getPaginationData",
"(",
")",
"{",
"// Choose page range ( window ) and set start/end page range.",
"$",
"this",
"->",
"setPageRange",
"(",
")",
";",
"// Set previous/next page number.",
"$",
"this",
"->",
"setPrevNumPage",
"(",
")",
";",
"$",
... | Get pagination data.
@return array | [
"Get",
"pagination",
"data",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L251-L319 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setNextNumPage | protected function setNextNumPage()
{
$this->next_num_page = 0;
if ( $this->current_page_number < $this->num_pages )
{
$this->next_num_page = ( $this->current_page_number + 1 );
}
} | php | protected function setNextNumPage()
{
$this->next_num_page = 0;
if ( $this->current_page_number < $this->num_pages )
{
$this->next_num_page = ( $this->current_page_number + 1 );
}
} | [
"protected",
"function",
"setNextNumPage",
"(",
")",
"{",
"$",
"this",
"->",
"next_num_page",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"current_page_number",
"<",
"$",
"this",
"->",
"num_pages",
")",
"{",
"$",
"this",
"->",
"next_num_page",
"=",
"(",... | Set next page number. | [
"Set",
"next",
"page",
"number",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L356-L363 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setPageRange | protected function setPageRange()
{
$this->page_range = $this->availables_page_range['default'];
if ( $this->current_page_number > 9992 )
{
$this->page_range = $this->availables_page_range['very_short'];
}
elseif ( $this->current_page_number > 986 )
{
$this->page_range = $this->availables_page_range[... | php | protected function setPageRange()
{
$this->page_range = $this->availables_page_range['default'];
if ( $this->current_page_number > 9992 )
{
$this->page_range = $this->availables_page_range['very_short'];
}
elseif ( $this->current_page_number > 986 )
{
$this->page_range = $this->availables_page_range[... | [
"protected",
"function",
"setPageRange",
"(",
")",
"{",
"$",
"this",
"->",
"page_range",
"=",
"$",
"this",
"->",
"availables_page_range",
"[",
"'default'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"current_page_number",
">",
"9992",
")",
"{",
"$",
"this",
... | Calculate the start and end of the page range ( windows ) and his possible deviations. | [
"Calculate",
"the",
"start",
"and",
"end",
"of",
"the",
"page",
"range",
"(",
"windows",
")",
"and",
"his",
"possible",
"deviations",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L368-L409 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setCurrentPage | public function setCurrentPage( $page_number )
{
if ( !is_int( $page_number ) )
{
trigger_error( 'Pagination setCurrentPage: Page number must be an integer.' );
return false;
}
if ( $page_number <= 0 )
{
trigger_error( 'Pagination setCurrentPage: Page number must be a positive integer.' );
retur... | php | public function setCurrentPage( $page_number )
{
if ( !is_int( $page_number ) )
{
trigger_error( 'Pagination setCurrentPage: Page number must be an integer.' );
return false;
}
if ( $page_number <= 0 )
{
trigger_error( 'Pagination setCurrentPage: Page number must be a positive integer.' );
retur... | [
"public",
"function",
"setCurrentPage",
"(",
"$",
"page_number",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"page_number",
")",
")",
"{",
"trigger_error",
"(",
"'Pagination setCurrentPage: Page number must be an integer.'",
")",
";",
"return",
"false",
";",
"}"... | Sets the current page number.
@param integer $page_number Page number. | [
"Sets",
"the",
"current",
"page",
"number",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L416-L431 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setItemsPerPage | public function setItemsPerPage( $items_per_page )
{
if ( !is_int( $items_per_page ) )
{
trigger_error( 'Pagination setItemsPerPage: Items per page must be an integer.' );
return false;
}
if ( $items_per_page <= 0 )
{
trigger_error( 'Pagination setItemsPerPage: Items per page must be a positive int... | php | public function setItemsPerPage( $items_per_page )
{
if ( !is_int( $items_per_page ) )
{
trigger_error( 'Pagination setItemsPerPage: Items per page must be an integer.' );
return false;
}
if ( $items_per_page <= 0 )
{
trigger_error( 'Pagination setItemsPerPage: Items per page must be a positive int... | [
"public",
"function",
"setItemsPerPage",
"(",
"$",
"items_per_page",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"items_per_page",
")",
")",
"{",
"trigger_error",
"(",
"'Pagination setItemsPerPage: Items per page must be an integer.'",
")",
";",
"return",
"false",
... | Set number of items per page.
@param integer $items_per_page Number of items per page. | [
"Set",
"number",
"of",
"items",
"per",
"page",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L438-L453 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setMaxPages | public function setMaxPages( $max_num_pages )
{
if ( !is_int( $max_num_pages ) )
{
trigger_error( 'Pagination setMaxPages: Maxim number of pages must be an integer.' );
return false;
}
if ( $max_num_pages <= 0 )
{
trigger_error( 'Pagination setMaxPages: Maxim number of pages must be a positive in... | php | public function setMaxPages( $max_num_pages )
{
if ( !is_int( $max_num_pages ) )
{
trigger_error( 'Pagination setMaxPages: Maxim number of pages must be an integer.' );
return false;
}
if ( $max_num_pages <= 0 )
{
trigger_error( 'Pagination setMaxPages: Maxim number of pages must be a positive in... | [
"public",
"function",
"setMaxPages",
"(",
"$",
"max_num_pages",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"max_num_pages",
")",
")",
"{",
"trigger_error",
"(",
"'Pagination setMaxPages: Maxim number of pages must be an integer.'",
")",
";",
"return",
"false",
"... | Set maxim number of pages to show.
@param integer $max_num_pages Maxim number of pages. | [
"Set",
"maxim",
"number",
"of",
"pages",
"to",
"show",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L460-L475 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setNumTotalResults | public function setNumTotalResults( $total )
{
$total = (int)$total;
if ( $total < 0 )
{
trigger_error( 'Pagination setNumTotalResults: Total must be positive.' );
return false;
}
$this->items_total = $total;
} | php | public function setNumTotalResults( $total )
{
$total = (int)$total;
if ( $total < 0 )
{
trigger_error( 'Pagination setNumTotalResults: Total must be positive.' );
return false;
}
$this->items_total = $total;
} | [
"public",
"function",
"setNumTotalResults",
"(",
"$",
"total",
")",
"{",
"$",
"total",
"=",
"(",
"int",
")",
"$",
"total",
";",
"if",
"(",
"$",
"total",
"<",
"0",
")",
"{",
"trigger_error",
"(",
"'Pagination setNumTotalResults: Total must be positive.'",
")",
... | Set the total number of items.
@param integer $total The total number of items. | [
"Set",
"the",
"total",
"number",
"of",
"items",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L482-L492 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setTemplateParam | public function setTemplateParam( $param, $value )
{
if ( !isset( $param ) || empty( $param ) || !isset( $value ) )
{
trigger_error( "The parameter \$param or \$value can't be empty." );
return false;
}
$this->params_template[$param] = $value;
} | php | public function setTemplateParam( $param, $value )
{
if ( !isset( $param ) || empty( $param ) || !isset( $value ) )
{
trigger_error( "The parameter \$param or \$value can't be empty." );
return false;
}
$this->params_template[$param] = $value;
} | [
"public",
"function",
"setTemplateParam",
"(",
"$",
"param",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"param",
")",
"||",
"empty",
"(",
"$",
"param",
")",
"||",
"!",
"isset",
"(",
"$",
"value",
")",
")",
"{",
"trigger_error",... | Set a parameter assigned to the pagination template.
@param string $param Parameter name assigned to template.
@param mixed $value Value of the parameter. | [
"Set",
"a",
"parameter",
"assigned",
"to",
"the",
"pagination",
"template",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L516-L524 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setTemplate | public function setTemplate( $layout_template )
{
$tpl_config = $this->config->getConfig( 'templates' );
if ( !isset( $tpl_config[$layout_template] ) )
{
trigger_error( "Template file '$layout_template' not found." );
return false;
}
$this->layout_template = ROOT_PATH . '/'. $tpl_config[$layout_temp... | php | public function setTemplate( $layout_template )
{
$tpl_config = $this->config->getConfig( 'templates' );
if ( !isset( $tpl_config[$layout_template] ) )
{
trigger_error( "Template file '$layout_template' not found." );
return false;
}
$this->layout_template = ROOT_PATH . '/'. $tpl_config[$layout_temp... | [
"public",
"function",
"setTemplate",
"(",
"$",
"layout_template",
")",
"{",
"$",
"tpl_config",
"=",
"$",
"this",
"->",
"config",
"->",
"getConfig",
"(",
"'templates'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"tpl_config",
"[",
"$",
"layout_template",
... | Set the pagination template.
@param string $layout_template Name pagination template (this is the .tpl file).
@return boolean | [
"Set",
"the",
"pagination",
"template",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L548-L559 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setDisplayItemsPerPage | public function setDisplayItemsPerPage( $values_to_show )
{
$this->display_items_per_page['display'] = false;
if ( !empty( $values_to_show ) && is_array( $values_to_show ) )
{
$result = array_filter( $values_to_show, "is_integer" );
$this->display_items_per_page['display'] = true;
$this->display_items_p... | php | public function setDisplayItemsPerPage( $values_to_show )
{
$this->display_items_per_page['display'] = false;
if ( !empty( $values_to_show ) && is_array( $values_to_show ) )
{
$result = array_filter( $values_to_show, "is_integer" );
$this->display_items_per_page['display'] = true;
$this->display_items_p... | [
"public",
"function",
"setDisplayItemsPerPage",
"(",
"$",
"values_to_show",
")",
"{",
"$",
"this",
"->",
"display_items_per_page",
"[",
"'display'",
"]",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"values_to_show",
")",
"&&",
"is_array",
"(",
"$",... | Set display items per page.
@param array $values_to_show Values to show. | [
"Set",
"display",
"items",
"per",
"page",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L566-L575 |
sifophp/sifo-common-instance | classes/Pagination.php | Pagination.setWindowPage | public function setWindowPage( $type_page_range, $value )
{
if ( !isset( $this->availables_page_range[$type_page_range] ) )
{
trigger_error( "Pagination setWindowPage: The type of page range ( $type_page_range ), not is valid. ( Availables: default, short and very_short )" );
return false;
}
if ( !is_in... | php | public function setWindowPage( $type_page_range, $value )
{
if ( !isset( $this->availables_page_range[$type_page_range] ) )
{
trigger_error( "Pagination setWindowPage: The type of page range ( $type_page_range ), not is valid. ( Availables: default, short and very_short )" );
return false;
}
if ( !is_in... | [
"public",
"function",
"setWindowPage",
"(",
"$",
"type_page_range",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"availables_page_range",
"[",
"$",
"type_page_range",
"]",
")",
")",
"{",
"trigger_error",
"(",
"\"Pagination se... | Set page range ( window ).
@param array $type_page_range Name of the type of page range to set.
@param integer $value Value of the page range. | [
"Set",
"page",
"range",
"(",
"window",
")",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/Pagination.php#L583-L598 |
guillaumemonet/Rad | src/Rad/Encryption/MCryptEncryption.php | MCryptEncryption.crypt | public function crypt(string $data) {
$keyHash = md5(Config::getConfig()->encrypt->key);
$key = substr($keyHash, 0, mcrypt_get_key_size(self::$cipher, self::$mode));
$iv = substr($keyHash, 0, mcrypt_get_block_size(self::$cipher, self::$mode));
return base64_encode(mcrypt_encrypt(self::$c... | php | public function crypt(string $data) {
$keyHash = md5(Config::getConfig()->encrypt->key);
$key = substr($keyHash, 0, mcrypt_get_key_size(self::$cipher, self::$mode));
$iv = substr($keyHash, 0, mcrypt_get_block_size(self::$cipher, self::$mode));
return base64_encode(mcrypt_encrypt(self::$c... | [
"public",
"function",
"crypt",
"(",
"string",
"$",
"data",
")",
"{",
"$",
"keyHash",
"=",
"md5",
"(",
"Config",
"::",
"getConfig",
"(",
")",
"->",
"encrypt",
"->",
"key",
")",
";",
"$",
"key",
"=",
"substr",
"(",
"$",
"keyHash",
",",
"0",
",",
"m... | Encrypt Datas
@param string $data
@return string | [
"Encrypt",
"Datas"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Encryption/MCryptEncryption.php#L46-L51 |
guillaumemonet/Rad | src/Rad/Encryption/MCryptEncryption.php | MCryptEncryption.decrypt | public function decrypt(string $data) {
$keyHash = md5(Config::getConfig()->encrypt->key);
$key = substr($keyHash, 0, mcrypt_get_key_size(self::$cipher, self::$mode));
$iv = substr($keyHash, 0, mcrypt_get_block_size(self::$cipher, self::$mode));
return mcrypt_decrypt(self::$cipher, $key,... | php | public function decrypt(string $data) {
$keyHash = md5(Config::getConfig()->encrypt->key);
$key = substr($keyHash, 0, mcrypt_get_key_size(self::$cipher, self::$mode));
$iv = substr($keyHash, 0, mcrypt_get_block_size(self::$cipher, self::$mode));
return mcrypt_decrypt(self::$cipher, $key,... | [
"public",
"function",
"decrypt",
"(",
"string",
"$",
"data",
")",
"{",
"$",
"keyHash",
"=",
"md5",
"(",
"Config",
"::",
"getConfig",
"(",
")",
"->",
"encrypt",
"->",
"key",
")",
";",
"$",
"key",
"=",
"substr",
"(",
"$",
"keyHash",
",",
"0",
",",
... | Decrypt Datas
@param string $data
@return string | [
"Decrypt",
"Datas"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Encryption/MCryptEncryption.php#L58-L63 |
guillaumemonet/Rad | src/Rad/Encryption/MCryptEncryption.php | MCryptEncryption.sign | public function sign(string $data, string $secret): string {
return base64_encode(hash_hmac('md5', $data, $secret, true));
} | php | public function sign(string $data, string $secret): string {
return base64_encode(hash_hmac('md5', $data, $secret, true));
} | [
"public",
"function",
"sign",
"(",
"string",
"$",
"data",
",",
"string",
"$",
"secret",
")",
":",
"string",
"{",
"return",
"base64_encode",
"(",
"hash_hmac",
"(",
"'md5'",
",",
"$",
"data",
",",
"$",
"secret",
",",
"true",
")",
")",
";",
"}"
] | Sign current datas
@param string $data
@param string $secret
@return string | [
"Sign",
"current",
"datas"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Encryption/MCryptEncryption.php#L71-L73 |
vardius/crud-bundle | Command/AbstractCommand.php | AbstractCommand.getFinalSchemas | protected function getFinalSchemas(KernelInterface $kernel, BundleInterface $bundle = null)
{
if (null !== $bundle) {
return $this->getSchemasFromBundle($bundle);
}
$finalSchemas = array();
foreach ($kernel->getBundles() as $bundle) {
$finalSchemas = array_me... | php | protected function getFinalSchemas(KernelInterface $kernel, BundleInterface $bundle = null)
{
if (null !== $bundle) {
return $this->getSchemasFromBundle($bundle);
}
$finalSchemas = array();
foreach ($kernel->getBundles() as $bundle) {
$finalSchemas = array_me... | [
"protected",
"function",
"getFinalSchemas",
"(",
"KernelInterface",
"$",
"kernel",
",",
"BundleInterface",
"$",
"bundle",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"bundle",
")",
"{",
"return",
"$",
"this",
"->",
"getSchemasFromBundle",
"(",
"$",... | Return a list of final schema files that will be processed.
@param \Symfony\Component\HttpKernel\KernelInterface $kernel
@return array | [
"Return",
"a",
"list",
"of",
"final",
"schema",
"files",
"that",
"will",
"be",
"processed",
"."
] | train | https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Command/AbstractCommand.php#L100-L112 |
vardius/crud-bundle | Command/AbstractCommand.php | AbstractCommand.getSchemasFromBundle | protected function getSchemasFromBundle(BundleInterface $bundle)
{
$finalSchemas = array();
if (is_dir($dir = $bundle->getPath() . '/Resources/config')) {
$finder = new Finder();
$schemas = $finder->files()->name('*schema.xml')->followLinks()->in($dir);
if (iter... | php | protected function getSchemasFromBundle(BundleInterface $bundle)
{
$finalSchemas = array();
if (is_dir($dir = $bundle->getPath() . '/Resources/config')) {
$finder = new Finder();
$schemas = $finder->files()->name('*schema.xml')->followLinks()->in($dir);
if (iter... | [
"protected",
"function",
"getSchemasFromBundle",
"(",
"BundleInterface",
"$",
"bundle",
")",
"{",
"$",
"finalSchemas",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_dir",
"(",
"$",
"dir",
"=",
"$",
"bundle",
"->",
"getPath",
"(",
")",
".",
"'/Resources/confi... | @param \Symfony\Component\HttpKernel\Bundle\BundleInterface $bundle
@return array | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"HttpKernel",
"\\",
"Bundle",
"\\",
"BundleInterface",
"$bundle"
] | train | https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Command/AbstractCommand.php#L119-L138 |
ahuggins/utilities | src/Console/Commands/UserPassword.php | UserPassword.handle | public function handle()
{
$id = $this->argument('id');
if ($id === null) {
$this->table(
['ID', 'Email'],
User::all(['id', 'email'])->toArray()
);
$id = $this->ask('ID?');
}
User::where('id', $id)->update([
... | php | public function handle()
{
$id = $this->argument('id');
if ($id === null) {
$this->table(
['ID', 'Email'],
User::all(['id', 'email'])->toArray()
);
$id = $this->ask('ID?');
}
User::where('id', $id)->update([
... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"argument",
"(",
"'id'",
")",
";",
"if",
"(",
"$",
"id",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"table",
"(",
"[",
"'ID'",
",",
"'Email'",
"]",
",",
"User",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/ahuggins/utilities/blob/efb79f2dd12335e8115722568239ee22c899e0f1/src/Console/Commands/UserPassword.php#L40-L57 |
AymDev/Phunder | src/User/UserManager.php | UserManager.logIn | public function logIn(array $user_infos) : void
{
$_SESSION['phunder']['user']['logged_in'] = true;
$this->infos = array_merge($this->infos, $user_infos);
$this->save();
} | php | public function logIn(array $user_infos) : void
{
$_SESSION['phunder']['user']['logged_in'] = true;
$this->infos = array_merge($this->infos, $user_infos);
$this->save();
} | [
"public",
"function",
"logIn",
"(",
"array",
"$",
"user_infos",
")",
":",
"void",
"{",
"$",
"_SESSION",
"[",
"'phunder'",
"]",
"[",
"'user'",
"]",
"[",
"'logged_in'",
"]",
"=",
"true",
";",
"$",
"this",
"->",
"infos",
"=",
"array_merge",
"(",
"$",
"t... | Declare the current user as logged in
@param array $user_infos infos to save | [
"Declare",
"the",
"current",
"user",
"as",
"logged",
"in"
] | train | https://github.com/AymDev/Phunder/blob/32dbe6c81100f1ac3fc2a0080e323d8ab31cab10/src/User/UserManager.php#L38-L43 |
phpgearbox/view | src/View.php | View.setDefaults | protected function setDefaults()
{
$this->cachePath = '/tmp/gears-views-cache';
$this->filesystem = function()
{
return new Filesystem;
};
$this->dispatcher = function()
{
return new Dispatcher;
};
$this->fileViewFinder = function()
{
return new FileViewFinder($this->filesystem, $this->vi... | php | protected function setDefaults()
{
$this->cachePath = '/tmp/gears-views-cache';
$this->filesystem = function()
{
return new Filesystem;
};
$this->dispatcher = function()
{
return new Dispatcher;
};
$this->fileViewFinder = function()
{
return new FileViewFinder($this->filesystem, $this->vi... | [
"protected",
"function",
"setDefaults",
"(",
")",
"{",
"$",
"this",
"->",
"cachePath",
"=",
"'/tmp/gears-views-cache'",
";",
"$",
"this",
"->",
"filesystem",
"=",
"function",
"(",
")",
"{",
"return",
"new",
"Filesystem",
";",
"}",
";",
"$",
"this",
"->",
... | Method: setDefaults
=========================================================================
This is where we set all our defaults. If you need to customise this
container this is a good place to look to see what can be configured
and how to configure it.
Parameters:
--------------------------------------------------... | [
"Method",
":",
"setDefaults",
"=========================================================================",
"This",
"is",
"where",
"we",
"set",
"all",
"our",
"defaults",
".",
"If",
"you",
"need",
"to",
"customise",
"this",
"container",
"this",
"is",
"a",
"good",
"place... | train | https://github.com/phpgearbox/view/blob/6d9cd7b433eef7598f0b6e9324b362cadfce80f9/src/View.php#L132-L186 |
mimmi20/Wurfl | src/Handlers/UbuntuTouchOSHandler.php | UbuntuTouchOSHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent)
{
// Mozilla/5.0 (Ubuntu; Mobile) WebKit/537.21
// Mozilla/5.0 (Ubuntu; Tablet) WebKit/537.21
// ^ RIS tolerance
// Mozilla/5.0 (Linux; Ubuntu 14.04 like Android 4.4) AppleWebKit/537.36 Chromium/35.0.1870.2 Mobile ... | php | public function applyConclusiveMatch($userAgent)
{
// Mozilla/5.0 (Ubuntu; Mobile) WebKit/537.21
// Mozilla/5.0 (Ubuntu; Tablet) WebKit/537.21
// ^ RIS tolerance
// Mozilla/5.0 (Linux; Ubuntu 14.04 like Android 4.4) AppleWebKit/537.36 Chromium/35.0.1870.2 Mobile ... | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"// Mozilla/5.0 (Ubuntu; Mobile) WebKit/537.21",
"// Mozilla/5.0 (Ubuntu; Tablet) WebKit/537.21",
"// ^ RIS tolerance",
"// Mozilla/5.0 (Linux; Ubuntu 14.04 like Android 4.4) AppleWebKit/537.36 ... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/UbuntuTouchOSHandler.php#L57-L78 |
dphn/ScContent | src/ScContent/Service/Dir.php | Dir.setModule | public function setModule($namespace)
{
$nsParts = explode('\\', $namespace);
$moduleClass = $nsParts[0] . '\Module';
if (! class_exists($moduleClass, true)) {
throw new InvalidArgumentException(sprintf(
"The Module class was not found in the '%s' namespace.",
... | php | public function setModule($namespace)
{
$nsParts = explode('\\', $namespace);
$moduleClass = $nsParts[0] . '\Module';
if (! class_exists($moduleClass, true)) {
throw new InvalidArgumentException(sprintf(
"The Module class was not found in the '%s' namespace.",
... | [
"public",
"function",
"setModule",
"(",
"$",
"namespace",
")",
"{",
"$",
"nsParts",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"namespace",
")",
";",
"$",
"moduleClass",
"=",
"$",
"nsParts",
"[",
"0",
"]",
".",
"'\\Module'",
";",
"if",
"(",
"!",
"class... | Allows you to change the module.
The root directory of the module is calculated as the directory,
that contains the file of the Module class.
Usage:
<code>
$scDir = $serviceLocator->get('ScService.Dir');
$dir = clone($scDir);
$dir->setModule('MyModuleNamespace');
$myModuleConfigFile = $dir->module('/config/module.conf... | [
"Allows",
"you",
"to",
"change",
"the",
"module",
".",
"The",
"root",
"directory",
"of",
"the",
"module",
"is",
"calculated",
"as",
"the",
"directory",
"that",
"contains",
"the",
"file",
"of",
"the",
"Module",
"class",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Service/Dir.php#L66-L94 |
dphn/ScContent | src/ScContent/Service/Dir.php | Dir.module | public function module($path = '', $checkIfExists = false)
{
$moduleDir = $this->moduleDir;
if ($checkIfExists) {
return realpath($moduleDir . DS . $path);
}
if (empty($path)) {
return $moduleDir;
}
return $moduleDir . DS . $this->normalizePath... | php | public function module($path = '', $checkIfExists = false)
{
$moduleDir = $this->moduleDir;
if ($checkIfExists) {
return realpath($moduleDir . DS . $path);
}
if (empty($path)) {
return $moduleDir;
}
return $moduleDir . DS . $this->normalizePath... | [
"public",
"function",
"module",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"checkIfExists",
"=",
"false",
")",
"{",
"$",
"moduleDir",
"=",
"$",
"this",
"->",
"moduleDir",
";",
"if",
"(",
"$",
"checkIfExists",
")",
"{",
"return",
"realpath",
"(",
"$",
"mo... | Returns the path to the root directory of the module or any
child path.
The root directory of the module is calculated as the
directory, that contains the file of the Module class.
If the flag "checkIfExists" is set to TRUE, checks for the specified path
and if the path was not found, returns FALSE.
Usage:
<code>
$sc... | [
"Returns",
"the",
"path",
"to",
"the",
"root",
"directory",
"of",
"the",
"module",
"or",
"any",
"child",
"path",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Service/Dir.php#L120-L130 |
dphn/ScContent | src/ScContent/Service/Dir.php | Dir.app | public function app($path = '', $checkIfExists = false)
{
$appDir = getcwd();
if ($checkIfExists) {
return realpath($appDir . DS . $path);
}
if (empty($path)) {
return $appDir;
}
return $appDir . DS . $this->normalizePath($path);
} | php | public function app($path = '', $checkIfExists = false)
{
$appDir = getcwd();
if ($checkIfExists) {
return realpath($appDir . DS . $path);
}
if (empty($path)) {
return $appDir;
}
return $appDir . DS . $this->normalizePath($path);
} | [
"public",
"function",
"app",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"checkIfExists",
"=",
"false",
")",
"{",
"$",
"appDir",
"=",
"getcwd",
"(",
")",
";",
"if",
"(",
"$",
"checkIfExists",
")",
"{",
"return",
"realpath",
"(",
"$",
"appDir",
".",
"DS"... | Returns the path to the root directory of the appliacation
or any child path.
If the flag "checkIfExists" is set to TRUE, checks for the specified
path and if the path was not found, returns FALSE.
@param string $path optional
@param boolean $checkIfExists optional default false
@return string|false | [
"Returns",
"the",
"path",
"to",
"the",
"root",
"directory",
"of",
"the",
"appliacation",
"or",
"any",
"child",
"path",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Service/Dir.php#L143-L153 |
dphn/ScContent | src/ScContent/Service/Dir.php | Dir.appAutoload | public function appAutoload($path = '', $checkIfExists = false)
{
$appAutoloadDir = getcwd() . $this->getRelativeAppAutoloadDir();
if ($checkIfExists) {
return realpath($appAutoloadDir . DS . $path);
}
if (empty($path)) {
return $appAutoloadDir;
}
... | php | public function appAutoload($path = '', $checkIfExists = false)
{
$appAutoloadDir = getcwd() . $this->getRelativeAppAutoloadDir();
if ($checkIfExists) {
return realpath($appAutoloadDir . DS . $path);
}
if (empty($path)) {
return $appAutoloadDir;
}
... | [
"public",
"function",
"appAutoload",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"checkIfExists",
"=",
"false",
")",
"{",
"$",
"appAutoloadDir",
"=",
"getcwd",
"(",
")",
".",
"$",
"this",
"->",
"getRelativeAppAutoloadDir",
"(",
")",
";",
"if",
"(",
"$",
"ch... | Returns the path to the application autoload directory or any
child path.
If the flag "checkIfExists" is set to TRUE, checks for the specified
path and if the path was not found, returns FALSE.
Usage:
<code>
$dir = $serviceLocator->get('ScService.Dir');
$myConfigFile = $dir->appAutoload('my.local.php');
</code>
@api... | [
"Returns",
"the",
"path",
"to",
"the",
"application",
"autoload",
"directory",
"or",
"any",
"child",
"path",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Service/Dir.php#L174-L184 |
dphn/ScContent | src/ScContent/Service/Dir.php | Dir.appPublic | public function appPublic($path = '', $checkIfExists = false)
{
$appPublicDir = getcwd() . $this->getRelativeAppPublicDir();
if ($checkIfExists) {
return realpath($appPublicDir . DS . $path);
}
if (empty($path)) {
return $appPublicDir;
}
return... | php | public function appPublic($path = '', $checkIfExists = false)
{
$appPublicDir = getcwd() . $this->getRelativeAppPublicDir();
if ($checkIfExists) {
return realpath($appPublicDir . DS . $path);
}
if (empty($path)) {
return $appPublicDir;
}
return... | [
"public",
"function",
"appPublic",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"checkIfExists",
"=",
"false",
")",
"{",
"$",
"appPublicDir",
"=",
"getcwd",
"(",
")",
".",
"$",
"this",
"->",
"getRelativeAppPublicDir",
"(",
")",
";",
"if",
"(",
"$",
"checkIfE... | Returns the path to the application public directory or any
child path.
If the flag "checkIfExists" is set to TRUE, checks for the specified
path and if the path was not found, returns FALSE.
Usage:
<code>
$dir = $serviceLocator->get('ScService.Dir');
$myAssetsDir = $dir->appPublic('/mydirectory');
$myCss = $dir->app... | [
"Returns",
"the",
"path",
"to",
"the",
"application",
"public",
"directory",
"or",
"any",
"child",
"path",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Service/Dir.php#L206-L216 |
dphn/ScContent | src/ScContent/Service/Dir.php | Dir.appUploads | public function appUploads($path = '', $checkIfExists = false)
{
$appUploadsDir = getcwd() . $this->getRelativeAppUploadsDir();
if ($checkIfExists) {
return realpath($appUploadsDir . DS . $path);
}
if (empty($path)) {
return $appUploadsDir;
}
r... | php | public function appUploads($path = '', $checkIfExists = false)
{
$appUploadsDir = getcwd() . $this->getRelativeAppUploadsDir();
if ($checkIfExists) {
return realpath($appUploadsDir . DS . $path);
}
if (empty($path)) {
return $appUploadsDir;
}
r... | [
"public",
"function",
"appUploads",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"checkIfExists",
"=",
"false",
")",
"{",
"$",
"appUploadsDir",
"=",
"getcwd",
"(",
")",
".",
"$",
"this",
"->",
"getRelativeAppUploadsDir",
"(",
")",
";",
"if",
"(",
"$",
"check... | Returns the path to the upload directory, or any child path.
If the flag "checkIfExists" is set to TRUE, checks for the specified
path and if the path was not found, returns FALSE.
Usage:
<code>
$dir = $serviceLocator->get('ScService.Dir');
$uploadedFile = $dir->appUploads('test.jpg');
</code>
@api
@param string ... | [
"Returns",
"the",
"path",
"to",
"the",
"upload",
"directory",
"or",
"any",
"child",
"path",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Service/Dir.php#L236-L246 |
assely/fielder | src/Field/Tinymce.php | Tinymce.template | public function template(ViewFactory $view)
{
$markup = $view->make('Fielder::Tinymce/Tinymce', [
'fingerprint' => $this->getFingerprint(),
])->render();
return str_replace('name=', ':name=', $markup);
} | php | public function template(ViewFactory $view)
{
$markup = $view->make('Fielder::Tinymce/Tinymce', [
'fingerprint' => $this->getFingerprint(),
])->render();
return str_replace('name=', ':name=', $markup);
} | [
"public",
"function",
"template",
"(",
"ViewFactory",
"$",
"view",
")",
"{",
"$",
"markup",
"=",
"$",
"view",
"->",
"make",
"(",
"'Fielder::Tinymce/Tinymce'",
",",
"[",
"'fingerprint'",
"=>",
"$",
"this",
"->",
"getFingerprint",
"(",
")",
",",
"]",
")",
... | Render field template.
@param \Assely\View\ViewFactory $view
@return void | [
"Render",
"field",
"template",
"."
] | train | https://github.com/assely/fielder/blob/c702ef2426522d1a0a9ca9945547513a7788fcdc/src/Field/Tinymce.php#L22-L29 |
assely/fielder | src/Field/Tinymce.php | Tinymce.assets | public function assets(AssetFactory $asset)
{
$asset->add('fielder-tinymce', [
'path' => FIELDER_URI.'public/js/tinymce.js',
'dependences' => ['fielder'],
])->area('admin');
Hook::action('admin_enqueue_scripts', function () {
wp_enqueue_media();
}... | php | public function assets(AssetFactory $asset)
{
$asset->add('fielder-tinymce', [
'path' => FIELDER_URI.'public/js/tinymce.js',
'dependences' => ['fielder'],
])->area('admin');
Hook::action('admin_enqueue_scripts', function () {
wp_enqueue_media();
}... | [
"public",
"function",
"assets",
"(",
"AssetFactory",
"$",
"asset",
")",
"{",
"$",
"asset",
"->",
"add",
"(",
"'fielder-tinymce'",
",",
"[",
"'path'",
"=>",
"FIELDER_URI",
".",
"'public/js/tinymce.js'",
",",
"'dependences'",
"=>",
"[",
"'fielder'",
"]",
",",
... | Add field assets.
@param \Assely\Asset\AssetFactory $asset
@return void | [
"Add",
"field",
"assets",
"."
] | train | https://github.com/assely/fielder/blob/c702ef2426522d1a0a9ca9945547513a7788fcdc/src/Field/Tinymce.php#L38-L48 |
transfer-framework/transfer | src/Transfer/Storage/Hashing/StandardHashingStrategy.php | StandardHashingStrategy.hash | public function hash($object)
{
if (is_object($object)) {
return spl_object_hash($object);
} elseif (is_string($object)) {
return md5($object);
} elseif (is_array($object)) {
return md5(serialize($object));
}
throw new \InvalidArgumentExce... | php | public function hash($object)
{
if (is_object($object)) {
return spl_object_hash($object);
} elseif (is_string($object)) {
return md5($object);
} elseif (is_array($object)) {
return md5(serialize($object));
}
throw new \InvalidArgumentExce... | [
"public",
"function",
"hash",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"return",
"spl_object_hash",
"(",
"$",
"object",
")",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"object",
")",
")",
"{",
"r... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/Hashing/StandardHashingStrategy.php#L20-L31 |
mimmi20/Wurfl | src/Handlers/Normalizer/Specific/WebOS.php | WebOS.normalize | public function normalize($userAgent)
{
$model = WebOSHandler::getWebOSModelVersion($userAgent);
$osVersion = WebOSHandler::getWebOSVersion($userAgent);
if ($model !== null && $osVersion !== null) {
$prefix = $model . ' ' . $osVersion . WurflConstants::RIS_DELIMITER;
... | php | public function normalize($userAgent)
{
$model = WebOSHandler::getWebOSModelVersion($userAgent);
$osVersion = WebOSHandler::getWebOSVersion($userAgent);
if ($model !== null && $osVersion !== null) {
$prefix = $model . ' ' . $osVersion . WurflConstants::RIS_DELIMITER;
... | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"$",
"model",
"=",
"WebOSHandler",
"::",
"getWebOSModelVersion",
"(",
"$",
"userAgent",
")",
";",
"$",
"osVersion",
"=",
"WebOSHandler",
"::",
"getWebOSVersion",
"(",
"$",
"userAgent",
")",
... | @param string $userAgent
@return string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Specific/WebOS.php#L35-L47 |
MissAllSunday/Ohara | src/Suki/Ohara.php | Ohara.setRegistry | public function setRegistry()
{
global $sourcedir, $scripturl;
global $boarddir, $boardurl;
$this->sourceDir = $sourcedir;
$this->scriptUrl = $scripturl;
$this->boardDir = $boarddir;
$this->boardUrl = $boardurl;
// Create the services.
$this->set();
// Get this mod's config file.
$this['config']... | php | public function setRegistry()
{
global $sourcedir, $scripturl;
global $boarddir, $boardurl;
$this->sourceDir = $sourcedir;
$this->scriptUrl = $scripturl;
$this->boardDir = $boarddir;
$this->boardUrl = $boardurl;
// Create the services.
$this->set();
// Get this mod's config file.
$this['config']... | [
"public",
"function",
"setRegistry",
"(",
")",
"{",
"global",
"$",
"sourcedir",
",",
"$",
"scripturl",
";",
"global",
"$",
"boarddir",
",",
"$",
"boardurl",
";",
"$",
"this",
"->",
"sourceDir",
"=",
"$",
"sourcedir",
";",
"$",
"this",
"->",
"scriptUrl",
... | Registers your function on {@link $_registry} and sets many properties replacing SMF's global vars
Needs to be called by any class extending this class, preferable on a __construct method but can be called when/where necessary.
Calls {@link createHooks()} if there is any runtime hook.
@access public
@return void | [
"Registers",
"your",
"function",
"on",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Ohara.php#L77-L95 |
MissAllSunday/Ohara | src/Suki/Ohara.php | Ohara.createHooks | public function createHooks()
{
global $context;
// Get the hooks.
$hooks = $this['config']->get('availableHooks');
$overwriteHooks = $this['config']->get('overwriteHooks');
// Don't execute on uninstall.
if (!empty($context['uninstalling']) || $this['data']->get('sa') == 'uninstall2' || !$hooks)
retu... | php | public function createHooks()
{
global $context;
// Get the hooks.
$hooks = $this['config']->get('availableHooks');
$overwriteHooks = $this['config']->get('overwriteHooks');
// Don't execute on uninstall.
if (!empty($context['uninstalling']) || $this['data']->get('sa') == 'uninstall2' || !$hooks)
retu... | [
"public",
"function",
"createHooks",
"(",
")",
"{",
"global",
"$",
"context",
";",
"// Get the hooks.",
"$",
"hooks",
"=",
"$",
"this",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'availableHooks'",
")",
";",
"$",
"overwriteHooks",
"=",
"$",
"this",
"[",
"'... | Takes each defined hook in {@link $_availableHooks} and tries to add the relevant data for each hook
@access public | [
"Takes",
"each",
"defined",
"hook",
"in",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Ohara.php#L112-L159 |
MissAllSunday/Ohara | src/Suki/Ohara.php | Ohara.disableHooks | public function disableHooks(&$config_vars)
{
$hooks = $this['config']->get('availableHooks');
// No hooks were found. Nothing to do.
if (!$hooks)
return false;
// A title and a description.
if ($this->text('disable_hook_title'))
$config_vars[] = array('title', 'Ohara_disableHooks_title', 'label' => ... | php | public function disableHooks(&$config_vars)
{
$hooks = $this['config']->get('availableHooks');
// No hooks were found. Nothing to do.
if (!$hooks)
return false;
// A title and a description.
if ($this->text('disable_hook_title'))
$config_vars[] = array('title', 'Ohara_disableHooks_title', 'label' => ... | [
"public",
"function",
"disableHooks",
"(",
"&",
"$",
"config_vars",
")",
"{",
"$",
"hooks",
"=",
"$",
"this",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'availableHooks'",
")",
";",
"// No hooks were found. Nothing to do.",
"if",
"(",
"!",
"$",
"hooks",
")",
... | Takes each defined hook in {@link $_availableHooks} and tries to create an admin setting for it.
Uses a few specific text strings: disable_hook_title, disable_hook_desc, disable_hook and disable_hook_sub the only required text string is disable_hook.
@param array $config_vars Passed by reference, a regular SMF's config... | [
"Takes",
"each",
"defined",
"hook",
"in",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Ohara.php#L168-L199 |
MissAllSunday/Ohara | src/Suki/Ohara.php | Ohara.text | public function text($var)
{
global $txt;
// This should be extended by somebody else...
if (!$this->name || empty($var))
return false;
// Does nothing if the file is already loaded.
loadLanguage($this->name);
return !empty($txt[$this->name .'_'. $var]) ? $txt[$this->name .'_'. $var] : false;
} | php | public function text($var)
{
global $txt;
// This should be extended by somebody else...
if (!$this->name || empty($var))
return false;
// Does nothing if the file is already loaded.
loadLanguage($this->name);
return !empty($txt[$this->name .'_'. $var]) ? $txt[$this->name .'_'. $var] : false;
} | [
"public",
"function",
"text",
"(",
"$",
"var",
")",
"{",
"global",
"$",
"txt",
";",
"// This should be extended by somebody else...",
"if",
"(",
"!",
"$",
"this",
"->",
"name",
"||",
"empty",
"(",
"$",
"var",
")",
")",
"return",
"false",
";",
"// Does noth... | Getter for {@link $_text} property.
@access public
@param string $var The name of the $txt key you want to retrieve
@return bool|string | [
"Getter",
"for",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Ohara.php#L207-L219 |
MissAllSunday/Ohara | src/Suki/Ohara.php | Ohara.enable | public function enable($var): bool
{
global $modSettings;
// This should be extended by somebody else...
if (empty($this->name) || empty($var))
return false;
if (!empty($modSettings[$this->name .'_'. $var]))
return true;
else
return false;
} | php | public function enable($var): bool
{
global $modSettings;
// This should be extended by somebody else...
if (empty($this->name) || empty($var))
return false;
if (!empty($modSettings[$this->name .'_'. $var]))
return true;
else
return false;
} | [
"public",
"function",
"enable",
"(",
"$",
"var",
")",
":",
"bool",
"{",
"global",
"$",
"modSettings",
";",
"// This should be extended by somebody else...",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"name",
")",
"||",
"empty",
"(",
"$",
"var",
")",
")",
... | Checks for a $modSetting key and its state
returns true if the $modSetting exists and its not empty regardless of what its value is
@param string $var The name of the $modSetting key you want to retrieve
@access public
@return boolean | [
"Checks",
"for",
"a",
"$modSetting",
"key",
"and",
"its",
"state",
"returns",
"true",
"if",
"the",
"$modSetting",
"exists",
"and",
"its",
"not",
"empty",
"regardless",
"of",
"what",
"its",
"value",
"is"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Ohara.php#L228-L241 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.