id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
18,800
ClanCats/Core
src/classes/CCImage.php
CCImage.create
public static function create( $file, $type = null ) { // when no type is given use the file extension if ( is_null( $type ) ) { $type = CCStr::extension( $file ); // validate type if ( !in_array( $type, static::$available_image_types ) ) { $type = null; } } $image_data = getimagesize(...
php
public static function create( $file, $type = null ) { // when no type is given use the file extension if ( is_null( $type ) ) { $type = CCStr::extension( $file ); // validate type if ( !in_array( $type, static::$available_image_types ) ) { $type = null; } } $image_data = getimagesize(...
[ "public", "static", "function", "create", "(", "$", "file", ",", "$", "type", "=", "null", ")", "{", "// when no type is given use the file extension", "if", "(", "is_null", "(", "$", "type", ")", ")", "{", "$", "type", "=", "CCStr", "::", "extension", "("...
Create a image from file @param string $file @param string $type jpg|png|gif @return CCImage|false
[ "Create", "a", "image", "from", "file" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L57-L108
18,801
ClanCats/Core
src/classes/CCImage.php
CCImage.string
public static function string( $string, $type = null ) { $image = imagecreatefromstring( $string ); if ( $image !== false ) { return new static( $image, $type ); } return false; }
php
public static function string( $string, $type = null ) { $image = imagecreatefromstring( $string ); if ( $image !== false ) { return new static( $image, $type ); } return false; }
[ "public", "static", "function", "string", "(", "$", "string", ",", "$", "type", "=", "null", ")", "{", "$", "image", "=", "imagecreatefromstring", "(", "$", "string", ")", ";", "if", "(", "$", "image", "!==", "false", ")", "{", "return", "new", "stat...
Create an image from string @param string $string The image data string @param string $type jpg|png|gif @return CCImage|false
[ "Create", "an", "image", "from", "string" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L118-L128
18,802
ClanCats/Core
src/classes/CCImage.php
CCImage.aspect_ratio
public static function aspect_ratio( $width, $height, $proper = false ) { $ratio = $width / $height; if ( !$proper ) { return $ratio; } $tolerance = 1.e-6; $h1=1; $h2=0; $k1=0; $k2=1; $b = 1/$ratio; do { $b = 1/$b; $a = floor($b); $aux = $h1; $h1 = $a*$h1+$h2; $h2 = $aux; $aux = $...
php
public static function aspect_ratio( $width, $height, $proper = false ) { $ratio = $width / $height; if ( !$proper ) { return $ratio; } $tolerance = 1.e-6; $h1=1; $h2=0; $k1=0; $k2=1; $b = 1/$ratio; do { $b = 1/$b; $a = floor($b); $aux = $h1; $h1 = $a*$h1+$h2; $h2 = $aux; $aux = $...
[ "public", "static", "function", "aspect_ratio", "(", "$", "width", ",", "$", "height", ",", "$", "proper", "=", "false", ")", "{", "$", "ratio", "=", "$", "width", "/", "$", "height", ";", "if", "(", "!", "$", "proper", ")", "{", "return", "$", "...
Calculate the aspect ratio @param int $width @param int $height @param bool $proper @return string @thanks to: http://jonisalonen.com/2012/converting-decimal-numbers-to-ratios/
[ "Calculate", "the", "aspect", "ratio" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L141-L165
18,803
ClanCats/Core
src/classes/CCImage.php
CCImage.reload_context_info
protected function reload_context_info() { $this->width = imagesx( $this->image_context ); $this->height = imagesy( $this->image_context ); }
php
protected function reload_context_info() { $this->width = imagesx( $this->image_context ); $this->height = imagesy( $this->image_context ); }
[ "protected", "function", "reload_context_info", "(", ")", "{", "$", "this", "->", "width", "=", "imagesx", "(", "$", "this", "->", "image_context", ")", ";", "$", "this", "->", "height", "=", "imagesy", "(", "$", "this", "->", "image_context", ")", ";", ...
Reload the image dimension etc. @return void
[ "Reload", "the", "image", "dimension", "etc", "." ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L221-L225
18,804
ClanCats/Core
src/classes/CCImage.php
CCImage.set_type
protected function set_type( $type, $overwrite = true ) { if ( !is_null( $type ) ) { if ( !in_array( $type, static::$available_image_types ) ) { throw new CCException( "CCImage - Invalid image type '".$type."'." ); } // don't allow jpg, set to jpeg if ( $type === 'jpg' ) { $type = 'jpeg'...
php
protected function set_type( $type, $overwrite = true ) { if ( !is_null( $type ) ) { if ( !in_array( $type, static::$available_image_types ) ) { throw new CCException( "CCImage - Invalid image type '".$type."'." ); } // don't allow jpg, set to jpeg if ( $type === 'jpg' ) { $type = 'jpeg'...
[ "protected", "function", "set_type", "(", "$", "type", ",", "$", "overwrite", "=", "true", ")", "{", "if", "(", "!", "is_null", "(", "$", "type", ")", ")", "{", "if", "(", "!", "in_array", "(", "$", "type", ",", "static", "::", "$", "available_imag...
Set the current image type @param string $type The new image type @param string $overwrite Should the image keep this type? @return string
[ "Set", "the", "current", "image", "type" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L234-L256
18,805
ClanCats/Core
src/classes/CCImage.php
CCImage.stream
public function stream( $quality = null, $type = null ) { $this->save( null, $quality, $type ); }
php
public function stream( $quality = null, $type = null ) { $this->save( null, $quality, $type ); }
[ "public", "function", "stream", "(", "$", "quality", "=", "null", ",", "$", "type", "=", "null", ")", "{", "$", "this", "->", "save", "(", "null", ",", "$", "quality", ",", "$", "type", ")", ";", "}" ]
Send the image to the output buffer @param int $quality @param string $type jpg|png|gif @return void
[ "Send", "the", "image", "to", "the", "output", "buffer" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L325-L328
18,806
ClanCats/Core
src/classes/CCImage.php
CCImage.stringify
public function stringify( $quality = null, $type = null ) { ob_start(); $this->stream( $quality, $type ); return ob_get_clean(); }
php
public function stringify( $quality = null, $type = null ) { ob_start(); $this->stream( $quality, $type ); return ob_get_clean(); }
[ "public", "function", "stringify", "(", "$", "quality", "=", "null", ",", "$", "type", "=", "null", ")", "{", "ob_start", "(", ")", ";", "$", "this", "->", "stream", "(", "$", "quality", ",", "$", "type", ")", ";", "return", "ob_get_clean", "(", ")...
Return the image data as string @param int $quality @param string $type jpg|png|gif @return string
[ "Return", "the", "image", "data", "as", "string" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L337-L340
18,807
ClanCats/Core
src/classes/CCImage.php
CCImage.response
public function response( $quality = null, $type = null ) { $response = CCResponse::create( $this->stringify( $quality, $type ) ); if ( !is_null( $this->type ) ) { $response->header( 'Content-Type', 'image/'.$this->type ); } return $response; }
php
public function response( $quality = null, $type = null ) { $response = CCResponse::create( $this->stringify( $quality, $type ) ); if ( !is_null( $this->type ) ) { $response->header( 'Content-Type', 'image/'.$this->type ); } return $response; }
[ "public", "function", "response", "(", "$", "quality", "=", "null", ",", "$", "type", "=", "null", ")", "{", "$", "response", "=", "CCResponse", "::", "create", "(", "$", "this", "->", "stringify", "(", "$", "quality", ",", "$", "type", ")", ")", "...
Create a CCRespone of the image @param string $quality The image quality @param string $type jpg|png|gif @return CCresponse
[ "Create", "a", "CCRespone", "of", "the", "image" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L349-L359
18,808
ClanCats/Core
src/classes/CCImage.php
CCImage.resize
public function resize( $width, $height, $mode = null ) { // check for alternative syntax if ( strpos( $width, 'x' ) !== false ) { // mode is the secound param $mode = $height; $dimensions = explode( 'x', $width ); $width = $dimensions[0]; $height = $dimensions[1]; } // default mode if...
php
public function resize( $width, $height, $mode = null ) { // check for alternative syntax if ( strpos( $width, 'x' ) !== false ) { // mode is the secound param $mode = $height; $dimensions = explode( 'x', $width ); $width = $dimensions[0]; $height = $dimensions[1]; } // default mode if...
[ "public", "function", "resize", "(", "$", "width", ",", "$", "height", ",", "$", "mode", "=", "null", ")", "{", "// check for alternative syntax ", "if", "(", "strpos", "(", "$", "width", ",", "'x'", ")", "!==", "false", ")", "{", "// mode is the secound p...
Resize the image Examples: // simple resize $image->resize( '200x150', 'fill' ); // does the same as $image->resize( 200, 150, 'fill' ); // you can use auto values $image->resize( 500, 'auto' ); @param int $width @param int $height @param string $mode @return self
[ "Resize", "the", "image" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L378-L418
18,809
ClanCats/Core
src/classes/CCImage.php
CCImage.resize_landscape
public function resize_landscape( $width, $ignore_me ) { // calculate height $height = $width * ( $this->height / $this->width ); return $this->resize_strict( $width, $height ); }
php
public function resize_landscape( $width, $ignore_me ) { // calculate height $height = $width * ( $this->height / $this->width ); return $this->resize_strict( $width, $height ); }
[ "public", "function", "resize_landscape", "(", "$", "width", ",", "$", "ignore_me", ")", "{", "// calculate height", "$", "height", "=", "$", "width", "*", "(", "$", "this", "->", "height", "/", "$", "this", "->", "width", ")", ";", "return", "$", "thi...
Resize the current image from width and keep aspect ratio @param int $width @param int $height @return self
[ "Resize", "the", "current", "image", "from", "width", "and", "keep", "aspect", "ratio" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L427-L433
18,810
ClanCats/Core
src/classes/CCImage.php
CCImage.resize_portrait
public function resize_portrait( $height, $ignore_me ) { // calculate width $width = $height * ( $this->width / $this->height ); return $this->resize_strict( $width, $height ); }
php
public function resize_portrait( $height, $ignore_me ) { // calculate width $width = $height * ( $this->width / $this->height ); return $this->resize_strict( $width, $height ); }
[ "public", "function", "resize_portrait", "(", "$", "height", ",", "$", "ignore_me", ")", "{", "// calculate width", "$", "width", "=", "$", "height", "*", "(", "$", "this", "->", "width", "/", "$", "this", "->", "height", ")", ";", "return", "$", "this...
Resize the current image from height and keep aspect ratio @param int $width @param int $height @return self
[ "Resize", "the", "current", "image", "from", "height", "and", "keep", "aspect", "ratio" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L442-L448
18,811
ClanCats/Core
src/classes/CCImage.php
CCImage.resize_max
public function resize_max( $width, $height ) { $new_width = $this->width; $new_height = $this->height; if ( $new_width > $width ) { // set new with $new_width = $width; // calculate height $new_height = $new_width * ( $this->height / $this->width ); } if ( $new_height > $height ) { /...
php
public function resize_max( $width, $height ) { $new_width = $this->width; $new_height = $this->height; if ( $new_width > $width ) { // set new with $new_width = $width; // calculate height $new_height = $new_width * ( $this->height / $this->width ); } if ( $new_height > $height ) { /...
[ "public", "function", "resize_max", "(", "$", "width", ",", "$", "height", ")", "{", "$", "new_width", "=", "$", "this", "->", "width", ";", "$", "new_height", "=", "$", "this", "->", "height", ";", "if", "(", "$", "new_width", ">", "$", "width", "...
Resize the image that it fits into a size doesn't crop and does not add a border @param int $width @param int $height @return self
[ "Resize", "the", "image", "that", "it", "fits", "into", "a", "size", "doesn", "t", "crop", "and", "does", "not", "add", "a", "border" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L457-L479
18,812
ClanCats/Core
src/classes/CCImage.php
CCImage.resize_fit
public function resize_fit( $width, $height, $background_color = '#fff' ) { $background = static::blank( $width, $height ); // make out actual image max size static::resize_max( $width, $height ); // make background white $background->fill_color( $background_color ); // add the layer $background->add...
php
public function resize_fit( $width, $height, $background_color = '#fff' ) { $background = static::blank( $width, $height ); // make out actual image max size static::resize_max( $width, $height ); // make background white $background->fill_color( $background_color ); // add the layer $background->add...
[ "public", "function", "resize_fit", "(", "$", "width", ",", "$", "height", ",", "$", "background_color", "=", "'#fff'", ")", "{", "$", "background", "=", "static", "::", "blank", "(", "$", "width", ",", "$", "height", ")", ";", "// make out actual image ma...
Resize the image that it fits into a size doesn't crop adds a background layer @param int $width @param int $height @return self
[ "Resize", "the", "image", "that", "it", "fits", "into", "a", "size", "doesn", "t", "crop", "adds", "a", "background", "layer" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L488-L510
18,813
ClanCats/Core
src/classes/CCImage.php
CCImage.resize_fill
public function resize_fill( $width, $height ) { $original_aspect = $this->width / $this->height; $thumb_aspect = $width / $height; if ( $original_aspect >= $thumb_aspect ) { $new_height = $height; $new_width = $this->width / ($this->height / $height); } else { $new_width = $width; ...
php
public function resize_fill( $width, $height ) { $original_aspect = $this->width / $this->height; $thumb_aspect = $width / $height; if ( $original_aspect >= $thumb_aspect ) { $new_height = $height; $new_width = $this->width / ($this->height / $height); } else { $new_width = $width; ...
[ "public", "function", "resize_fill", "(", "$", "width", ",", "$", "height", ")", "{", "$", "original_aspect", "=", "$", "this", "->", "width", "/", "$", "this", "->", "height", ";", "$", "thumb_aspect", "=", "$", "width", "/", "$", "height", ";", "if...
Resize the image to fill the new size. This will crop your image. @param int $width @param int $height @return self @thanks to: http://stackoverflow.com/questions/1855996/crop-image-in-php
[ "Resize", "the", "image", "to", "fill", "the", "new", "size", ".", "This", "will", "crop", "your", "image", "." ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L521-L551
18,814
ClanCats/Core
src/classes/CCImage.php
CCImage.resize_strict
public function resize_strict( $width, $height ) { // check dimensions if ( !( $width > 0 ) || !( $height > 0 ) ) { throw new CCException( "CCImage::resize_strict - width and height can't be smaller then 1" ); } $result = imagecreatetruecolor( $width, $height ); imagecopyresampled( $result, $this->...
php
public function resize_strict( $width, $height ) { // check dimensions if ( !( $width > 0 ) || !( $height > 0 ) ) { throw new CCException( "CCImage::resize_strict - width and height can't be smaller then 1" ); } $result = imagecreatetruecolor( $width, $height ); imagecopyresampled( $result, $this->...
[ "public", "function", "resize_strict", "(", "$", "width", ",", "$", "height", ")", "{", "// check dimensions", "if", "(", "!", "(", "$", "width", ">", "0", ")", "||", "!", "(", "$", "height", ">", "0", ")", ")", "{", "throw", "new", "CCException", ...
Resize the current image to strict dimensions @param int $width @param int $height @param string $mode @return self
[ "Resize", "the", "current", "image", "to", "strict", "dimensions" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L562-L581
18,815
ClanCats/Core
src/classes/CCImage.php
CCImage.crop
public function crop( $x, $y, $width, $height ) { // check for auto if ( $x == 'center' || $x == 'auto' ) { $x = ( $this->width / 2 ) - ( $width / 2 ); } if ( $y == 'middle' || $y == 'auto' ) { $y = ( $this->height / 2 ) - ( $height / 2 ); } $result = imagecreatetruecolor( $width, $height ); ...
php
public function crop( $x, $y, $width, $height ) { // check for auto if ( $x == 'center' || $x == 'auto' ) { $x = ( $this->width / 2 ) - ( $width / 2 ); } if ( $y == 'middle' || $y == 'auto' ) { $y = ( $this->height / 2 ) - ( $height / 2 ); } $result = imagecreatetruecolor( $width, $height ); ...
[ "public", "function", "crop", "(", "$", "x", ",", "$", "y", ",", "$", "width", ",", "$", "height", ")", "{", "// check for auto", "if", "(", "$", "x", "==", "'center'", "||", "$", "x", "==", "'auto'", ")", "{", "$", "x", "=", "(", "$", "this", ...
Crop the current image This is a simplefied crop. @param int $x @param int $y @param int $width @param int $height @return self
[ "Crop", "the", "current", "image" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L595-L618
18,816
ClanCats/Core
src/classes/CCImage.php
CCImage.add_layer
public function add_layer( CCImage $image, $x = 0, $y = 0, $alpha = 100 ) { // auto values if ( $x == 'center' || $x == 'auto' ) { $x = ( $this->width / 2 ) - ( $image->width / 2 ); } elseif ( $x == 'left' ) { $x = 0; } elseif ( $x == 'right' ) { $x = $this->width - $image->width; } if...
php
public function add_layer( CCImage $image, $x = 0, $y = 0, $alpha = 100 ) { // auto values if ( $x == 'center' || $x == 'auto' ) { $x = ( $this->width / 2 ) - ( $image->width / 2 ); } elseif ( $x == 'left' ) { $x = 0; } elseif ( $x == 'right' ) { $x = $this->width - $image->width; } if...
[ "public", "function", "add_layer", "(", "CCImage", "$", "image", ",", "$", "x", "=", "0", ",", "$", "y", "=", "0", ",", "$", "alpha", "=", "100", ")", "{", "// auto values", "if", "(", "$", "x", "==", "'center'", "||", "$", "x", "==", "'auto'", ...
add an layer to the current image @param CCImage $image @param int $x @param int $y @return self
[ "add", "an", "layer", "to", "the", "current", "image" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L629-L662
18,817
ClanCats/Core
src/classes/CCImage.php
CCImage.fill_color
public function fill_color( $color, $alpha = 1 ) { $alpha = $alpha * 127; // parse the color $color = CCColor::create( $color ); $color = imagecolorallocatealpha( $this->image_context, $color->RGB[0], $color->RGB[1], $color->RGB[2], $alpha ); // run image fill imagefill( $this->image_context, 0, 0, $col...
php
public function fill_color( $color, $alpha = 1 ) { $alpha = $alpha * 127; // parse the color $color = CCColor::create( $color ); $color = imagecolorallocatealpha( $this->image_context, $color->RGB[0], $color->RGB[1], $color->RGB[2], $alpha ); // run image fill imagefill( $this->image_context, 0, 0, $col...
[ "public", "function", "fill_color", "(", "$", "color", ",", "$", "alpha", "=", "1", ")", "{", "$", "alpha", "=", "$", "alpha", "*", "127", ";", "// parse the color", "$", "color", "=", "CCColor", "::", "create", "(", "$", "color", ")", ";", "$", "c...
fill the current image with an color you can pass an array with rgb or hex string @param mixed $color @return self
[ "fill", "the", "current", "image", "with", "an", "color", "you", "can", "pass", "an", "array", "with", "rgb", "or", "hex", "string" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L671-L683
18,818
ClanCats/Core
src/classes/CCImage.php
CCImage.blur
public function blur( $ratio = 5 ) { for ($x=0; $x<$ratio; $x++) { imagefilter($this->image_context, IMG_FILTER_GAUSSIAN_BLUR); //$gaussian = array(array(1.0, 2.0, 1.0), array(2.0, 1.0, 2.0), array(1.0, 2.0, 1.0)); //imageconvolution($this->image_context, $gaussian, 16, 0); } return $this; }
php
public function blur( $ratio = 5 ) { for ($x=0; $x<$ratio; $x++) { imagefilter($this->image_context, IMG_FILTER_GAUSSIAN_BLUR); //$gaussian = array(array(1.0, 2.0, 1.0), array(2.0, 1.0, 2.0), array(1.0, 2.0, 1.0)); //imageconvolution($this->image_context, $gaussian, 16, 0); } return $this; }
[ "public", "function", "blur", "(", "$", "ratio", "=", "5", ")", "{", "for", "(", "$", "x", "=", "0", ";", "$", "x", "<", "$", "ratio", ";", "$", "x", "++", ")", "{", "imagefilter", "(", "$", "this", "->", "image_context", ",", "IMG_FILTER_GAUSSIA...
Blur the image using the gaussian blur. @param int $ratio @return self
[ "Blur", "the", "image", "using", "the", "gaussian", "blur", "." ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L691-L701
18,819
ClanCats/Core
src/classes/CCImage.php
CCImage.get_luminance
public function get_luminance( $num_samples = 10 ) { $x_step = (int) $this->width / $num_samples; $y_step = (int) $this->height / $num_samples; $total_lum = 0; $sample_no = 1; for ( $x=0; $x<$this->width; $x+=$x_step ) { for ( $y=0; $y<$this->height; $y+=$y_step ) { $rgb = imagecolorat($this...
php
public function get_luminance( $num_samples = 10 ) { $x_step = (int) $this->width / $num_samples; $y_step = (int) $this->height / $num_samples; $total_lum = 0; $sample_no = 1; for ( $x=0; $x<$this->width; $x+=$x_step ) { for ( $y=0; $y<$this->height; $y+=$y_step ) { $rgb = imagecolorat($this...
[ "public", "function", "get_luminance", "(", "$", "num_samples", "=", "10", ")", "{", "$", "x_step", "=", "(", "int", ")", "$", "this", "->", "width", "/", "$", "num_samples", ";", "$", "y_step", "=", "(", "int", ")", "$", "this", "->", "height", "/...
Get the average luminance of the image @param int $num_samples @return int ( 1-255 ) @thanks to: http://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color
[ "Get", "the", "average", "luminance", "of", "the", "image" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L711-L736
18,820
ClanCats/Core
src/classes/CCImage.php
CCImage.flip
function flip( $mode ) { $width = $this->width; $height = $this->height; $src_x = 0; $src_y = 0; $src_width = $width; $src_height = $height; switch ( $mode ) { case 'vertical': $src_y = $height -1; $src_height = -$height; break; case 'horizontal': $src_x = $width -1; $src_w...
php
function flip( $mode ) { $width = $this->width; $height = $this->height; $src_x = 0; $src_y = 0; $src_width = $width; $src_height = $height; switch ( $mode ) { case 'vertical': $src_y = $height -1; $src_height = -$height; break; case 'horizontal': $src_x = $width -1; $src_w...
[ "function", "flip", "(", "$", "mode", ")", "{", "$", "width", "=", "$", "this", "->", "width", ";", "$", "height", "=", "$", "this", "->", "height", ";", "$", "src_x", "=", "0", ";", "$", "src_y", "=", "0", ";", "$", "src_width", "=", "$", "w...
Flip an image @param string $mode vertical, horizontal, both @return self
[ "Flip", "an", "image" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCImage.php#L744-L783
18,821
kattsoftware/phassets
src/Phassets/Phassets.php
Phassets.work
public function work($file, $customFilters = null, $customDeployer = null) { // Create the Asset instance foreach ($this->assetsSource as $source) { if (is_file($source . DIRECTORY_SEPARATOR . $file)) { $asset = $this->objectsFactory->buildAsset($source . DIRECTORY_SEPARA...
php
public function work($file, $customFilters = null, $customDeployer = null) { // Create the Asset instance foreach ($this->assetsSource as $source) { if (is_file($source . DIRECTORY_SEPARATOR . $file)) { $asset = $this->objectsFactory->buildAsset($source . DIRECTORY_SEPARA...
[ "public", "function", "work", "(", "$", "file", ",", "$", "customFilters", "=", "null", ",", "$", "customDeployer", "=", "null", ")", "{", "// Create the Asset instance", "foreach", "(", "$", "this", "->", "assetsSource", "as", "$", "source", ")", "{", "if...
Processes and deploys an asset and returns an Asset instance with modified properties, according to used filters and deployers. @param string $file file name to be searched through "assets_source" @param null|array $customFilters Overrides "filter" setting @param null|string $customDeployer Overrides the loaded deploy...
[ "Processes", "and", "deploys", "an", "asset", "and", "returns", "an", "Asset", "instance", "with", "modified", "properties", "according", "to", "used", "filters", "and", "deployers", "." ]
cc982cf1941eb5776287d64f027218bd4835ed2b
https://github.com/kattsoftware/phassets/blob/cc982cf1941eb5776287d64f027218bd4835ed2b/src/Phassets/Phassets.php#L163-L224
18,822
kattsoftware/phassets
src/Phassets/Phassets.php
Phassets.deployAsset
private function deployAsset($deploy, Asset $asset) { if ($this->loadDeployer($deploy)) { try { $this->deployersInstances[$deploy]->deploy($asset); } catch (PhassetsInternalException $e) { $this->loadedLogger->error('An error occurred while deploying t...
php
private function deployAsset($deploy, Asset $asset) { if ($this->loadDeployer($deploy)) { try { $this->deployersInstances[$deploy]->deploy($asset); } catch (PhassetsInternalException $e) { $this->loadedLogger->error('An error occurred while deploying t...
[ "private", "function", "deployAsset", "(", "$", "deploy", ",", "Asset", "$", "asset", ")", "{", "if", "(", "$", "this", "->", "loadDeployer", "(", "$", "deploy", ")", ")", "{", "try", "{", "$", "this", "->", "deployersInstances", "[", "$", "deploy", ...
Tries to load a deployer and passes the Asset instance through it. @param string $deploy Deployer to load/use @param Asset $asset
[ "Tries", "to", "load", "a", "deployer", "and", "passes", "the", "Asset", "instance", "through", "it", "." ]
cc982cf1941eb5776287d64f027218bd4835ed2b
https://github.com/kattsoftware/phassets/blob/cc982cf1941eb5776287d64f027218bd4835ed2b/src/Phassets/Phassets.php#L275-L284
18,823
kattsoftware/phassets
src/Phassets/Phassets.php
Phassets.loadFilter
private function loadFilter($class) { if (isset($this->filtersInstances[$class])) { return true; } $filter = $this->objectsFactory->buildFilter($class, $this->loadedConfigurator); if ($filter === false) { $this->loadedLogger->warning('Could not load ' . $cla...
php
private function loadFilter($class) { if (isset($this->filtersInstances[$class])) { return true; } $filter = $this->objectsFactory->buildFilter($class, $this->loadedConfigurator); if ($filter === false) { $this->loadedLogger->warning('Could not load ' . $cla...
[ "private", "function", "loadFilter", "(", "$", "class", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "filtersInstances", "[", "$", "class", "]", ")", ")", "{", "return", "true", ";", "}", "$", "filter", "=", "$", "this", "->", "objectsFactor...
Try to create & load an instance of a given Filter class name. @param string $class @return bool Whether the loading succeeded or not
[ "Try", "to", "create", "&", "load", "an", "instance", "of", "a", "given", "Filter", "class", "name", "." ]
cc982cf1941eb5776287d64f027218bd4835ed2b
https://github.com/kattsoftware/phassets/blob/cc982cf1941eb5776287d64f027218bd4835ed2b/src/Phassets/Phassets.php#L345-L363
18,824
kattsoftware/phassets
src/Phassets/Phassets.php
Phassets.loadDeployer
private function loadDeployer($class) { if (isset($this->deployersInstances[$class])) { return true; } $deployer = $this->objectsFactory->buildDeployer($class, $this->loadedConfigurator, $this->loadedCacheAdapter); if ($deployer === false) { $this->loadedLog...
php
private function loadDeployer($class) { if (isset($this->deployersInstances[$class])) { return true; } $deployer = $this->objectsFactory->buildDeployer($class, $this->loadedConfigurator, $this->loadedCacheAdapter); if ($deployer === false) { $this->loadedLog...
[ "private", "function", "loadDeployer", "(", "$", "class", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "deployersInstances", "[", "$", "class", "]", ")", ")", "{", "return", "true", ";", "}", "$", "deployer", "=", "$", "this", "->", "objects...
Try to create & load an instance of a given Deployer class name. @param string $class @return bool Whether the loading succeeded or not
[ "Try", "to", "create", "&", "load", "an", "instance", "of", "a", "given", "Deployer", "class", "name", "." ]
cc982cf1941eb5776287d64f027218bd4835ed2b
https://github.com/kattsoftware/phassets/blob/cc982cf1941eb5776287d64f027218bd4835ed2b/src/Phassets/Phassets.php#L371-L395
18,825
kattsoftware/phassets
src/Phassets/Phassets.php
Phassets.loadAssetsManager
private function loadAssetsManager($class) { if (isset($this->assetsMergerInstances[$class])) { return true; } $merger = $this->objectsFactory->buildAssetsMerger($class, $this->loadedConfigurator); if ($merger === false) { $this->loadedLogger->warning('Could...
php
private function loadAssetsManager($class) { if (isset($this->assetsMergerInstances[$class])) { return true; } $merger = $this->objectsFactory->buildAssetsMerger($class, $this->loadedConfigurator); if ($merger === false) { $this->loadedLogger->warning('Could...
[ "private", "function", "loadAssetsManager", "(", "$", "class", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "assetsMergerInstances", "[", "$", "class", "]", ")", ")", "{", "return", "true", ";", "}", "$", "merger", "=", "$", "this", "->", "o...
Try to create & load an instance of a given AssetsMerger class name. @param string $class Fully qualified class name @return bool Whether the loading succeeded or not
[ "Try", "to", "create", "&", "load", "an", "instance", "of", "a", "given", "AssetsMerger", "class", "name", "." ]
cc982cf1941eb5776287d64f027218bd4835ed2b
https://github.com/kattsoftware/phassets/blob/cc982cf1941eb5776287d64f027218bd4835ed2b/src/Phassets/Phassets.php#L403-L421
18,826
webtown-php/KunstmaanExtensionBundle
src/Configuration/SearchableEntityConfiguration.php
SearchableEntityConfiguration.populateIndex
public function populateIndex() { $this->buildDocumentsByManager($this->doctrine); if ($this->mongo) { $this->buildDocumentsByManager($this->mongo); } if (!empty($this->documents)) { $response = $this->searchProvider->addDocuments($this->documents); ...
php
public function populateIndex() { $this->buildDocumentsByManager($this->doctrine); if ($this->mongo) { $this->buildDocumentsByManager($this->mongo); } if (!empty($this->documents)) { $response = $this->searchProvider->addDocuments($this->documents); ...
[ "public", "function", "populateIndex", "(", ")", "{", "$", "this", "->", "buildDocumentsByManager", "(", "$", "this", "->", "doctrine", ")", ";", "if", "(", "$", "this", "->", "mongo", ")", "{", "$", "this", "->", "buildDocumentsByManager", "(", "$", "th...
Populate the indexes
[ "Populate", "the", "indexes" ]
86c656c131295fe1f3f7694fd4da1e5e454076b9
https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Configuration/SearchableEntityConfiguration.php#L99-L111
18,827
antonmedv/silicone
src/Silicone/Controller.php
Controller.render
protected function render($view, array $parameters = array(), Response $response = null) { return $this->app->render($view, $parameters, $response); }
php
protected function render($view, array $parameters = array(), Response $response = null) { return $this->app->render($view, $parameters, $response); }
[ "protected", "function", "render", "(", "$", "view", ",", "array", "$", "parameters", "=", "array", "(", ")", ",", "Response", "$", "response", "=", "null", ")", "{", "return", "$", "this", "->", "app", "->", "render", "(", "$", "view", ",", "$", "...
Render to response twig views. @param $view @param array $parameters @param Response $response @return Response
[ "Render", "to", "response", "twig", "views", "." ]
e4a67ed41f0f419984df642b303f2a491c9a3933
https://github.com/antonmedv/silicone/blob/e4a67ed41f0f419984df642b303f2a491c9a3933/src/Silicone/Controller.php#L40-L43
18,828
drupalwxt/pco_cities
modules/custom/pco_cities_ext/challenge_pages/src/EventSubscriber/ChallengePagesRedirectSubscriber.php
ChallengePagesRedirectSubscriber.redirectMyContentTypeNode
public function redirectMyContentTypeNode(GetResponseEvent $event) { $request = $event->getRequest(); $language = $this->languageManager->getCurrentLanguage()->getId(); if ($request->attributes->get('_route') !== 'entity.node.canonical') { return; } if ($request->attributes->get('node')->get...
php
public function redirectMyContentTypeNode(GetResponseEvent $event) { $request = $event->getRequest(); $language = $this->languageManager->getCurrentLanguage()->getId(); if ($request->attributes->get('_route') !== 'entity.node.canonical') { return; } if ($request->attributes->get('node')->get...
[ "public", "function", "redirectMyContentTypeNode", "(", "GetResponseEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "language", "=", "$", "this", "->", "languageManager", "->", "getCurrentLanguage", "(...
Redirect requests for challenge go to custom module controller route. @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
[ "Redirect", "requests", "for", "challenge", "go", "to", "custom", "module", "controller", "route", "." ]
589651ac4478ce629dd9ad9cf2e15ad1a9de368a
https://github.com/drupalwxt/pco_cities/blob/589651ac4478ce629dd9ad9cf2e15ad1a9de368a/modules/custom/pco_cities_ext/challenge_pages/src/EventSubscriber/ChallengePagesRedirectSubscriber.php#L50-L73
18,829
webforge-labs/psc-cms
lib/Psc/Net/HTTP/Request.php
Request.setBody
public function setBody($body) { if (is_array($body) || is_object($body)) $this->body = (object) $body; else $this->body = $body; return $this; }
php
public function setBody($body) { if (is_array($body) || is_object($body)) $this->body = (object) $body; else $this->body = $body; return $this; }
[ "public", "function", "setBody", "(", "$", "body", ")", "{", "if", "(", "is_array", "(", "$", "body", ")", "||", "is_object", "(", "$", "body", ")", ")", "$", "this", "->", "body", "=", "(", "object", ")", "$", "body", ";", "else", "$", "this", ...
Setzt den RequestBody wird intern als stdClass umgewandelt, wenn es object oder array ist
[ "Setzt", "den", "RequestBody" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Net/HTTP/Request.php#L266-L272
18,830
digitalkaoz/versioneye-php
src/Output/Me.php
Me.profile
public function profile(OutputInterface $output, array $response) { $this->printList($output, ['Fullname', 'Username', 'Email', 'Admin', 'Notifications'], ['fullname', 'username', 'email', 'admin', 'notifications'], $response, function ($key, $value) { ...
php
public function profile(OutputInterface $output, array $response) { $this->printList($output, ['Fullname', 'Username', 'Email', 'Admin', 'Notifications'], ['fullname', 'username', 'email', 'admin', 'notifications'], $response, function ($key, $value) { ...
[ "public", "function", "profile", "(", "OutputInterface", "$", "output", ",", "array", "$", "response", ")", "{", "$", "this", "->", "printList", "(", "$", "output", ",", "[", "'Fullname'", ",", "'Username'", ",", "'Email'", ",", "'Admin'", ",", "'Notificat...
output for the profile api. @param OutputInterface $output @param array $response
[ "output", "for", "the", "profile", "api", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Output/Me.php#L20-L34
18,831
digitalkaoz/versioneye-php
src/Output/Me.php
Me.comments
public function comments(OutputInterface $output, array $response) { $table = $this->createTable($output); $table->setHeaders(['Name', 'Language', 'Version', 'Type', 'Date', 'Comment']); foreach ($response['comments'] as $comment) { $table->addRow([$comment['product']['name'], ...
php
public function comments(OutputInterface $output, array $response) { $table = $this->createTable($output); $table->setHeaders(['Name', 'Language', 'Version', 'Type', 'Date', 'Comment']); foreach ($response['comments'] as $comment) { $table->addRow([$comment['product']['name'], ...
[ "public", "function", "comments", "(", "OutputInterface", "$", "output", ",", "array", "$", "response", ")", "{", "$", "table", "=", "$", "this", "->", "createTable", "(", "$", "output", ")", ";", "$", "table", "->", "setHeaders", "(", "[", "'Name'", "...
output for the comments api. @param OutputInterface $output @param array $response
[ "output", "for", "the", "comments", "api", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Output/Me.php#L64-L75
18,832
webforge-labs/psc-cms
lib/Psc/HTML/Page.php
Page.setMeta
public function setMeta($name, $content = NULL, $httpEquiv = FALSE, $scheme = NULL) { $meta = HTML::Tag('meta'); $meta->setOption('selfClosing',TRUE); if ($content === NULL) { /* löschen */ $this->removeMeta($name); } else { /* im W3C steht "may be used in place" ... d.h. man kön...
php
public function setMeta($name, $content = NULL, $httpEquiv = FALSE, $scheme = NULL) { $meta = HTML::Tag('meta'); $meta->setOption('selfClosing',TRUE); if ($content === NULL) { /* löschen */ $this->removeMeta($name); } else { /* im W3C steht "may be used in place" ... d.h. man kön...
[ "public", "function", "setMeta", "(", "$", "name", ",", "$", "content", "=", "NULL", ",", "$", "httpEquiv", "=", "FALSE", ",", "$", "scheme", "=", "NULL", ")", "{", "$", "meta", "=", "HTML", "::", "Tag", "(", "'meta'", ")", ";", "$", "meta", "->"...
Setzt ein Meta Attribut wird <var>$content</var> leer gelassen oder auf NULL gesetzt, wird das Meta Attribut gelöscht @param string $name der Name des Meta Attributes @param string $content der Wert des Meta Attributes @return Tag<meta>
[ "Setzt", "ein", "Meta", "Attribut" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/HTML/Page.php#L146-L192
18,833
webforge-labs/psc-cms
lib/Psc/Form/StandardValidatorRule.php
StandardValidatorRule.validate
public function validate($data) { if (isset($this->callback)) { return $this->callback->call(array($data)); } throw new \Psc\Exception('empty rule!'); }
php
public function validate($data) { if (isset($this->callback)) { return $this->callback->call(array($data)); } throw new \Psc\Exception('empty rule!'); }
[ "public", "function", "validate", "(", "$", "data", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "callback", ")", ")", "{", "return", "$", "this", "->", "callback", "->", "call", "(", "array", "(", "$", "data", ")", ")", ";", "}", "throw...
Validiert die gespeicherte Rule Achtung! nicht bool zurückgeben, stattdessen irgendeine Exception schmeissen @return $data
[ "Validiert", "die", "gespeicherte", "Rule" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Form/StandardValidatorRule.php#L85-L91
18,834
Lansoweb/LosBase
src/LosBase/Controller/ORM/AbstractCrudController.php
AbstractCrudController.getForm
public function getForm($entityClass = null) { if (null === $entityClass) { $entityClass = $this->getEntityClass(); } $builder = new AnnotationBuilder(); $form = $builder->createForm($entityClass); $hasEntity = false; foreach ($form->getElements() as $el...
php
public function getForm($entityClass = null) { if (null === $entityClass) { $entityClass = $this->getEntityClass(); } $builder = new AnnotationBuilder(); $form = $builder->createForm($entityClass); $hasEntity = false; foreach ($form->getElements() as $el...
[ "public", "function", "getForm", "(", "$", "entityClass", "=", "null", ")", "{", "if", "(", "null", "===", "$", "entityClass", ")", "{", "$", "entityClass", "=", "$", "this", "->", "getEntityClass", "(", ")", ";", "}", "$", "builder", "=", "new", "An...
Retorna a form para o cadastro da entidade.
[ "Retorna", "a", "form", "para", "o", "cadastro", "da", "entidade", "." ]
90e18a53d29c1bd841c149dca43aa365eecc656d
https://github.com/Lansoweb/LosBase/blob/90e18a53d29c1bd841c149dca43aa365eecc656d/src/LosBase/Controller/ORM/AbstractCrudController.php#L136-L197
18,835
Sedona-Solutions/sedona-sbo
src/Sedona/SBORuntimeBundle/Datatable/Data/DatatableDataManager.php
DatatableDataManager.getQueryFrom
public function getQueryFrom(DatatableViewInterface $datatableView) { $twig = $datatableView->getTwig(); $type = $datatableView->getAjax()->getType(); $parameterBag = null; if ('GET' === strtoupper($type)) { $parameterBag = $this->request->query; } if (...
php
public function getQueryFrom(DatatableViewInterface $datatableView) { $twig = $datatableView->getTwig(); $type = $datatableView->getAjax()->getType(); $parameterBag = null; if ('GET' === strtoupper($type)) { $parameterBag = $this->request->query; } if (...
[ "public", "function", "getQueryFrom", "(", "DatatableViewInterface", "$", "datatableView", ")", "{", "$", "twig", "=", "$", "datatableView", "->", "getTwig", "(", ")", ";", "$", "type", "=", "$", "datatableView", "->", "getAjax", "(", ")", "->", "getType", ...
Get query. @param DatatableViewInterface $datatableView @return DatatableQuery
[ "Get", "query", "." ]
8548be4170d191cb1a3e263577aaaab49f04d5ce
https://github.com/Sedona-Solutions/sedona-sbo/blob/8548be4170d191cb1a3e263577aaaab49f04d5ce/src/Sedona/SBORuntimeBundle/Datatable/Data/DatatableDataManager.php#L109-L137
18,836
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseUserCustomerRelationQuery.php
BaseUserCustomerRelationQuery.create
public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof UserCustomerRelationQuery) { return $criteria; } $query = new UserCustomerRelationQuery(null, null, $modelAlias); if ($criteria instanceof Criteria) { $query->merge...
php
public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof UserCustomerRelationQuery) { return $criteria; } $query = new UserCustomerRelationQuery(null, null, $modelAlias); if ($criteria instanceof Criteria) { $query->merge...
[ "public", "static", "function", "create", "(", "$", "modelAlias", "=", "null", ",", "$", "criteria", "=", "null", ")", "{", "if", "(", "$", "criteria", "instanceof", "UserCustomerRelationQuery", ")", "{", "return", "$", "criteria", ";", "}", "$", "query", ...
Returns a new UserCustomerRelationQuery object. @param string $modelAlias The alias of a model in the query @param UserCustomerRelationQuery|Criteria $criteria Optional Criteria to build the query from @return UserCustomerRelationQuery
[ "Returns", "a", "new", "UserCustomerRelationQuery", "object", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseUserCustomerRelationQuery.php#L80-L92
18,837
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseUserCustomerRelationQuery.php
BaseUserCustomerRelationQuery.filterByUser
public function filterByUser($user, $comparison = null) { if ($user instanceof User) { return $this ->addUsingAlias(UserCustomerRelationPeer::USER_ID, $user->getId(), $comparison); } elseif ($user instanceof PropelObjectCollection) { if (null === $comparison) ...
php
public function filterByUser($user, $comparison = null) { if ($user instanceof User) { return $this ->addUsingAlias(UserCustomerRelationPeer::USER_ID, $user->getId(), $comparison); } elseif ($user instanceof PropelObjectCollection) { if (null === $comparison) ...
[ "public", "function", "filterByUser", "(", "$", "user", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "$", "user", "instanceof", "User", ")", "{", "return", "$", "this", "->", "addUsingAlias", "(", "UserCustomerRelationPeer", "::", "USER_ID", "...
Filter the query by a related User object @param User|PropelObjectCollection $user The related object(s) to use as filter @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return UserCustomerRelationQuery The current query, for fluid interface @thr...
[ "Filter", "the", "query", "by", "a", "related", "User", "object" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseUserCustomerRelationQuery.php#L384-L399
18,838
ClanCats/Core
src/bundles/UI/Alert.php
Alert.prepare
private static function prepare( $type, $message ) { // to avoid typos and other mistakes we // validate the alert type $type = strtolower( $type ); if ( !in_array( $type, static::$_types ) ) { throw new Exception( "UI\Alert - Unknown alert type '{$type}'!" ); } // We always need to return an array...
php
private static function prepare( $type, $message ) { // to avoid typos and other mistakes we // validate the alert type $type = strtolower( $type ); if ( !in_array( $type, static::$_types ) ) { throw new Exception( "UI\Alert - Unknown alert type '{$type}'!" ); } // We always need to return an array...
[ "private", "static", "function", "prepare", "(", "$", "type", ",", "$", "message", ")", "{", "// to avoid typos and other mistakes we ", "// validate the alert type", "$", "type", "=", "strtolower", "(", "$", "type", ")", ";", "if", "(", "!", "in_array", "(", ...
Validate the alert type and format the message @param string $type @param string|array $message @return array
[ "Validate", "the", "alert", "type", "and", "format", "the", "message" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/Alert.php#L53-L69
18,839
aedart/laravel-helpers
src/Traits/Filesystem/CloudStorageTrait.php
CloudStorageTrait.getCloudStorage
public function getCloudStorage(): ?Cloud { if (!$this->hasCloudStorage()) { $this->setCloudStorage($this->getDefaultCloudStorage()); } return $this->cloudStorage; }
php
public function getCloudStorage(): ?Cloud { if (!$this->hasCloudStorage()) { $this->setCloudStorage($this->getDefaultCloudStorage()); } return $this->cloudStorage; }
[ "public", "function", "getCloudStorage", "(", ")", ":", "?", "Cloud", "{", "if", "(", "!", "$", "this", "->", "hasCloudStorage", "(", ")", ")", "{", "$", "this", "->", "setCloudStorage", "(", "$", "this", "->", "getDefaultCloudStorage", "(", ")", ")", ...
Get cloud storage If no cloud storage has been set, this method will set and return a default cloud storage, if any such value is available @see getDefaultCloudStorage() @return Cloud|null cloud storage or null if none cloud storage has been set
[ "Get", "cloud", "storage" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Filesystem/CloudStorageTrait.php#L53-L59
18,840
aedart/laravel-helpers
src/Traits/Filesystem/CloudStorageTrait.php
CloudStorageTrait.getDefaultCloudStorage
public function getDefaultCloudStorage(): ?Cloud { // By default, the Storage Facade does not return the // any actual storage fisk, but rather an // instance of \Illuminate\Filesystem\FilesystemManager. // Therefore, we make sure only to obtain its // "disk", to make sure th...
php
public function getDefaultCloudStorage(): ?Cloud { // By default, the Storage Facade does not return the // any actual storage fisk, but rather an // instance of \Illuminate\Filesystem\FilesystemManager. // Therefore, we make sure only to obtain its // "disk", to make sure th...
[ "public", "function", "getDefaultCloudStorage", "(", ")", ":", "?", "Cloud", "{", "// By default, the Storage Facade does not return the", "// any actual storage fisk, but rather an", "// instance of \\Illuminate\\Filesystem\\FilesystemManager.", "// Therefore, we make sure only to obtain it...
Get a default cloud storage value, if any is available @return Cloud|null A default cloud storage value or Null if no default value is available
[ "Get", "a", "default", "cloud", "storage", "value", "if", "any", "is", "available" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Filesystem/CloudStorageTrait.php#L76-L89
18,841
onigoetz/imagecache
src/Transfer.php
Transfer.stream
public function stream() { if (ob_get_level()) { ob_end_clean(); } // Transfer file in 1024 byte chunks to save memory usage. if ($fd = fopen($this->path, 'rb')) { while (!feof($fd)) { echo fread($fd, 1024); } fclose($f...
php
public function stream() { if (ob_get_level()) { ob_end_clean(); } // Transfer file in 1024 byte chunks to save memory usage. if ($fd = fopen($this->path, 'rb')) { while (!feof($fd)) { echo fread($fd, 1024); } fclose($f...
[ "public", "function", "stream", "(", ")", "{", "if", "(", "ob_get_level", "(", ")", ")", "{", "ob_end_clean", "(", ")", ";", "}", "// Transfer file in 1024 byte chunks to save memory usage.", "if", "(", "$", "fd", "=", "fopen", "(", "$", "this", "->", "path"...
Transfer an image to the browser
[ "Transfer", "an", "image", "to", "the", "browser" ]
8e22c11def1733819183e8296bab3c8a4ffc1d9c
https://github.com/onigoetz/imagecache/blob/8e22c11def1733819183e8296bab3c8a4ffc1d9c/src/Transfer.php#L67-L80
18,842
onigoetz/imagecache
src/Transfer.php
Transfer.getCachingHeaders
protected function getCachingHeaders($fileinfo) { // Set default values: $last_modified = gmdate('D, d M Y H:i:s', $fileinfo[9]) . ' GMT'; $etag = md5($last_modified); // See if the client has provided the required HTTP headers: $if_modified_since = $this->server_value('HTTP...
php
protected function getCachingHeaders($fileinfo) { // Set default values: $last_modified = gmdate('D, d M Y H:i:s', $fileinfo[9]) . ' GMT'; $etag = md5($last_modified); // See if the client has provided the required HTTP headers: $if_modified_since = $this->server_value('HTTP...
[ "protected", "function", "getCachingHeaders", "(", "$", "fileinfo", ")", "{", "// Set default values:", "$", "last_modified", "=", "gmdate", "(", "'D, d M Y H:i:s'", ",", "$", "fileinfo", "[", "9", "]", ")", ".", "' GMT'", ";", "$", "etag", "=", "md5", "(", ...
Set file headers that handle "If-Modified-Since" correctly for the given fileinfo. @param array $fileinfo Array returned by stat().
[ "Set", "file", "headers", "that", "handle", "If", "-", "Modified", "-", "Since", "correctly", "for", "the", "given", "fileinfo", "." ]
8e22c11def1733819183e8296bab3c8a4ffc1d9c
https://github.com/onigoetz/imagecache/blob/8e22c11def1733819183e8296bab3c8a4ffc1d9c/src/Transfer.php#L88-L105
18,843
npbtrac/yii2-enpii-cms
libs/override/db/NpMigration.php
NpMigration.addCode
public function addCode($tableName, $columnName = 'code') { $this->addColumn('{{%' . $tableName . '}}', $columnName, $this->string(32)->comment('Code for this item, used identifying when needed. Another criteria to replace ID because ID is auto-increment')); $this->createIndex($tableName...
php
public function addCode($tableName, $columnName = 'code') { $this->addColumn('{{%' . $tableName . '}}', $columnName, $this->string(32)->comment('Code for this item, used identifying when needed. Another criteria to replace ID because ID is auto-increment')); $this->createIndex($tableName...
[ "public", "function", "addCode", "(", "$", "tableName", ",", "$", "columnName", "=", "'code'", ")", "{", "$", "this", "->", "addColumn", "(", "'{{%'", ".", "$", "tableName", ".", "'}}'", ",", "$", "columnName", ",", "$", "this", "->", "string", "(", ...
Add and put index to `code` column Use if identity an item alternatively to ID @param $tableName
[ "Add", "and", "put", "index", "to", "code", "column", "Use", "if", "identity", "an", "item", "alternatively", "to", "ID" ]
3495e697509a57a573983f552629ff9f707a63b9
https://github.com/npbtrac/yii2-enpii-cms/blob/3495e697509a57a573983f552629ff9f707a63b9/libs/override/db/NpMigration.php#L36-L41
18,844
npbtrac/yii2-enpii-cms
libs/override/db/NpMigration.php
NpMigration.addCreatorID
public function addCreatorID($tableName, $columnName = 'creator_id') { $this->addColumn('{{%' . $tableName . '}}', $columnName, $this->bigInteger()->comment('ID of user who created this item')); $this->createIndex($tableName . '_' . $columnName . '_idx', '{{%' . $tableName . '}}', $colum...
php
public function addCreatorID($tableName, $columnName = 'creator_id') { $this->addColumn('{{%' . $tableName . '}}', $columnName, $this->bigInteger()->comment('ID of user who created this item')); $this->createIndex($tableName . '_' . $columnName . '_idx', '{{%' . $tableName . '}}', $colum...
[ "public", "function", "addCreatorID", "(", "$", "tableName", ",", "$", "columnName", "=", "'creator_id'", ")", "{", "$", "this", "->", "addColumn", "(", "'{{%'", ".", "$", "tableName", ".", "'}}'", ",", "$", "columnName", ",", "$", "this", "->", "bigInte...
Add and put Index to creator_id column Store id of user who create this record @param $tableName
[ "Add", "and", "put", "Index", "to", "creator_id", "column", "Store", "id", "of", "user", "who", "create", "this", "record" ]
3495e697509a57a573983f552629ff9f707a63b9
https://github.com/npbtrac/yii2-enpii-cms/blob/3495e697509a57a573983f552629ff9f707a63b9/libs/override/db/NpMigration.php#L88-L93
18,845
webforge-labs/psc-cms
lib/Psc/UI/ComboBox2.php
ComboBox2.setAutoCompleteRequestMeta
public function setAutoCompleteRequestMeta(\Psc\CMS\AutoCompleteRequestMeta $autoCompleteRequestMeta) { $this->acRequestMeta = $autoCompleteRequestMeta; $this->avaibleItems = NULL; return $this; }
php
public function setAutoCompleteRequestMeta(\Psc\CMS\AutoCompleteRequestMeta $autoCompleteRequestMeta) { $this->acRequestMeta = $autoCompleteRequestMeta; $this->avaibleItems = NULL; return $this; }
[ "public", "function", "setAutoCompleteRequestMeta", "(", "\\", "Psc", "\\", "CMS", "\\", "AutoCompleteRequestMeta", "$", "autoCompleteRequestMeta", ")", "{", "$", "this", "->", "acRequestMeta", "=", "$", "autoCompleteRequestMeta", ";", "$", "this", "->", "avaibleIte...
Ist dies gesetzt wird avaibleItems ignoriert @param Psc\CMS\AutoCompleteRequestMeta $autoCompleteRequestMeta @chainable
[ "Ist", "dies", "gesetzt", "wird", "avaibleItems", "ignoriert" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/ComboBox2.php#L173-L177
18,846
webforge-labs/psc-cms
lib/Psc/UI/Form.php
Form.attachLabel
public static function attachLabel($element, $label, $type = self::LABEL_TOP) { Code::value($type, self::LABEL_TOP, self::LABEL_CHECKBOX); if ($label != NULL) { $element->templateContent->label = fHTML::label($label, $element) ->addClass('\Psc\label') ; if ($type == self::LABEL_T...
php
public static function attachLabel($element, $label, $type = self::LABEL_TOP) { Code::value($type, self::LABEL_TOP, self::LABEL_CHECKBOX); if ($label != NULL) { $element->templateContent->label = fHTML::label($label, $element) ->addClass('\Psc\label') ; if ($type == self::LABEL_T...
[ "public", "static", "function", "attachLabel", "(", "$", "element", ",", "$", "label", ",", "$", "type", "=", "self", "::", "LABEL_TOP", ")", "{", "Code", "::", "value", "(", "$", "type", ",", "self", "::", "LABEL_TOP", ",", "self", "::", "LABEL_CHECKB...
benutzt von dropBox2
[ "benutzt", "von", "dropBox2" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Form.php#L232-L251
18,847
Sedona-Solutions/sedona-sbo
src/Sedona/SBORuntimeBundle/ClassUtils.php
ClassUtils.hasTrait
public static function hasTrait($class, $traitName, $isRecursive = false) { if (is_string($class)) { $class = new \ReflectionClass($class); } if (in_array($traitName, $class->getTraitNames(), true)) { return true; } $parentClass = $class->getParentCl...
php
public static function hasTrait($class, $traitName, $isRecursive = false) { if (is_string($class)) { $class = new \ReflectionClass($class); } if (in_array($traitName, $class->getTraitNames(), true)) { return true; } $parentClass = $class->getParentCl...
[ "public", "static", "function", "hasTrait", "(", "$", "class", ",", "$", "traitName", ",", "$", "isRecursive", "=", "false", ")", "{", "if", "(", "is_string", "(", "$", "class", ")", ")", "{", "$", "class", "=", "new", "\\", "ReflectionClass", "(", "...
Return true if the given object use the given trait, FALSE if not. @param \ReflectionClass|string $class @param string $traitName @param bool $isRecursive @return bool
[ "Return", "true", "if", "the", "given", "object", "use", "the", "given", "trait", "FALSE", "if", "not", "." ]
8548be4170d191cb1a3e263577aaaab49f04d5ce
https://github.com/Sedona-Solutions/sedona-sbo/blob/8548be4170d191cb1a3e263577aaaab49f04d5ce/src/Sedona/SBORuntimeBundle/ClassUtils.php#L28-L45
18,848
xinix-technology/norm
src/Norm/Cursor.php
Cursor.sort
public function sort(array $sorts = array()) { if (func_num_args() === 0) { return $this->sorts; } $this->sorts = array(); foreach ($sorts as $key => $value) { if ($key[0] === '$') { $key[0] = '_'; } $this->sorts[$key...
php
public function sort(array $sorts = array()) { if (func_num_args() === 0) { return $this->sorts; } $this->sorts = array(); foreach ($sorts as $key => $value) { if ($key[0] === '$') { $key[0] = '_'; } $this->sorts[$key...
[ "public", "function", "sort", "(", "array", "$", "sorts", "=", "array", "(", ")", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "sorts", ";", "}", "$", "this", "->", "sorts", "=", "array", "(",...
When argument specified will set new sorts otherwise will return existing sorts @param array $sorts @return mixed When argument specified will return sorts otherwise return chainable object
[ "When", "argument", "specified", "will", "set", "new", "sorts", "otherwise", "will", "return", "existing", "sorts" ]
c357f7d3a75d05324dd84b8f6a968a094c53d603
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor.php#L167-L184
18,849
xinix-technology/norm
src/Norm/Cursor.php
Cursor.match
public function match($q) { if (is_null($q)) { return $this; } $orCriteria = array(); $schema = $this->collection->schema(); if (empty($schema)) { throw new \Exception('[Norm\Cursor] Cannot use match for schemaless collection'); } f...
php
public function match($q) { if (is_null($q)) { return $this; } $orCriteria = array(); $schema = $this->collection->schema(); if (empty($schema)) { throw new \Exception('[Norm\Cursor] Cannot use match for schemaless collection'); } f...
[ "public", "function", "match", "(", "$", "q", ")", "{", "if", "(", "is_null", "(", "$", "q", ")", ")", "{", "return", "$", "this", ";", "}", "$", "orCriteria", "=", "array", "(", ")", ";", "$", "schema", "=", "$", "this", "->", "collection", "-...
Set query to match on every field exists in schema. Beware this will override criteria @param string $q String to query @return \Norm\Cursor Chainable object
[ "Set", "query", "to", "match", "on", "every", "field", "exists", "in", "schema", ".", "Beware", "this", "will", "override", "criteria" ]
c357f7d3a75d05324dd84b8f6a968a094c53d603
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor.php#L193-L214
18,850
xinix-technology/norm
src/Norm/Cursor.php
Cursor.toArray
public function toArray($plain = false) { $result = array(); foreach ($this as $key => $value) { if ($plain) { $result[] = $value->toArray(); } else { $result[] = $this->connection->unmarshall($value); } } return $...
php
public function toArray($plain = false) { $result = array(); foreach ($this as $key => $value) { if ($plain) { $result[] = $value->toArray(); } else { $result[] = $this->connection->unmarshall($value); } } return $...
[ "public", "function", "toArray", "(", "$", "plain", "=", "false", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "plain", ")", "{", "$", "result...
Extract data into array of models. @param boolean $plain When true will return array of associative array. @return array
[ "Extract", "data", "into", "array", "of", "models", "." ]
c357f7d3a75d05324dd84b8f6a968a094c53d603
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor.php#L223-L236
18,851
dafiti/datajet-client
src/Datajet/Resource/Product.php
Product.import
public function import(array $data) { $response = $this->client->post("{$this->uriImport}product/", [ 'json' => $data, 'query' => [ 'key' => $this->config['data']['key'], ], ]); $response = json_decode($response->getBody(), true); ...
php
public function import(array $data) { $response = $this->client->post("{$this->uriImport}product/", [ 'json' => $data, 'query' => [ 'key' => $this->config['data']['key'], ], ]); $response = json_decode($response->getBody(), true); ...
[ "public", "function", "import", "(", "array", "$", "data", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "post", "(", "\"{$this->uriImport}product/\"", ",", "[", "'json'", "=>", "$", "data", ",", "'query'", "=>", "[", "'key'", "=>", ...
Atomic product import. @param array $data A list of product to import @throws \GuzzleHttp\Exception\GuzzleException @return bool
[ "Atomic", "product", "import", "." ]
c8555362521690b95451d2006d891b30facd8a46
https://github.com/dafiti/datajet-client/blob/c8555362521690b95451d2006d891b30facd8a46/src/Datajet/Resource/Product.php#L65-L81
18,852
dafiti/datajet-client
src/Datajet/Resource/Product.php
Product.search
public function search(array $data) { if (!isset($data['size'])) { $data['size'] = 10; } $response = $this->client->post("{$this->uriSearch}search/", [ 'json' => $data, 'query' => [ 'key' => $this->config['search']['key'], ], ...
php
public function search(array $data) { if (!isset($data['size'])) { $data['size'] = 10; } $response = $this->client->post("{$this->uriSearch}search/", [ 'json' => $data, 'query' => [ 'key' => $this->config['search']['key'], ], ...
[ "public", "function", "search", "(", "array", "$", "data", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "'size'", "]", ")", ")", "{", "$", "data", "[", "'size'", "]", "=", "10", ";", "}", "$", "response", "=", "$", "this", "->", ...
Product Search. @param array $data Search parameters @throws \GuzzleHttp\Exception\GuzzleException @return array
[ "Product", "Search", "." ]
c8555362521690b95451d2006d891b30facd8a46
https://github.com/dafiti/datajet-client/blob/c8555362521690b95451d2006d891b30facd8a46/src/Datajet/Resource/Product.php#L92-L108
18,853
dafiti/datajet-client
src/Datajet/Resource/Product.php
Product.delete
public function delete($id) { $response = false; if (empty($id)) { throw new \InvalidArgumentException('ID Product cannot be empty'); } try { $apiResponse = $this->client->delete("{$this->uriImport}product/{$id}", [ 'query' => [ ...
php
public function delete($id) { $response = false; if (empty($id)) { throw new \InvalidArgumentException('ID Product cannot be empty'); } try { $apiResponse = $this->client->delete("{$this->uriImport}product/{$id}", [ 'query' => [ ...
[ "public", "function", "delete", "(", "$", "id", ")", "{", "$", "response", "=", "false", ";", "if", "(", "empty", "(", "$", "id", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'ID Product cannot be empty'", ")", ";", "}", "try", ...
Product Delete. @param string $id @return bool
[ "Product", "Delete", "." ]
c8555362521690b95451d2006d891b30facd8a46
https://github.com/dafiti/datajet-client/blob/c8555362521690b95451d2006d891b30facd8a46/src/Datajet/Resource/Product.php#L117-L141
18,854
webforge-labs/psc-cms
lib/Psc/System/Deploy/ConfigureApacheTask.php
ConfigureApacheTask.addAlias
public function addAlias($location, $path) { $this->setVar('aliases', $this->getVar('aliases'). sprintf("\n Alias %s %s", $location , $this->replaceHelpers($path)) ); return $this; }
php
public function addAlias($location, $path) { $this->setVar('aliases', $this->getVar('aliases'). sprintf("\n Alias %s %s", $location , $this->replaceHelpers($path)) ); return $this; }
[ "public", "function", "addAlias", "(", "$", "location", ",", "$", "path", ")", "{", "$", "this", "->", "setVar", "(", "'aliases'", ",", "$", "this", "->", "getVar", "(", "'aliases'", ")", ".", "sprintf", "(", "\"\\n Alias %s %s\"", ",", "$", "location",...
Adds an Location alias $this->addAlias('/images /var/local/banane');
[ "Adds", "an", "Location", "alias" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/System/Deploy/ConfigureApacheTask.php#L157-L163
18,855
claroline/ForumBundle
Repository/ForumRepository.php
ForumRepository.findSubjects
public function findSubjects(Category $category, $getQuery = false) { $dql = " SELECT s.id as id, COUNT(m_count.id) AS count_messages, MAX(m.creationDate) AS last_message_created, s.id as subjectId, s.title as title, s.isSticked as isSt...
php
public function findSubjects(Category $category, $getQuery = false) { $dql = " SELECT s.id as id, COUNT(m_count.id) AS count_messages, MAX(m.creationDate) AS last_message_created, s.id as subjectId, s.title as title, s.isSticked as isSt...
[ "public", "function", "findSubjects", "(", "Category", "$", "category", ",", "$", "getQuery", "=", "false", ")", "{", "$", "dql", "=", "\"\n SELECT s.id as id,\n COUNT(m_count.id) AS count_messages,\n MAX(m.creationDate) AS last_message_created,\n ...
Deep magic goes here. Gets a subject with some of its last messages datas. @param ResourceInstance $forum @return type
[ "Deep", "magic", "goes", "here", ".", "Gets", "a", "subject", "with", "some", "of", "its", "last", "messages", "datas", "." ]
bd85dfd870cacee541ea94fec8e59744bf90eaf4
https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Repository/ForumRepository.php#L30-L76
18,856
forxer/tao
src/Tao/Utilities.php
Utilities.getMemoryUsageData
public function getMemoryUsageData() { if (null === $this->memoryUsageData) { $memoryUsage = memory_get_usage(); $unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; $this->memoryUsageData = [ round($memoryUsage/pow(1024, ($i=floor(log($memoryUsage, 1024))) ), 2), $unit[$i] ]; } return $this->me...
php
public function getMemoryUsageData() { if (null === $this->memoryUsageData) { $memoryUsage = memory_get_usage(); $unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; $this->memoryUsageData = [ round($memoryUsage/pow(1024, ($i=floor(log($memoryUsage, 1024))) ), 2), $unit[$i] ]; } return $this->me...
[ "public", "function", "getMemoryUsageData", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "memoryUsageData", ")", "{", "$", "memoryUsage", "=", "memory_get_usage", "(", ")", ";", "$", "unit", "=", "[", "'B'", ",", "'KB'", ",", "'MB'", ","...
Return the application memory usage data. @return array
[ "Return", "the", "application", "memory", "usage", "data", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Utilities.php#L68-L83
18,857
forxer/tao
src/Tao/Utilities.php
Utilities.setConfiguration
public function setConfiguration(array $config = []) { # Merge config with default values $config = $config + $this->getDefaultConfiguration(); # If debug mode, store config data for debug purpose if (!empty($config['debug'])) { $this->config = $config; } return $config; }
php
public function setConfiguration(array $config = []) { # Merge config with default values $config = $config + $this->getDefaultConfiguration(); # If debug mode, store config data for debug purpose if (!empty($config['debug'])) { $this->config = $config; } return $config; }
[ "public", "function", "setConfiguration", "(", "array", "$", "config", "=", "[", "]", ")", "{", "# Merge config with default values", "$", "config", "=", "$", "config", "+", "$", "this", "->", "getDefaultConfiguration", "(", ")", ";", "# If debug mode, store confi...
Return application configuration values. @param array $config @return array
[ "Return", "application", "configuration", "values", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Utilities.php#L156-L167
18,858
ixocreate/application
src/Http/ErrorHandling/Response/NotFoundHandler.php
NotFoundHandler.generateNotFoundPlainResponse
private function generateNotFoundPlainResponse(ServerRequestInterface $request) : ResponseInterface { $response = ($this->responseFactory)()->withStatus(StatusCodeInterface::STATUS_NOT_FOUND); $response->getBody() ->write(\sprintf( "Encountered a 404 Error, %s doesn't exi...
php
private function generateNotFoundPlainResponse(ServerRequestInterface $request) : ResponseInterface { $response = ($this->responseFactory)()->withStatus(StatusCodeInterface::STATUS_NOT_FOUND); $response->getBody() ->write(\sprintf( "Encountered a 404 Error, %s doesn't exi...
[ "private", "function", "generateNotFoundPlainResponse", "(", "ServerRequestInterface", "$", "request", ")", ":", "ResponseInterface", "{", "$", "response", "=", "(", "$", "this", "->", "responseFactory", ")", "(", ")", "->", "withStatus", "(", "StatusCodeInterface",...
Generates a plain text response indicating the request method and URI. @param ServerRequestInterface $request @return ResponseInterface
[ "Generates", "a", "plain", "text", "response", "indicating", "the", "request", "method", "and", "URI", "." ]
6b0ef355ecf96af63d0dd5b901b4c9a5a69daf05
https://github.com/ixocreate/application/blob/6b0ef355ecf96af63d0dd5b901b4c9a5a69daf05/src/Http/ErrorHandling/Response/NotFoundHandler.php#L73-L83
18,859
ixocreate/application
src/Http/ErrorHandling/Response/NotFoundHandler.php
NotFoundHandler.generateTemplateResponse
private function generateTemplateResponse( Renderer $renderer, ServerRequestInterface $request ) : ResponseInterface { $response = ($this->responseFactory)()->withStatus(StatusCodeInterface::STATUS_NOT_FOUND); $response->getBody()->write( $renderer->render($this->template...
php
private function generateTemplateResponse( Renderer $renderer, ServerRequestInterface $request ) : ResponseInterface { $response = ($this->responseFactory)()->withStatus(StatusCodeInterface::STATUS_NOT_FOUND); $response->getBody()->write( $renderer->render($this->template...
[ "private", "function", "generateTemplateResponse", "(", "Renderer", "$", "renderer", ",", "ServerRequestInterface", "$", "request", ")", ":", "ResponseInterface", "{", "$", "response", "=", "(", "$", "this", "->", "responseFactory", ")", "(", ")", "->", "withSta...
Generates a response using a template. Template will receive the current request via the "request" variable. @param Renderer $renderer @param ServerRequestInterface $request @return ResponseInterface
[ "Generates", "a", "response", "using", "a", "template", "." ]
6b0ef355ecf96af63d0dd5b901b4c9a5a69daf05
https://github.com/ixocreate/application/blob/6b0ef355ecf96af63d0dd5b901b4c9a5a69daf05/src/Http/ErrorHandling/Response/NotFoundHandler.php#L93-L103
18,860
ClanCats/Core
src/console/orbit.php
orbit.action_uninstall
public function action_uninstall( $params ) { $path = $params[0]; if ( empty( $path ) ) { CCCli::line( 'no ship path given.', 'red' ); return; } /* * direct install if starting with / */ if ( substr( $path, 0, 1 ) == '/' ) { // fix path if ( substr( $path, -1 ) != '/' ) { $pat...
php
public function action_uninstall( $params ) { $path = $params[0]; if ( empty( $path ) ) { CCCli::line( 'no ship path given.', 'red' ); return; } /* * direct install if starting with / */ if ( substr( $path, 0, 1 ) == '/' ) { // fix path if ( substr( $path, -1 ) != '/' ) { $pat...
[ "public", "function", "action_uninstall", "(", "$", "params", ")", "{", "$", "path", "=", "$", "params", "[", "0", "]", ";", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "CCCli", "::", "line", "(", "'no ship path given.'", ",", "'red'", ")", ...
uninstall an orbit module @param array $params
[ "uninstall", "an", "orbit", "module" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/console/orbit.php#L123-L182
18,861
left-right/center
src/CenterServiceProvider.php
CenterServiceProvider.config
private function config() { $this->loadViewsFrom(__DIR__ . '/views', 'center'); $this->loadTranslationsFrom(__DIR__ . '/translations', 'center'); $this->publishes([ __DIR__ . '/../assets/public' => public_path('vendor/center'), ], 'public'); $this->publishes([ __DIR__ . '/config' => config_path('center'...
php
private function config() { $this->loadViewsFrom(__DIR__ . '/views', 'center'); $this->loadTranslationsFrom(__DIR__ . '/translations', 'center'); $this->publishes([ __DIR__ . '/../assets/public' => public_path('vendor/center'), ], 'public'); $this->publishes([ __DIR__ . '/config' => config_path('center'...
[ "private", "function", "config", "(", ")", "{", "$", "this", "->", "loadViewsFrom", "(", "__DIR__", ".", "'/views'", ",", "'center'", ")", ";", "$", "this", "->", "loadTranslationsFrom", "(", "__DIR__", ".", "'/translations'", ",", "'center'", ")", ";", "$...
set up publishes paths and define config locations
[ "set", "up", "publishes", "paths", "and", "define", "config", "locations" ]
47c225538475ca3e87fa49f31a323b6e6bd4eff2
https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/CenterServiceProvider.php#L49-L64
18,862
wikimedia/CLDRPluralRuleParser
src/Range.php
Range.isNumberIn
function isNumberIn( $number, $integerConstraint = true ) { foreach ( $this->parts as $part ) { if ( is_array( $part ) ) { if ( ( !$integerConstraint || floor( $number ) === (float)$number ) && $number >= $part[0] && $number <= $part[1] ) { return true; } } else { if ( $number == $part...
php
function isNumberIn( $number, $integerConstraint = true ) { foreach ( $this->parts as $part ) { if ( is_array( $part ) ) { if ( ( !$integerConstraint || floor( $number ) === (float)$number ) && $number >= $part[0] && $number <= $part[1] ) { return true; } } else { if ( $number == $part...
[ "function", "isNumberIn", "(", "$", "number", ",", "$", "integerConstraint", "=", "true", ")", "{", "foreach", "(", "$", "this", "->", "parts", "as", "$", "part", ")", "{", "if", "(", "is_array", "(", "$", "part", ")", ")", "{", "if", "(", "(", "...
Determine if the given number is inside the range. @param int $number The number to check @param bool $integerConstraint If true, also asserts the number is an integer; otherwise, number simply has to be inside the range. @return bool True if the number is inside the range; otherwise, false.
[ "Determine", "if", "the", "given", "number", "is", "inside", "the", "range", "." ]
4c5d71a3fd62a75871da8562310ca2258647ee6d
https://github.com/wikimedia/CLDRPluralRuleParser/blob/4c5d71a3fd62a75871da8562310ca2258647ee6d/src/Range.php#L44-L60
18,863
wikimedia/CLDRPluralRuleParser
src/Range.php
Range.add
function add( $other ) { if ( $other instanceof self ) { $this->parts = array_merge( $this->parts, $other->parts ); } else { $this->parts[] = $other; } }
php
function add( $other ) { if ( $other instanceof self ) { $this->parts = array_merge( $this->parts, $other->parts ); } else { $this->parts[] = $other; } }
[ "function", "add", "(", "$", "other", ")", "{", "if", "(", "$", "other", "instanceof", "self", ")", "{", "$", "this", "->", "parts", "=", "array_merge", "(", "$", "this", "->", "parts", ",", "$", "other", "->", "parts", ")", ";", "}", "else", "{"...
Add another part to this range. @param Range|int $other The part to add, either a range object itself or a single number.
[ "Add", "another", "part", "to", "this", "range", "." ]
4c5d71a3fd62a75871da8562310ca2258647ee6d
https://github.com/wikimedia/CLDRPluralRuleParser/blob/4c5d71a3fd62a75871da8562310ca2258647ee6d/src/Range.php#L79-L85
18,864
php-rise/rise
src/Translation.php
Translation.translate
public function translate($key, $defaultValue = '', $locale = null) { if ($locale === null) { $locale = $this->getlocale(); } if (isset($this->translations[$locale][$key])) { return $this->translations[$locale][$key]; } return $defaultValue; }
php
public function translate($key, $defaultValue = '', $locale = null) { if ($locale === null) { $locale = $this->getlocale(); } if (isset($this->translations[$locale][$key])) { return $this->translations[$locale][$key]; } return $defaultValue; }
[ "public", "function", "translate", "(", "$", "key", ",", "$", "defaultValue", "=", "''", ",", "$", "locale", "=", "null", ")", "{", "if", "(", "$", "locale", "===", "null", ")", "{", "$", "locale", "=", "$", "this", "->", "getlocale", "(", ")", "...
Translate an identifier to specific value. @param string $key Translation identifier. @param string $defaultValue Optional. @param string $locale Optional. Specify the locale of translation result. @return string
[ "Translate", "an", "identifier", "to", "specific", "value", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Translation.php#L101-L111
18,865
php-rise/rise
src/Translation.php
Translation.readConfig
protected function readConfig() { $file = $this->path->getConfigPath() . '/translation.php'; if (file_exists($file)) { $config = require($file); if (isset($config['translations'])) { $this->translations = $config['translations']; } if (isset($config['defaultLocale'])) { $this->setDefaultLocale($...
php
protected function readConfig() { $file = $this->path->getConfigPath() . '/translation.php'; if (file_exists($file)) { $config = require($file); if (isset($config['translations'])) { $this->translations = $config['translations']; } if (isset($config['defaultLocale'])) { $this->setDefaultLocale($...
[ "protected", "function", "readConfig", "(", ")", "{", "$", "file", "=", "$", "this", "->", "path", "->", "getConfigPath", "(", ")", ".", "'/translation.php'", ";", "if", "(", "file_exists", "(", "$", "file", ")", ")", "{", "$", "config", "=", "require"...
Read configurations. @return self
[ "Read", "configurations", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Translation.php#L118-L130
18,866
aedart/laravel-helpers
src/Traits/Cookie/QueueingCookieTrait.php
QueueingCookieTrait.getQueueingCookie
public function getQueueingCookie(): ?QueueingFactory { if (!$this->hasQueueingCookie()) { $this->setQueueingCookie($this->getDefaultQueueingCookie()); } return $this->queueingCookie; }
php
public function getQueueingCookie(): ?QueueingFactory { if (!$this->hasQueueingCookie()) { $this->setQueueingCookie($this->getDefaultQueueingCookie()); } return $this->queueingCookie; }
[ "public", "function", "getQueueingCookie", "(", ")", ":", "?", "QueueingFactory", "{", "if", "(", "!", "$", "this", "->", "hasQueueingCookie", "(", ")", ")", "{", "$", "this", "->", "setQueueingCookie", "(", "$", "this", "->", "getDefaultQueueingCookie", "("...
Get queueing cookie If no queueing cookie has been set, this method will set and return a default queueing cookie, if any such value is available @see getDefaultQueueingCookie() @return QueueingFactory|null queueing cookie or null if none queueing cookie has been set
[ "Get", "queueing", "cookie" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Cookie/QueueingCookieTrait.php#L53-L59
18,867
digitalkaoz/versioneye-php
src/Http/HttpPlugHttpAdapterClient.php
HttpPlugHttpAdapterClient.buildRequestError
private function buildRequestError(PlugException $e) { $data = $e->getResponse() ? json_decode($e->getResponse()->getBody(), true) : ['error' => $e->getMessage()]; $message = isset($data['error']) ? $data['error'] : 'Server Error'; $status = $e->getResponse() ? $e->getResponse()->getStat...
php
private function buildRequestError(PlugException $e) { $data = $e->getResponse() ? json_decode($e->getResponse()->getBody(), true) : ['error' => $e->getMessage()]; $message = isset($data['error']) ? $data['error'] : 'Server Error'; $status = $e->getResponse() ? $e->getResponse()->getStat...
[ "private", "function", "buildRequestError", "(", "PlugException", "$", "e", ")", "{", "$", "data", "=", "$", "e", "->", "getResponse", "(", ")", "?", "json_decode", "(", "$", "e", "->", "getResponse", "(", ")", "->", "getBody", "(", ")", ",", "true", ...
builds the error exception. @param PlugException $e @return CommunicationException
[ "builds", "the", "error", "exception", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Http/HttpPlugHttpAdapterClient.php#L95-L102
18,868
webforge-labs/psc-cms
lib/Psc/TPL/ContentStream/ContentStreamEntity.php
ContentStreamEntity.findNextEntry
public function findNextEntry(Entry $entry) { $list = $this->findAfter($entry, 1); if (count($list) === 1) { return current($list); } return NULL; }
php
public function findNextEntry(Entry $entry) { $list = $this->findAfter($entry, 1); if (count($list) === 1) { return current($list); } return NULL; }
[ "public", "function", "findNextEntry", "(", "Entry", "$", "entry", ")", "{", "$", "list", "=", "$", "this", "->", "findAfter", "(", "$", "entry", ",", "1", ")", ";", "if", "(", "count", "(", "$", "list", ")", "===", "1", ")", "{", "return", "curr...
Returns the element right after the given element if no element is after this NULL will be returned the $entry has to be in this contentstream otherwise an exception will thrown @return Entry|NULL
[ "Returns", "the", "element", "right", "after", "the", "given", "element" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/TPL/ContentStream/ContentStreamEntity.php#L162-L170
18,869
php-rise/rise
src/Container.php
Container.has
public function has($class) { if (isset($this->singletons[$class])) { return true; } if (isset($this->aliases[$class])) { $class = $this->aliases[$class]; } try { $this->getReflectionClass($class); } catch (Exception $e) { return false; } return true; }
php
public function has($class) { if (isset($this->singletons[$class])) { return true; } if (isset($this->aliases[$class])) { $class = $this->aliases[$class]; } try { $this->getReflectionClass($class); } catch (Exception $e) { return false; } return true; }
[ "public", "function", "has", "(", "$", "class", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "singletons", "[", "$", "class", "]", ")", ")", "{", "return", "true", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "aliases", "[", "...
Check if the class is resolvable. @param string $class @return bool
[ "Check", "if", "the", "class", "is", "resolvable", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Container.php#L134-L150
18,870
php-rise/rise
src/Container.php
Container.configMethod
public function configMethod($class, $method, $rules) { foreach ($rules as $param => $rule) { if (ctype_upper($param[0]) && (!is_string($rule) && !($rule instanceof Closure)) ) { throw new InvalidRuleException("Type $param only allowed string or Closure as an extra rule."); } } $this->rules[$clas...
php
public function configMethod($class, $method, $rules) { foreach ($rules as $param => $rule) { if (ctype_upper($param[0]) && (!is_string($rule) && !($rule instanceof Closure)) ) { throw new InvalidRuleException("Type $param only allowed string or Closure as an extra rule."); } } $this->rules[$clas...
[ "public", "function", "configMethod", "(", "$", "class", ",", "$", "method", ",", "$", "rules", ")", "{", "foreach", "(", "$", "rules", "as", "$", "param", "=>", "$", "rule", ")", "{", "if", "(", "ctype_upper", "(", "$", "param", "[", "0", "]", "...
Configure method parameters of a class. @param string $class Class name. @param string $method Method name. @param array $rules @return self
[ "Configure", "method", "parameters", "of", "a", "class", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Container.php#L172-L182
18,871
php-rise/rise
src/Container.php
Container.getMethod
public function getMethod($class, $method, $extraMappings = []) { if (isset($this->aliases[$class])) { $class = $this->aliases[$class]; } return [ $this->getSingleton($class), $this->resolveArgs($class, $method, " when resolving method $class::$method", $extraMappings) ]; }
php
public function getMethod($class, $method, $extraMappings = []) { if (isset($this->aliases[$class])) { $class = $this->aliases[$class]; } return [ $this->getSingleton($class), $this->resolveArgs($class, $method, " when resolving method $class::$method", $extraMappings) ]; }
[ "public", "function", "getMethod", "(", "$", "class", ",", "$", "method", ",", "$", "extraMappings", "=", "[", "]", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "aliases", "[", "$", "class", "]", ")", ")", "{", "$", "class", "=", "$", ...
Resolve a method for method injection. @param string $class @param string $method @param array $extraMappings Optional @return array [$instance, (string)$method, (array)$args]
[ "Resolve", "a", "method", "for", "method", "injection", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Container.php#L220-L229
18,872
php-rise/rise
src/Container.php
Container.getNewInstance
public function getNewInstance($class) { if (isset($this->aliases[$class])) { $class = $this->aliases[$class]; } $args = $this->resolveArgs($class, '__construct', " when constructing $class"); if ($args) { $instance = new $class(...$args); } else { $instance = new $class; } return $instance; }
php
public function getNewInstance($class) { if (isset($this->aliases[$class])) { $class = $this->aliases[$class]; } $args = $this->resolveArgs($class, '__construct', " when constructing $class"); if ($args) { $instance = new $class(...$args); } else { $instance = new $class; } return $instance; }
[ "public", "function", "getNewInstance", "(", "$", "class", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "aliases", "[", "$", "class", "]", ")", ")", "{", "$", "class", "=", "$", "this", "->", "aliases", "[", "$", "class", "]", ";", "}", ...
Construct an new instance of a class with its dependencies. @param string $class @return object
[ "Construct", "an", "new", "instance", "of", "a", "class", "with", "its", "dependencies", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Container.php#L237-L250
18,873
php-rise/rise
src/Container.php
Container.getSingleton
protected function getSingleton($class) { if (isset($this->singletons[$class])) { return $this->singletons[$class]; } $instance = $this->getNewInstance($class); $this->singletons[$class] = $instance; return $instance; }
php
protected function getSingleton($class) { if (isset($this->singletons[$class])) { return $this->singletons[$class]; } $instance = $this->getNewInstance($class); $this->singletons[$class] = $instance; return $instance; }
[ "protected", "function", "getSingleton", "(", "$", "class", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "singletons", "[", "$", "class", "]", ")", ")", "{", "return", "$", "this", "->", "singletons", "[", "$", "class", "]", ";", "}", "$",...
Get singleton of a class. @param string $class @param string $method Optional @return object|array
[ "Get", "singleton", "of", "a", "class", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Container.php#L259-L267
18,874
php-rise/rise
src/Container.php
Container.getFactory
protected function getFactory($class) { if (isset($this->factories[$class])) { return $this->factories[$class]; } $factory = new $class($this); $this->factories[$class] = $factory; return $factory; }
php
protected function getFactory($class) { if (isset($this->factories[$class])) { return $this->factories[$class]; } $factory = new $class($this); $this->factories[$class] = $factory; return $factory; }
[ "protected", "function", "getFactory", "(", "$", "class", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "factories", "[", "$", "class", "]", ")", ")", "{", "return", "$", "this", "->", "factories", "[", "$", "class", "]", ";", "}", "$", "...
Construct a factory instance and inject this container to the instance. @param string $class @return object
[ "Construct", "a", "factory", "instance", "and", "inject", "this", "container", "to", "the", "instance", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Container.php#L275-L283
18,875
php-rise/rise
src/Container.php
Container.getReflectionClass
protected function getReflectionClass($className) { if (isset($this->reflectionClasses[$className])) { return $this->reflectionClasses[$className]; } try { $reflectionClass = new ReflectionClass($className); } catch (ReflectionException $e) { throw new NotFoundException("Class $className is not found"...
php
protected function getReflectionClass($className) { if (isset($this->reflectionClasses[$className])) { return $this->reflectionClasses[$className]; } try { $reflectionClass = new ReflectionClass($className); } catch (ReflectionException $e) { throw new NotFoundException("Class $className is not found"...
[ "protected", "function", "getReflectionClass", "(", "$", "className", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "reflectionClasses", "[", "$", "className", "]", ")", ")", "{", "return", "$", "this", "->", "reflectionClasses", "[", "$", "classNa...
Create and cache a ReflectionClass. @param string $className @return \ReflectionClass
[ "Create", "and", "cache", "a", "ReflectionClass", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Container.php#L291-L309
18,876
php-rise/rise
src/Container.php
Container.getReflectionMethod
protected function getReflectionMethod($className, $methodName = '__construct') { if (isset($this->reflectionMethods[$className]) && array_key_exists($methodName, $this->reflectionMethods[$className]) ) { return $this->reflectionMethods[$className][$methodName]; } try { $reflectionClass = $this->getRe...
php
protected function getReflectionMethod($className, $methodName = '__construct') { if (isset($this->reflectionMethods[$className]) && array_key_exists($methodName, $this->reflectionMethods[$className]) ) { return $this->reflectionMethods[$className][$methodName]; } try { $reflectionClass = $this->getRe...
[ "protected", "function", "getReflectionMethod", "(", "$", "className", ",", "$", "methodName", "=", "'__construct'", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "reflectionMethods", "[", "$", "className", "]", ")", "&&", "array_key_exists", "(", "$...
Create and cache a ReflectionMethod. @param string $className @param string $methodName @return \ReflectionMethod
[ "Create", "and", "cache", "a", "ReflectionMethod", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Container.php#L318-L338
18,877
php-rise/rise
src/Container.php
Container.resolveArgs
protected function resolveArgs($className, $methodName, $errorMessageSuffix = '', $extraMappings = []) { $reflectionMethod = $this->getReflectionMethod($className, $methodName); if (is_null($reflectionMethod) && $methodName === '__construct') { return []; } $extraMappings = (array)$extraMappings; if (is...
php
protected function resolveArgs($className, $methodName, $errorMessageSuffix = '', $extraMappings = []) { $reflectionMethod = $this->getReflectionMethod($className, $methodName); if (is_null($reflectionMethod) && $methodName === '__construct') { return []; } $extraMappings = (array)$extraMappings; if (is...
[ "protected", "function", "resolveArgs", "(", "$", "className", ",", "$", "methodName", ",", "$", "errorMessageSuffix", "=", "''", ",", "$", "extraMappings", "=", "[", "]", ")", "{", "$", "reflectionMethod", "=", "$", "this", "->", "getReflectionMethod", "(",...
Resolve parameters of ReflectionMethod. @param string $className @param string $methodName @param string $errorMessageSuffix Optional @param array $extraMappings Optional @return array
[ "Resolve", "parameters", "of", "ReflectionMethod", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Container.php#L348-L400
18,878
kevintweber/phpunit-markup-validators
src/Kevintweber/PhpunitMarkupValidators/Connector/HTML5ValidatorNuConnector.php
HTML5ValidatorNuConnector.setInput
public function setInput($value) { if (stripos($value, 'html>') === false) { $this->input = '<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Title</title></head><body>'. $value.'</body></html>'; } else { $this->input = $value; } }
php
public function setInput($value) { if (stripos($value, 'html>') === false) { $this->input = '<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Title</title></head><body>'. $value.'</body></html>'; } else { $this->input = $value; } }
[ "public", "function", "setInput", "(", "$", "value", ")", "{", "if", "(", "stripos", "(", "$", "value", ",", "'html>'", ")", "===", "false", ")", "{", "$", "this", "->", "input", "=", "'<!DOCTYPE html><html><head><meta charset=\"utf-8\" /><title>Title</title></hea...
Ensure that HTML fragments are submitted as complete webpages. @param string $value The HTML markup, either a fragment or a complete webpage.
[ "Ensure", "that", "HTML", "fragments", "are", "submitted", "as", "complete", "webpages", "." ]
bee48f48c7c1c9e811d1a4bedeca8f413d049cb3
https://github.com/kevintweber/phpunit-markup-validators/blob/bee48f48c7c1c9e811d1a4bedeca8f413d049cb3/src/Kevintweber/PhpunitMarkupValidators/Connector/HTML5ValidatorNuConnector.php#L74-L82
18,879
nicklaw5/larapi
src/ResponseTrait.php
ResponseTrait.setStatusMessage
public function setStatusMessage($message) { $message = (string) trim($message); if ($message === '') { $this->statusMessage = $this->getStatusMessage(); } else { $this->statusMessage = $message; } return $this; }
php
public function setStatusMessage($message) { $message = (string) trim($message); if ($message === '') { $this->statusMessage = $this->getStatusMessage(); } else { $this->statusMessage = $message; } return $this; }
[ "public", "function", "setStatusMessage", "(", "$", "message", ")", "{", "$", "message", "=", "(", "string", ")", "trim", "(", "$", "message", ")", ";", "if", "(", "$", "message", "===", "''", ")", "{", "$", "this", "->", "statusMessage", "=", "$", ...
Sets the HTTP response message @param string $message @return self
[ "Sets", "the", "HTTP", "response", "message" ]
fb3493118bb9c6ce01567230c09e8402ac148d0e
https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/ResponseTrait.php#L95-L106
18,880
nicklaw5/larapi
src/ResponseTrait.php
ResponseTrait.setErrorMessage
public function setErrorMessage($message) { switch (gettype($message)) { case 'string': $this->errorMessage = trim($message); break; case 'array': $this->errorMessage = empty($message) ? '' : $message; break; ...
php
public function setErrorMessage($message) { switch (gettype($message)) { case 'string': $this->errorMessage = trim($message); break; case 'array': $this->errorMessage = empty($message) ? '' : $message; break; ...
[ "public", "function", "setErrorMessage", "(", "$", "message", ")", "{", "switch", "(", "gettype", "(", "$", "message", ")", ")", "{", "case", "'string'", ":", "$", "this", "->", "errorMessage", "=", "trim", "(", "$", "message", ")", ";", "break", ";", ...
Sets the error message @param string|array $message @return self
[ "Sets", "the", "error", "message" ]
fb3493118bb9c6ce01567230c09e8402ac148d0e
https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/ResponseTrait.php#L124-L139
18,881
nicklaw5/larapi
src/ResponseTrait.php
ResponseTrait.setResponseHeaders
protected function setResponseHeaders(array $headers) { // reset headers $this->headers = []; // set response status header $this->headers[] = 'HTTP/1.1 ' . $this->getStatusCode() . ' ' . $this->getStatusText(); // set content type header $this->headers['Content-Typ...
php
protected function setResponseHeaders(array $headers) { // reset headers $this->headers = []; // set response status header $this->headers[] = 'HTTP/1.1 ' . $this->getStatusCode() . ' ' . $this->getStatusText(); // set content type header $this->headers['Content-Typ...
[ "protected", "function", "setResponseHeaders", "(", "array", "$", "headers", ")", "{", "// reset headers", "$", "this", "->", "headers", "=", "[", "]", ";", "// set response status header", "$", "this", "->", "headers", "[", "]", "=", "'HTTP/1.1 '", ".", "$", ...
Sets the response headers @param array $headers @return void
[ "Sets", "the", "response", "headers" ]
fb3493118bb9c6ce01567230c09e8402ac148d0e
https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/ResponseTrait.php#L182-L197
18,882
nicklaw5/larapi
src/ResponseTrait.php
ResponseTrait.getSuccessResponse
protected function getSuccessResponse($data, $statusText, $headers = []) { return $this->setStatusText($this->statusTexts[$statusText]) ->setStatusCode($statusText) ->setStatusMessage(self::SUCCESS_TEXT) ->respondWithSuccessMessage($data, $headers)...
php
protected function getSuccessResponse($data, $statusText, $headers = []) { return $this->setStatusText($this->statusTexts[$statusText]) ->setStatusCode($statusText) ->setStatusMessage(self::SUCCESS_TEXT) ->respondWithSuccessMessage($data, $headers)...
[ "protected", "function", "getSuccessResponse", "(", "$", "data", ",", "$", "statusText", ",", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "setStatusText", "(", "$", "this", "->", "statusTexts", "[", "$", "statusText", "]", ")", ...
Gets the success response @param array $data @param string $statusText @param array $headers @return json
[ "Gets", "the", "success", "response" ]
fb3493118bb9c6ce01567230c09e8402ac148d0e
https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/ResponseTrait.php#L207-L213
18,883
nicklaw5/larapi
src/ResponseTrait.php
ResponseTrait.getErrorResponse
protected function getErrorResponse($msg, $errorCode, $statusText, $headers = []) { return $this->setStatusText($this->statusTexts[$statusText]) ->setStatusCode($statusText) ->setStatusMessage(self::ERROR_TEXT) ->setErrorCode($errorCode) ...
php
protected function getErrorResponse($msg, $errorCode, $statusText, $headers = []) { return $this->setStatusText($this->statusTexts[$statusText]) ->setStatusCode($statusText) ->setStatusMessage(self::ERROR_TEXT) ->setErrorCode($errorCode) ...
[ "protected", "function", "getErrorResponse", "(", "$", "msg", ",", "$", "errorCode", ",", "$", "statusText", ",", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "setStatusText", "(", "$", "this", "->", "statusTexts", "[", "$", "s...
Gets the error response @param string $msg @param int $errorCode @param string $statusText @param array $headers @return json
[ "Gets", "the", "error", "response" ]
fb3493118bb9c6ce01567230c09e8402ac148d0e
https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/ResponseTrait.php#L224-L232
18,884
nicklaw5/larapi
src/ResponseTrait.php
ResponseTrait.respond
protected function respond($data, $headers = []) { $this->setResponseHeaders($headers); return response()->json($data, $this->getStatusCode(), $this->getResponseHeaders()); }
php
protected function respond($data, $headers = []) { $this->setResponseHeaders($headers); return response()->json($data, $this->getStatusCode(), $this->getResponseHeaders()); }
[ "protected", "function", "respond", "(", "$", "data", ",", "$", "headers", "=", "[", "]", ")", "{", "$", "this", "->", "setResponseHeaders", "(", "$", "headers", ")", ";", "return", "response", "(", ")", "->", "json", "(", "$", "data", ",", "$", "t...
Returns JSON Encoded HTTP Reponse @param array $data @param array $headers @return json
[ "Returns", "JSON", "Encoded", "HTTP", "Reponse" ]
fb3493118bb9c6ce01567230c09e8402ac148d0e
https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/ResponseTrait.php#L285-L290
18,885
laraning/surveyor
src/Traits/AppliesScopes.php
AppliesScopes.bootAppliesScopes
public static function bootAppliesScopes() { if (SurveyorProvider::isActive()) { $repository = SurveyorProvider::retrieve(); foreach ($repository['scopes'] as $model => $scopes) { foreach ($scopes as $scope) { if (get_called_class() == $model) { ...
php
public static function bootAppliesScopes() { if (SurveyorProvider::isActive()) { $repository = SurveyorProvider::retrieve(); foreach ($repository['scopes'] as $model => $scopes) { foreach ($scopes as $scope) { if (get_called_class() == $model) { ...
[ "public", "static", "function", "bootAppliesScopes", "(", ")", "{", "if", "(", "SurveyorProvider", "::", "isActive", "(", ")", ")", "{", "$", "repository", "=", "SurveyorProvider", "::", "retrieve", "(", ")", ";", "foreach", "(", "$", "repository", "[", "'...
Apply model global scopes given the current logged user profiles. @return void
[ "Apply", "model", "global", "scopes", "given", "the", "current", "logged", "user", "profiles", "." ]
d845b74d20f9a4a307991019502c1b14b1730e86
https://github.com/laraning/surveyor/blob/d845b74d20f9a4a307991019502c1b14b1730e86/src/Traits/AppliesScopes.php#L16-L33
18,886
2amigos/yiifoundation
widgets/base/Widget.php
Widget.registerAssets
public function registerAssets() { // make sure core hasn't been registered previously $dirs = array('css', 'js'); foreach ($this->assets as $key => $files) { if (in_array($key, $dirs)) { $files = is_array($files) ? $files : array($files); foreach...
php
public function registerAssets() { // make sure core hasn't been registered previously $dirs = array('css', 'js'); foreach ($this->assets as $key => $files) { if (in_array($key, $dirs)) { $files = is_array($files) ? $files : array($files); foreach...
[ "public", "function", "registerAssets", "(", ")", "{", "// make sure core hasn't been registered previously", "$", "dirs", "=", "array", "(", "'css'", ",", "'js'", ")", ";", "foreach", "(", "$", "this", "->", "assets", "as", "$", "key", "=>", "$", "files", "...
Registers the assets. Makes sure the assets pre-existed on the published folder prior registration.
[ "Registers", "the", "assets", ".", "Makes", "sure", "the", "assets", "pre", "-", "existed", "on", "the", "published", "folder", "prior", "registration", "." ]
49bed0d3ca1a9bac9299000e48a2661bdc8f9a29
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/base/Widget.php#L86-L107
18,887
2amigos/yiifoundation
widgets/base/Widget.php
Widget.display
public static function display($config = array()) { ob_start(); ob_implicit_flush(false); /** @var Widget $widget */ $config['class'] = get_called_class(); $widget = \Yii::createComponent($config); $widget->init(); $widget->run(); return ob_ge...
php
public static function display($config = array()) { ob_start(); ob_implicit_flush(false); /** @var Widget $widget */ $config['class'] = get_called_class(); $widget = \Yii::createComponent($config); $widget->init(); $widget->run(); return ob_ge...
[ "public", "static", "function", "display", "(", "$", "config", "=", "array", "(", ")", ")", "{", "ob_start", "(", ")", ";", "ob_implicit_flush", "(", "false", ")", ";", "/** @var Widget $widget */", "$", "config", "[", "'class'", "]", "=", "get_called_class"...
Ported from Yii2 widget's function. Creates a widget instance and runs it. We cannot use 'widget' name as it conflicts with CBaseController component. The widget rendering result is returned by this method. @param array $config name-value pairs that will be used to initialize the object properties @return string the r...
[ "Ported", "from", "Yii2", "widget", "s", "function", ".", "Creates", "a", "widget", "instance", "and", "runs", "it", ".", "We", "cannot", "use", "widget", "name", "as", "it", "conflicts", "with", "CBaseController", "component", "." ]
49bed0d3ca1a9bac9299000e48a2661bdc8f9a29
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/base/Widget.php#L117-L127
18,888
uthando-cms/uthando-dompdf
src/UthandoDomPdf/Mvc/Service/ViewPdfStrategyFactory.php
ViewPdfStrategyFactory.createService
public function createService(ServiceLocatorInterface $serviceLocator) { $pdfRenderer = $serviceLocator->get(PdfRenderer::class); $pdfStrategy = new PdfStrategy($pdfRenderer); return $pdfStrategy; }
php
public function createService(ServiceLocatorInterface $serviceLocator) { $pdfRenderer = $serviceLocator->get(PdfRenderer::class); $pdfStrategy = new PdfStrategy($pdfRenderer); return $pdfStrategy; }
[ "public", "function", "createService", "(", "ServiceLocatorInterface", "$", "serviceLocator", ")", "{", "$", "pdfRenderer", "=", "$", "serviceLocator", "->", "get", "(", "PdfRenderer", "::", "class", ")", ";", "$", "pdfStrategy", "=", "new", "PdfStrategy", "(", ...
Create and return the PDF view strategy Retrieves the ViewPdfRenderer service from the service locator, and injects it into the constructor for the PDF strategy. @param ServiceLocatorInterface $serviceLocator @return PdfStrategy
[ "Create", "and", "return", "the", "PDF", "view", "strategy" ]
60a750058c2db9ed167476192b20c7f544c32007
https://github.com/uthando-cms/uthando-dompdf/blob/60a750058c2db9ed167476192b20c7f544c32007/src/UthandoDomPdf/Mvc/Service/ViewPdfStrategyFactory.php#L34-L40
18,889
timiki/rpc-common
src/JsonResponse.php
JsonResponse.getArrayResponse
public function getArrayResponse() { $json = []; $json['jsonrpc'] = '2.0'; if ($this->errorCode) { $json['error'] = []; $json['error']['code'] = $this->errorCode; $json['error']['message'] = $this->errorMessage; if (!empty($this->errorData))...
php
public function getArrayResponse() { $json = []; $json['jsonrpc'] = '2.0'; if ($this->errorCode) { $json['error'] = []; $json['error']['code'] = $this->errorCode; $json['error']['message'] = $this->errorMessage; if (!empty($this->errorData))...
[ "public", "function", "getArrayResponse", "(", ")", "{", "$", "json", "=", "[", "]", ";", "$", "json", "[", "'jsonrpc'", "]", "=", "'2.0'", ";", "if", "(", "$", "this", "->", "errorCode", ")", "{", "$", "json", "[", "'error'", "]", "=", "[", "]",...
Return array response. @return array
[ "Return", "array", "response", "." ]
a20e8bc92b16aa3686c4405bf5182123a5cfc750
https://github.com/timiki/rpc-common/blob/a20e8bc92b16aa3686c4405bf5182123a5cfc750/src/JsonResponse.php#L229-L251
18,890
titon/db
src/Titon/Db/Driver/Schema.php
Schema.addColumn
public function addColumn($column, $options) { if (is_string($options)) { $options = ['type' => $options]; } $options = $options + [ 'field' => $column, 'type' => '', 'length' => '', 'default' => '', 'comment' => '', ...
php
public function addColumn($column, $options) { if (is_string($options)) { $options = ['type' => $options]; } $options = $options + [ 'field' => $column, 'type' => '', 'length' => '', 'default' => '', 'comment' => '', ...
[ "public", "function", "addColumn", "(", "$", "column", ",", "$", "options", ")", "{", "if", "(", "is_string", "(", "$", "options", ")", ")", "{", "$", "options", "=", "[", "'type'", "=>", "$", "options", "]", ";", "}", "$", "options", "=", "$", "...
Add a column to the table schema. @param string $column @param array $options { @type string $type The column data type (one of Titon\Db\Driver\Type) @type int $length The column data length @type mixed $default The default value @type string $comment The comment @type string $charset The character s...
[ "Add", "a", "column", "to", "the", "table", "schema", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Schema.php#L101-L147
18,891
titon/db
src/Titon/Db/Driver/Schema.php
Schema.addColumns
public function addColumns(array $columns) { foreach ($columns as $column => $options) { $this->addColumn($column, $options); } return $this; }
php
public function addColumns(array $columns) { foreach ($columns as $column => $options) { $this->addColumn($column, $options); } return $this; }
[ "public", "function", "addColumns", "(", "array", "$", "columns", ")", "{", "foreach", "(", "$", "columns", "as", "$", "column", "=>", "$", "options", ")", "{", "$", "this", "->", "addColumn", "(", "$", "column", ",", "$", "options", ")", ";", "}", ...
Add multiple columns. Index is the column name, the value is the array of options. @param array $columns @return $this
[ "Add", "multiple", "columns", ".", "Index", "is", "the", "column", "name", "the", "value", "is", "the", "array", "of", "options", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Schema.php#L155-L161
18,892
titon/db
src/Titon/Db/Driver/Schema.php
Schema.addForeign
public function addForeign($column, $options = []) { if (is_string($options)) { $options = ['references' => $options]; } if (empty($options['references'])) { throw new InvalidArgumentException(sprintf('Foreign key for %s must reference an external table', $column)); ...
php
public function addForeign($column, $options = []) { if (is_string($options)) { $options = ['references' => $options]; } if (empty($options['references'])) { throw new InvalidArgumentException(sprintf('Foreign key for %s must reference an external table', $column)); ...
[ "public", "function", "addForeign", "(", "$", "column", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "is_string", "(", "$", "options", ")", ")", "{", "$", "options", "=", "[", "'references'", "=>", "$", "options", "]", ";", "}", "if", ...
Add a foreign key for a column. Multiple foreign keys can exist so group by column. @param string $column @param string|array $options { @type string $references A table and field that the foreign key references, should be in a "user.id" format @type string $onUpdate Action to use for ON UPDATE clauses @type s...
[ "Add", "a", "foreign", "key", "for", "a", "column", ".", "Multiple", "foreign", "keys", "can", "exist", "so", "group", "by", "column", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Schema.php#L176-L189
18,893
titon/db
src/Titon/Db/Driver/Schema.php
Schema.addPrimary
public function addPrimary($column, $options = false) { $symbol = is_string($options) ? $options : ''; if (empty($this->_primaryKey)) { $this->_primaryKey = [ 'constraint' => $symbol, 'columns' => [$column] ]; } else { $this->_...
php
public function addPrimary($column, $options = false) { $symbol = is_string($options) ? $options : ''; if (empty($this->_primaryKey)) { $this->_primaryKey = [ 'constraint' => $symbol, 'columns' => [$column] ]; } else { $this->_...
[ "public", "function", "addPrimary", "(", "$", "column", ",", "$", "options", "=", "false", ")", "{", "$", "symbol", "=", "is_string", "(", "$", "options", ")", "?", "$", "options", ":", "''", ";", "if", "(", "empty", "(", "$", "this", "->", "_prima...
Add a primary key for a column. Only one primary key can exist. However, multiple columns can exist in a primary key. @param string $column @param string|bool $options Provide a name to reference the constraint by @return $this
[ "Add", "a", "primary", "key", "for", "a", "column", ".", "Only", "one", "primary", "key", "can", "exist", ".", "However", "multiple", "columns", "can", "exist", "in", "a", "primary", "key", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Schema.php#L241-L254
18,894
titon/db
src/Titon/Db/Driver/Schema.php
Schema.addUnique
public function addUnique($column, $options = []) { $symbol = ''; $index = $column; if (is_array($options)) { if (isset($options['constraint'])) { $symbol = $options['constraint']; } if (isset($options['index'])) { $index = $o...
php
public function addUnique($column, $options = []) { $symbol = ''; $index = $column; if (is_array($options)) { if (isset($options['constraint'])) { $symbol = $options['constraint']; } if (isset($options['index'])) { $index = $o...
[ "public", "function", "addUnique", "(", "$", "column", ",", "$", "options", "=", "[", "]", ")", "{", "$", "symbol", "=", "''", ";", "$", "index", "=", "$", "column", ";", "if", "(", "is_array", "(", "$", "options", ")", ")", "{", "if", "(", "is...
Add a unique key for a column. Multiple unique keys can exist, so group by index. @param string $column @param string|array $options { @type string $constraint Provide a name to reference the constraint by @type string $index Custom name for the index key, defaults to the column name } @return $this
[ "Add", "a", "unique", "key", "for", "a", "column", ".", "Multiple", "unique", "keys", "can", "exist", "so", "group", "by", "index", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Schema.php#L267-L292
18,895
titon/db
src/Titon/Db/Driver/Schema.php
Schema.getColumn
public function getColumn($name) { if ($this->hasColumn($name)) { return $this->_columns[$name]; } throw new MissingColumnException(sprintf('Repository column %s does not exist', $name)); }
php
public function getColumn($name) { if ($this->hasColumn($name)) { return $this->_columns[$name]; } throw new MissingColumnException(sprintf('Repository column %s does not exist', $name)); }
[ "public", "function", "getColumn", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "hasColumn", "(", "$", "name", ")", ")", "{", "return", "$", "this", "->", "_columns", "[", "$", "name", "]", ";", "}", "throw", "new", "MissingColumnExcepti...
Return column options by name. @param string $name @return array @throws \Titon\Db\Exception\MissingColumnException
[ "Return", "column", "options", "by", "name", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Schema.php#L301-L307
18,896
forxer/tao
src/Tao/Application.php
Application.getModel
public function getModel($sModel) { $namespacedClass = $this['database.models_namespace'] . '\\' . $sModel; if (!isset(static::$models[$sModel])) { static::$models[$sModel] = new $namespacedClass($this); } return static::$models[$sModel]; }
php
public function getModel($sModel) { $namespacedClass = $this['database.models_namespace'] . '\\' . $sModel; if (!isset(static::$models[$sModel])) { static::$models[$sModel] = new $namespacedClass($this); } return static::$models[$sModel]; }
[ "public", "function", "getModel", "(", "$", "sModel", ")", "{", "$", "namespacedClass", "=", "$", "this", "[", "'database.models_namespace'", "]", ".", "'\\\\'", ".", "$", "sModel", ";", "if", "(", "!", "isset", "(", "static", "::", "$", "models", "[", ...
Return the instance of specified model. @param string $sModel @return \Tao\Database\Model
[ "Return", "the", "instance", "of", "specified", "model", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Application.php#L173-L182
18,897
hpkns/laravel-front-matter
src/Hpkns/FrontMatter/Parser.php
Parser.parse
public function parse($fm, array $default = []) { $pieces = []; $parsed = []; $regexp = '/^-{3}(?:\n|\r)(.+?)-{3}(.*)$/ms'; if(preg_match($regexp, $fm, $pieces) && $yaml = $pieces[1]) { $parsed = $this->yaml->parse($yaml, true); if(is_array($parsed))...
php
public function parse($fm, array $default = []) { $pieces = []; $parsed = []; $regexp = '/^-{3}(?:\n|\r)(.+?)-{3}(.*)$/ms'; if(preg_match($regexp, $fm, $pieces) && $yaml = $pieces[1]) { $parsed = $this->yaml->parse($yaml, true); if(is_array($parsed))...
[ "public", "function", "parse", "(", "$", "fm", ",", "array", "$", "default", "=", "[", "]", ")", "{", "$", "pieces", "=", "[", "]", ";", "$", "parsed", "=", "[", "]", ";", "$", "regexp", "=", "'/^-{3}(?:\\n|\\r)(.+?)-{3}(.*)$/ms'", ";", "if", "(", ...
Parse a front matter file and return an array with its content @param string $fm @param array $default @return array
[ "Parse", "a", "front", "matter", "file", "and", "return", "an", "array", "with", "its", "content" ]
3bcfb442f2d5b38cefdbf79a9841770e4d3a060f
https://github.com/hpkns/laravel-front-matter/blob/3bcfb442f2d5b38cefdbf79a9841770e4d3a060f/src/Hpkns/FrontMatter/Parser.php#L31-L49
18,898
hpkns/laravel-front-matter
src/Hpkns/FrontMatter/Parser.php
Parser.fillDefault
protected function fillDefault(array $parsed, array $default = []) { foreach($default as $key => $value) { if( ! isset($parsed[$key])) { $parsed[$key] = $value; } } return $parsed; }
php
protected function fillDefault(array $parsed, array $default = []) { foreach($default as $key => $value) { if( ! isset($parsed[$key])) { $parsed[$key] = $value; } } return $parsed; }
[ "protected", "function", "fillDefault", "(", "array", "$", "parsed", ",", "array", "$", "default", "=", "[", "]", ")", "{", "foreach", "(", "$", "default", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "isset", "(", "$", "parsed",...
Add default value to key that are not defined in the front matter @param array $parsed @param array $default @return array
[ "Add", "default", "value", "to", "key", "that", "are", "not", "defined", "in", "the", "front", "matter" ]
3bcfb442f2d5b38cefdbf79a9841770e4d3a060f
https://github.com/hpkns/laravel-front-matter/blob/3bcfb442f2d5b38cefdbf79a9841770e4d3a060f/src/Hpkns/FrontMatter/Parser.php#L58-L69
18,899
steeffeen/FancyManiaLinks
FML/Script/Features/EntrySubmit.php
EntrySubmit.setEntry
public function setEntry(Entry $entry) { $entry->setScriptEvents(true) ->checkId(); $this->entry = $entry; return $this; }
php
public function setEntry(Entry $entry) { $entry->setScriptEvents(true) ->checkId(); $this->entry = $entry; return $this; }
[ "public", "function", "setEntry", "(", "Entry", "$", "entry", ")", "{", "$", "entry", "->", "setScriptEvents", "(", "true", ")", "->", "checkId", "(", ")", ";", "$", "this", "->", "entry", "=", "$", "entry", ";", "return", "$", "this", ";", "}" ]
Set the Entry @api @param Entry $entry Entry Control @return static
[ "Set", "the", "Entry" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/EntrySubmit.php#L66-L72