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
partition
stringclasses
1 value
thephpleague/glide
src/Manipulators/Size.php
Size.limitImageSize
public function limitImageSize($width, $height) { if ($this->maxImageSize !== null) { $imageSize = $width * $height; if ($imageSize > $this->maxImageSize) { $width = $width / sqrt($imageSize / $this->maxImageSize); $height = $height / sqrt($imageSize ...
php
public function limitImageSize($width, $height) { if ($this->maxImageSize !== null) { $imageSize = $width * $height; if ($imageSize > $this->maxImageSize) { $width = $width / sqrt($imageSize / $this->maxImageSize); $height = $height / sqrt($imageSize ...
[ "public", "function", "limitImageSize", "(", "$", "width", ",", "$", "height", ")", "{", "if", "(", "$", "this", "->", "maxImageSize", "!==", "null", ")", "{", "$", "imageSize", "=", "$", "width", "*", "$", "height", ";", "if", "(", "$", "imageSize",...
Limit image size to maximum allowed image size. @param integer $width The image width. @param integer $height The image height. @return integer[] The limited width and height.
[ "Limit", "image", "size", "to", "maximum", "allowed", "image", "size", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L191-L206
train
thephpleague/glide
src/Manipulators/Size.php
Size.runResize
public function runResize(Image $image, $fit, $width, $height) { if ($fit === 'contain') { return $this->runContainResize($image, $width, $height); } if ($fit === 'fill') { return $this->runFillResize($image, $width, $height); } if ($fit === 'max') {...
php
public function runResize(Image $image, $fit, $width, $height) { if ($fit === 'contain') { return $this->runContainResize($image, $width, $height); } if ($fit === 'fill') { return $this->runFillResize($image, $width, $height); } if ($fit === 'max') {...
[ "public", "function", "runResize", "(", "Image", "$", "image", ",", "$", "fit", ",", "$", "width", ",", "$", "height", ")", "{", "if", "(", "$", "fit", "===", "'contain'", ")", "{", "return", "$", "this", "->", "runContainResize", "(", "$", "image", ...
Perform resize image manipulation. @param Image $image The source image. @param string $fit The fit. @param integer $width The width. @param integer $height The height. @return Image The manipulated image.
[ "Perform", "resize", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L216-L239
train
thephpleague/glide
src/Manipulators/Size.php
Size.runContainResize
public function runContainResize(Image $image, $width, $height) { return $image->resize($width, $height, function ($constraint) { $constraint->aspectRatio(); }); }
php
public function runContainResize(Image $image, $width, $height) { return $image->resize($width, $height, function ($constraint) { $constraint->aspectRatio(); }); }
[ "public", "function", "runContainResize", "(", "Image", "$", "image", ",", "$", "width", ",", "$", "height", ")", "{", "return", "$", "image", "->", "resize", "(", "$", "width", ",", "$", "height", ",", "function", "(", "$", "constraint", ")", "{", "...
Perform contain resize image manipulation. @param Image $image The source image. @param integer $width The width. @param integer $height The height. @return Image The manipulated image.
[ "Perform", "contain", "resize", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L248-L253
train
thephpleague/glide
src/Manipulators/Size.php
Size.runMaxResize
public function runMaxResize(Image $image, $width, $height) { return $image->resize($width, $height, function ($constraint) { $constraint->aspectRatio(); $constraint->upsize(); }); }
php
public function runMaxResize(Image $image, $width, $height) { return $image->resize($width, $height, function ($constraint) { $constraint->aspectRatio(); $constraint->upsize(); }); }
[ "public", "function", "runMaxResize", "(", "Image", "$", "image", ",", "$", "width", ",", "$", "height", ")", "{", "return", "$", "image", "->", "resize", "(", "$", "width", ",", "$", "height", ",", "function", "(", "$", "constraint", ")", "{", "$", ...
Perform max resize image manipulation. @param Image $image The source image. @param integer $width The width. @param integer $height The height. @return Image The manipulated image.
[ "Perform", "max", "resize", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L262-L268
train
thephpleague/glide
src/Manipulators/Size.php
Size.runFillResize
public function runFillResize($image, $width, $height) { $image = $this->runMaxResize($image, $width, $height); return $image->resizeCanvas($width, $height, 'center'); }
php
public function runFillResize($image, $width, $height) { $image = $this->runMaxResize($image, $width, $height); return $image->resizeCanvas($width, $height, 'center'); }
[ "public", "function", "runFillResize", "(", "$", "image", ",", "$", "width", ",", "$", "height", ")", "{", "$", "image", "=", "$", "this", "->", "runMaxResize", "(", "$", "image", ",", "$", "width", ",", "$", "height", ")", ";", "return", "$", "ima...
Perform fill resize image manipulation. @param Image $image The source image. @param integer $width The width. @param integer $height The height. @return Image The manipulated image.
[ "Perform", "fill", "resize", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L277-L282
train
thephpleague/glide
src/Manipulators/Size.php
Size.runCropResize
public function runCropResize(Image $image, $width, $height) { list($resize_width, $resize_height) = $this->resolveCropResizeDimensions($image, $width, $height); $zoom = $this->getCrop()[2]; $image->resize($resize_width * $zoom, $resize_height * $zoom, function ($constraint) { ...
php
public function runCropResize(Image $image, $width, $height) { list($resize_width, $resize_height) = $this->resolveCropResizeDimensions($image, $width, $height); $zoom = $this->getCrop()[2]; $image->resize($resize_width * $zoom, $resize_height * $zoom, function ($constraint) { ...
[ "public", "function", "runCropResize", "(", "Image", "$", "image", ",", "$", "width", ",", "$", "height", ")", "{", "list", "(", "$", "resize_width", ",", "$", "resize_height", ")", "=", "$", "this", "->", "resolveCropResizeDimensions", "(", "$", "image", ...
Perform crop resize image manipulation. @param Image $image The source image. @param integer $width The width. @param integer $height The height. @return Image The manipulated image.
[ "Perform", "crop", "resize", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L303-L316
train
thephpleague/glide
src/Manipulators/Size.php
Size.resolveCropResizeDimensions
public function resolveCropResizeDimensions(Image $image, $width, $height) { if ($height > $width * ($image->height() / $image->width())) { return [$height * ($image->width() / $image->height()), $height]; } return [$width, $width * ($image->height() / $image->width())]; }
php
public function resolveCropResizeDimensions(Image $image, $width, $height) { if ($height > $width * ($image->height() / $image->width())) { return [$height * ($image->width() / $image->height()), $height]; } return [$width, $width * ($image->height() / $image->width())]; }
[ "public", "function", "resolveCropResizeDimensions", "(", "Image", "$", "image", ",", "$", "width", ",", "$", "height", ")", "{", "if", "(", "$", "height", ">", "$", "width", "*", "(", "$", "image", "->", "height", "(", ")", "/", "$", "image", "->", ...
Resolve the crop resize dimensions. @param Image $image The source image. @param integer $width The width. @param integer $height The height. @return array The resize dimensions.
[ "Resolve", "the", "crop", "resize", "dimensions", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L325-L332
train
thephpleague/glide
src/Manipulators/Size.php
Size.resolveCropOffset
public function resolveCropOffset(Image $image, $width, $height) { list($offset_percentage_x, $offset_percentage_y) = $this->getCrop(); $offset_x = (int) (($image->width() * $offset_percentage_x / 100) - ($width / 2)); $offset_y = (int) (($image->height() * $offset_percentage_y / 100) - ($h...
php
public function resolveCropOffset(Image $image, $width, $height) { list($offset_percentage_x, $offset_percentage_y) = $this->getCrop(); $offset_x = (int) (($image->width() * $offset_percentage_x / 100) - ($width / 2)); $offset_y = (int) (($image->height() * $offset_percentage_y / 100) - ($h...
[ "public", "function", "resolveCropOffset", "(", "Image", "$", "image", ",", "$", "width", ",", "$", "height", ")", "{", "list", "(", "$", "offset_percentage_x", ",", "$", "offset_percentage_y", ")", "=", "$", "this", "->", "getCrop", "(", ")", ";", "$", ...
Resolve the crop offset. @param Image $image The source image. @param integer $width The width. @param integer $height The height. @return array The crop offset.
[ "Resolve", "the", "crop", "offset", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L341-L368
train
thephpleague/glide
src/Manipulators/Size.php
Size.getCrop
public function getCrop() { $cropMethods = [ 'crop-top-left' => [0, 0, 1.0], 'crop-top' => [50, 0, 1.0], 'crop-top-right' => [100, 0, 1.0], 'crop-left' => [0, 50, 1.0], 'crop-center' => [50, 50, 1.0], 'crop-right' => [100, 50, 1.0], ...
php
public function getCrop() { $cropMethods = [ 'crop-top-left' => [0, 0, 1.0], 'crop-top' => [50, 0, 1.0], 'crop-top-right' => [100, 0, 1.0], 'crop-left' => [0, 50, 1.0], 'crop-center' => [50, 50, 1.0], 'crop-right' => [100, 50, 1.0], ...
[ "public", "function", "getCrop", "(", ")", "{", "$", "cropMethods", "=", "[", "'crop-top-left'", "=>", "[", "0", ",", "0", ",", "1.0", "]", ",", "'crop-top'", "=>", "[", "50", ",", "0", ",", "1.0", "]", ",", "'crop-top-right'", "=>", "[", "100", ",...
Resolve crop with zoom. @return integer[] The resolved crop.
[ "Resolve", "crop", "with", "zoom", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Size.php#L374-L407
train
thephpleague/glide
src/Manipulators/Pixelate.php
Pixelate.run
public function run(Image $image) { $pixelate = $this->getPixelate(); if ($pixelate !== null) { $image->pixelate($pixelate); } return $image; }
php
public function run(Image $image) { $pixelate = $this->getPixelate(); if ($pixelate !== null) { $image->pixelate($pixelate); } return $image; }
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "pixelate", "=", "$", "this", "->", "getPixelate", "(", ")", ";", "if", "(", "$", "pixelate", "!==", "null", ")", "{", "$", "image", "->", "pixelate", "(", "$", "pixelate", ")"...
Perform pixelate image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "pixelate", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Pixelate.php#L17-L26
train
thephpleague/glide
src/Manipulators/Pixelate.php
Pixelate.getPixelate
public function getPixelate() { if (!is_numeric($this->pixel)) { return; } if ($this->pixel < 0 or $this->pixel > 1000) { return; } return (int) $this->pixel; }
php
public function getPixelate() { if (!is_numeric($this->pixel)) { return; } if ($this->pixel < 0 or $this->pixel > 1000) { return; } return (int) $this->pixel; }
[ "public", "function", "getPixelate", "(", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "this", "->", "pixel", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "pixel", "<", "0", "or", "$", "this", "->", "pixel", ">", "1000", ...
Resolve pixelate amount. @return string The resolved pixelate amount.
[ "Resolve", "pixelate", "amount", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Pixelate.php#L32-L43
train
thephpleague/glide
src/Manipulators/Helpers/Dimension.php
Dimension.get
public function get($value) { if (is_numeric($value) and $value > 0) { return (double) $value * $this->dpr; } if (preg_match('/^(\d{1,2}(?!\d)|100)(w|h)$/', $value, $matches)) { if ($matches[2] === 'h') { return (double) $this->image->height() * ($mat...
php
public function get($value) { if (is_numeric($value) and $value > 0) { return (double) $value * $this->dpr; } if (preg_match('/^(\d{1,2}(?!\d)|100)(w|h)$/', $value, $matches)) { if ($matches[2] === 'h') { return (double) $this->image->height() * ($mat...
[ "public", "function", "get", "(", "$", "value", ")", "{", "if", "(", "is_numeric", "(", "$", "value", ")", "and", "$", "value", ">", "0", ")", "{", "return", "(", "double", ")", "$", "value", "*", "$", "this", "->", "dpr", ";", "}", "if", "(", ...
Resolve the dimension. @param string $value The dimension value. @return double The resolved dimension.
[ "Resolve", "the", "dimension", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Helpers/Dimension.php#L37-L50
train
thephpleague/glide
src/Manipulators/Flip.php
Flip.run
public function run(Image $image) { if ($flip = $this->getFlip()) { if ($flip === 'both') { return $image->flip('h')->flip('v'); } return $image->flip($flip); } return $image; }
php
public function run(Image $image) { if ($flip = $this->getFlip()) { if ($flip === 'both') { return $image->flip('h')->flip('v'); } return $image->flip($flip); } return $image; }
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "if", "(", "$", "flip", "=", "$", "this", "->", "getFlip", "(", ")", ")", "{", "if", "(", "$", "flip", "===", "'both'", ")", "{", "return", "$", "image", "->", "flip", "(", "'h'...
Perform flip image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "flip", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Flip.php#L17-L28
train
thephpleague/glide
src/Manipulators/Brightness.php
Brightness.run
public function run(Image $image) { $brightness = $this->getBrightness(); if ($brightness !== null) { $image->brightness($brightness); } return $image; }
php
public function run(Image $image) { $brightness = $this->getBrightness(); if ($brightness !== null) { $image->brightness($brightness); } return $image; }
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "brightness", "=", "$", "this", "->", "getBrightness", "(", ")", ";", "if", "(", "$", "brightness", "!==", "null", ")", "{", "$", "image", "->", "brightness", "(", "$", "brightne...
Perform brightness image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "brightness", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Brightness.php#L17-L26
train
thephpleague/glide
src/Manipulators/Brightness.php
Brightness.getBrightness
public function getBrightness() { if (!preg_match('/^-*[0-9]+$/', $this->bri)) { return; } if ($this->bri < -100 or $this->bri > 100) { return; } return (int) $this->bri; }
php
public function getBrightness() { if (!preg_match('/^-*[0-9]+$/', $this->bri)) { return; } if ($this->bri < -100 or $this->bri > 100) { return; } return (int) $this->bri; }
[ "public", "function", "getBrightness", "(", ")", "{", "if", "(", "!", "preg_match", "(", "'/^-*[0-9]+$/'", ",", "$", "this", "->", "bri", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "bri", "<", "-", "100", "or", "$", "this", ...
Resolve brightness amount. @return string The resolved brightness amount.
[ "Resolve", "brightness", "amount", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Brightness.php#L32-L43
train
thephpleague/glide
src/Api/Api.php
Api.setManipulators
public function setManipulators(array $manipulators) { foreach ($manipulators as $manipulator) { if (!($manipulator instanceof ManipulatorInterface)) { throw new InvalidArgumentException('Not a valid manipulator.'); } } $this->manipulators = $manipula...
php
public function setManipulators(array $manipulators) { foreach ($manipulators as $manipulator) { if (!($manipulator instanceof ManipulatorInterface)) { throw new InvalidArgumentException('Not a valid manipulator.'); } } $this->manipulators = $manipula...
[ "public", "function", "setManipulators", "(", "array", "$", "manipulators", ")", "{", "foreach", "(", "$", "manipulators", "as", "$", "manipulator", ")", "{", "if", "(", "!", "(", "$", "manipulator", "instanceof", "ManipulatorInterface", ")", ")", "{", "thro...
Set the manipulators. @param array $manipulators Collection of manipulators.
[ "Set", "the", "manipulators", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Api/Api.php#L56-L65
train
thephpleague/glide
src/Api/Api.php
Api.run
public function run($source, array $params) { $image = $this->imageManager->make($source); foreach ($this->manipulators as $manipulator) { $manipulator->setParams($params); $image = $manipulator->run($image); } return $image->getEncoded(); }
php
public function run($source, array $params) { $image = $this->imageManager->make($source); foreach ($this->manipulators as $manipulator) { $manipulator->setParams($params); $image = $manipulator->run($image); } return $image->getEncoded(); }
[ "public", "function", "run", "(", "$", "source", ",", "array", "$", "params", ")", "{", "$", "image", "=", "$", "this", "->", "imageManager", "->", "make", "(", "$", "source", ")", ";", "foreach", "(", "$", "this", "->", "manipulators", "as", "$", ...
Perform image manipulations. @param string $source Source image binary data. @param array $params The manipulation params. @return string Manipulated image binary data.
[ "Perform", "image", "manipulations", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Api/Api.php#L82-L93
train
thephpleague/glide
src/Manipulators/Background.php
Background.run
public function run(Image $image) { if (is_null($this->bg)) { return $image; } $color = (new Color($this->bg))->formatted(); if ($color) { $new = $image->getDriver()->newImage($image->width(), $image->height(), $color); $new->mime = $image->mime;...
php
public function run(Image $image) { if (is_null($this->bg)) { return $image; } $color = (new Color($this->bg))->formatted(); if ($color) { $new = $image->getDriver()->newImage($image->width(), $image->height(), $color); $new->mime = $image->mime;...
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "bg", ")", ")", "{", "return", "$", "image", ";", "}", "$", "color", "=", "(", "new", "Color", "(", "$", "this", "->", "bg", ")", ...
Perform background image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "background", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Background.php#L18-L33
train
thephpleague/glide
src/Manipulators/Gamma.php
Gamma.run
public function run(Image $image) { $gamma = $this->getGamma(); if ($gamma) { $image->gamma($gamma); } return $image; }
php
public function run(Image $image) { $gamma = $this->getGamma(); if ($gamma) { $image->gamma($gamma); } return $image; }
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "$", "gamma", "=", "$", "this", "->", "getGamma", "(", ")", ";", "if", "(", "$", "gamma", ")", "{", "$", "image", "->", "gamma", "(", "$", "gamma", ")", ";", "}", "return", "$",...
Perform gamma image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "gamma", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Gamma.php#L17-L26
train
thephpleague/glide
src/Manipulators/Gamma.php
Gamma.getGamma
public function getGamma() { if (!preg_match('/^[0-9]\.*[0-9]*$/', $this->gam)) { return; } if ($this->gam < 0.1 or $this->gam > 9.99) { return; } return (double) $this->gam; }
php
public function getGamma() { if (!preg_match('/^[0-9]\.*[0-9]*$/', $this->gam)) { return; } if ($this->gam < 0.1 or $this->gam > 9.99) { return; } return (double) $this->gam; }
[ "public", "function", "getGamma", "(", ")", "{", "if", "(", "!", "preg_match", "(", "'/^[0-9]\\.*[0-9]*$/'", ",", "$", "this", "->", "gam", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "gam", "<", "0.1", "or", "$", "this", "->",...
Resolve gamma amount. @return string The resolved gamma amount.
[ "Resolve", "gamma", "amount", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Gamma.php#L32-L43
train
thephpleague/glide
src/Urls/UrlBuilderFactory.php
UrlBuilderFactory.create
public static function create($baseUrl, $signKey = null) { $httpSignature = null; if (!is_null($signKey)) { $httpSignature = SignatureFactory::create($signKey); } return new UrlBuilder($baseUrl, $httpSignature); }
php
public static function create($baseUrl, $signKey = null) { $httpSignature = null; if (!is_null($signKey)) { $httpSignature = SignatureFactory::create($signKey); } return new UrlBuilder($baseUrl, $httpSignature); }
[ "public", "static", "function", "create", "(", "$", "baseUrl", ",", "$", "signKey", "=", "null", ")", "{", "$", "httpSignature", "=", "null", ";", "if", "(", "!", "is_null", "(", "$", "signKey", ")", ")", "{", "$", "httpSignature", "=", "SignatureFacto...
Create UrlBuilder instance. @param string $baseUrl URL prefixed to generated URL. @param string|null $signKey Secret key used to secure URLs. @return UrlBuilder The UrlBuilder instance.
[ "Create", "UrlBuilder", "instance", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Urls/UrlBuilderFactory.php#L15-L24
train
thephpleague/glide
src/Manipulators/Watermark.php
Watermark.run
public function run(Image $image) { if ($watermark = $this->getImage($image)) { $markw = $this->getDimension($image, 'markw'); $markh = $this->getDimension($image, 'markh'); $markx = $this->getDimension($image, 'markx'); $marky = $this->getDimension($image, 'm...
php
public function run(Image $image) { if ($watermark = $this->getImage($image)) { $markw = $this->getDimension($image, 'markw'); $markh = $this->getDimension($image, 'markh'); $markx = $this->getDimension($image, 'markx'); $marky = $this->getDimension($image, 'm...
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "if", "(", "$", "watermark", "=", "$", "this", "->", "getImage", "(", "$", "image", ")", ")", "{", "$", "markw", "=", "$", "this", "->", "getDimension", "(", "$", "image", ",", "'...
Perform watermark image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "watermark", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Watermark.php#L87-L119
train
thephpleague/glide
src/Manipulators/Watermark.php
Watermark.getImage
public function getImage(Image $image) { if (is_null($this->watermarks)) { return; } if (!is_string($this->mark)) { return; } if ($this->mark === '') { return; } $path = $this->mark; if ($this->watermarksPathPref...
php
public function getImage(Image $image) { if (is_null($this->watermarks)) { return; } if (!is_string($this->mark)) { return; } if ($this->mark === '') { return; } $path = $this->mark; if ($this->watermarksPathPref...
[ "public", "function", "getImage", "(", "Image", "$", "image", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "watermarks", ")", ")", "{", "return", ";", "}", "if", "(", "!", "is_string", "(", "$", "this", "->", "mark", ")", ")", "{", "re...
Get the watermark image. @param Image $image The source image. @return Image|null The watermark image.
[ "Get", "the", "watermark", "image", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Watermark.php#L126-L157
train
thephpleague/glide
src/Manipulators/Watermark.php
Watermark.getDimension
public function getDimension(Image $image, $field) { if ($this->{$field}) { return (new Dimension($image, $this->getDpr()))->get($this->{$field}); } }
php
public function getDimension(Image $image, $field) { if ($this->{$field}) { return (new Dimension($image, $this->getDpr()))->get($this->{$field}); } }
[ "public", "function", "getDimension", "(", "Image", "$", "image", ",", "$", "field", ")", "{", "if", "(", "$", "this", "->", "{", "$", "field", "}", ")", "{", "return", "(", "new", "Dimension", "(", "$", "image", ",", "$", "this", "->", "getDpr", ...
Get a dimension. @param Image $image The source image. @param string $field The requested field. @return double|null The dimension.
[ "Get", "a", "dimension", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Watermark.php#L165-L170
train
thephpleague/glide
src/Manipulators/Watermark.php
Watermark.getAlpha
public function getAlpha() { if (!is_numeric($this->markalpha)) { return 100; } if ($this->markalpha < 0 or $this->markalpha > 100) { return 100; } return (int) $this->markalpha; }
php
public function getAlpha() { if (!is_numeric($this->markalpha)) { return 100; } if ($this->markalpha < 0 or $this->markalpha > 100) { return 100; } return (int) $this->markalpha; }
[ "public", "function", "getAlpha", "(", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "this", "->", "markalpha", ")", ")", "{", "return", "100", ";", "}", "if", "(", "$", "this", "->", "markalpha", "<", "0", "or", "$", "this", "->", "markalpha",...
Get the alpha channel. @return int The alpha.
[ "Get", "the", "alpha", "channel", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Watermark.php#L245-L256
train
thephpleague/glide
src/Server.php
Server.getSourcePath
public function getSourcePath($path) { $path = trim($path, '/'); $baseUrl = $this->baseUrl.'/'; if (substr($path, 0, strlen($baseUrl)) === $baseUrl) { $path = trim(substr($path, strlen($baseUrl)), '/'); } if ($path === '') { throw new FileNo...
php
public function getSourcePath($path) { $path = trim($path, '/'); $baseUrl = $this->baseUrl.'/'; if (substr($path, 0, strlen($baseUrl)) === $baseUrl) { $path = trim(substr($path, strlen($baseUrl)), '/'); } if ($path === '') { throw new FileNo...
[ "public", "function", "getSourcePath", "(", "$", "path", ")", "{", "$", "path", "=", "trim", "(", "$", "path", ",", "'/'", ")", ";", "$", "baseUrl", "=", "$", "this", "->", "baseUrl", ".", "'/'", ";", "if", "(", "substr", "(", "$", "path", ",", ...
Get source path. @param string $path Image path. @return string The source path. @throws FileNotFoundException
[ "Get", "source", "path", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Server.php#L136-L155
train
thephpleague/glide
src/Server.php
Server.getCachePath
public function getCachePath($path, array $params = []) { $sourcePath = $this->getSourcePath($path); if ($this->sourcePathPrefix) { $sourcePath = substr($sourcePath, strlen($this->sourcePathPrefix) + 1); } $params = $this->getAllParams($params); unset($params['s...
php
public function getCachePath($path, array $params = []) { $sourcePath = $this->getSourcePath($path); if ($this->sourcePathPrefix) { $sourcePath = substr($sourcePath, strlen($this->sourcePathPrefix) + 1); } $params = $this->getAllParams($params); unset($params['s...
[ "public", "function", "getCachePath", "(", "$", "path", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "sourcePath", "=", "$", "this", "->", "getSourcePath", "(", "$", "path", ")", ";", "if", "(", "$", "this", "->", "sourcePathPrefix", ")...
Get cache path. @param string $path Image path. @param array $params Image manipulation params. @return string Cache path.
[ "Get", "cache", "path", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Server.php#L263-L290
train
thephpleague/glide
src/Server.php
Server.cacheFileExists
public function cacheFileExists($path, array $params) { return $this->cache->has( $this->getCachePath($path, $params) ); }
php
public function cacheFileExists($path, array $params) { return $this->cache->has( $this->getCachePath($path, $params) ); }
[ "public", "function", "cacheFileExists", "(", "$", "path", ",", "array", "$", "params", ")", "{", "return", "$", "this", "->", "cache", "->", "has", "(", "$", "this", "->", "getCachePath", "(", "$", "path", ",", "$", "params", ")", ")", ";", "}" ]
Check if a cache file exists. @param string $path Image path. @param array $params Image manipulation params. @return bool Whether the cache file exists.
[ "Check", "if", "a", "cache", "file", "exists", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Server.php#L298-L303
train
thephpleague/glide
src/Server.php
Server.deleteCache
public function deleteCache($path) { if (!$this->groupCacheInFolders) { throw new InvalidArgumentException( 'Deleting cached image manipulations is not possible when grouping cache into folders is disabled.' ); } return $this->cache->deleteDir( ...
php
public function deleteCache($path) { if (!$this->groupCacheInFolders) { throw new InvalidArgumentException( 'Deleting cached image manipulations is not possible when grouping cache into folders is disabled.' ); } return $this->cache->deleteDir( ...
[ "public", "function", "deleteCache", "(", "$", "path", ")", "{", "if", "(", "!", "$", "this", "->", "groupCacheInFolders", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Deleting cached image manipulations is not possible when grouping cache into folders is di...
Delete cached manipulations for an image. @param string $path Image path. @return bool Whether the delete succeeded.
[ "Delete", "cached", "manipulations", "for", "an", "image", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Server.php#L310-L321
train
thephpleague/glide
src/Server.php
Server.getAllParams
public function getAllParams(array $params) { $all = $this->defaults; if (isset($params['p'])) { foreach (explode(',', $params['p']) as $preset) { if (isset($this->presets[$preset])) { $all = array_merge($all, $this->presets[$preset]); ...
php
public function getAllParams(array $params) { $all = $this->defaults; if (isset($params['p'])) { foreach (explode(',', $params['p']) as $preset) { if (isset($this->presets[$preset])) { $all = array_merge($all, $this->presets[$preset]); ...
[ "public", "function", "getAllParams", "(", "array", "$", "params", ")", "{", "$", "all", "=", "$", "this", "->", "defaults", ";", "if", "(", "isset", "(", "$", "params", "[", "'p'", "]", ")", ")", "{", "foreach", "(", "explode", "(", "','", ",", ...
Get all image manipulations params, including defaults and presets. @param array $params Image manipulation params. @return array All image manipulation params.
[ "Get", "all", "image", "manipulations", "params", "including", "defaults", "and", "presets", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Server.php#L382-L395
train
thephpleague/glide
src/Server.php
Server.makeImage
public function makeImage($path, array $params) { $sourcePath = $this->getSourcePath($path); $cachedPath = $this->getCachePath($path, $params); if ($this->cacheFileExists($path, $params) === true) { return $cachedPath; } if ($this->sourceFileExists($path) === fa...
php
public function makeImage($path, array $params) { $sourcePath = $this->getSourcePath($path); $cachedPath = $this->getCachePath($path, $params); if ($this->cacheFileExists($path, $params) === true) { return $cachedPath; } if ($this->sourceFileExists($path) === fa...
[ "public", "function", "makeImage", "(", "$", "path", ",", "array", "$", "params", ")", "{", "$", "sourcePath", "=", "$", "this", "->", "getSourcePath", "(", "$", "path", ")", ";", "$", "cachedPath", "=", "$", "this", "->", "getCachePath", "(", "$", "...
Generate manipulated image. @param string $path Image path. @param array $params Image manipulation params. @return string Cache path. @throws FileNotFoundException @throws FilesystemException
[ "Generate", "manipulated", "image", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Server.php#L489-L545
train
thephpleague/glide
src/Manipulators/Border.php
Border.run
public function run(Image $image) { if ($border = $this->getBorder($image)) { list($width, $color, $method) = $border; if ($method === 'overlay') { return $this->runOverlay($image, $width, $color); } if ($method === 'shrink') { ...
php
public function run(Image $image) { if ($border = $this->getBorder($image)) { list($width, $color, $method) = $border; if ($method === 'overlay') { return $this->runOverlay($image, $width, $color); } if ($method === 'shrink') { ...
[ "public", "function", "run", "(", "Image", "$", "image", ")", "{", "if", "(", "$", "border", "=", "$", "this", "->", "getBorder", "(", "$", "image", ")", ")", "{", "list", "(", "$", "width", ",", "$", "color", ",", "$", "method", ")", "=", "$",...
Perform border image manipulation. @param Image $image The source image. @return Image The manipulated image.
[ "Perform", "border", "image", "manipulation", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Border.php#L20-L39
train
thephpleague/glide
src/Manipulators/Border.php
Border.getBorder
public function getBorder(Image $image) { if (!$this->border) { return; } $values = explode(',', $this->border); $width = $this->getWidth($image, $this->getDpr(), isset($values[0]) ? $values[0] : null); $color = $this->getColor(isset($values[1]) ? $values[1] : n...
php
public function getBorder(Image $image) { if (!$this->border) { return; } $values = explode(',', $this->border); $width = $this->getWidth($image, $this->getDpr(), isset($values[0]) ? $values[0] : null); $color = $this->getColor(isset($values[1]) ? $values[1] : n...
[ "public", "function", "getBorder", "(", "Image", "$", "image", ")", "{", "if", "(", "!", "$", "this", "->", "border", ")", "{", "return", ";", "}", "$", "values", "=", "explode", "(", "','", ",", "$", "this", "->", "border", ")", ";", "$", "width...
Resolve border amount. @param Image $image The source image. @return string The resolved border amount.
[ "Resolve", "border", "amount", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Border.php#L46-L61
train
thephpleague/glide
src/Manipulators/Border.php
Border.getWidth
public function getWidth(Image $image, $dpr, $width) { return (new Dimension($image, $dpr))->get($width); }
php
public function getWidth(Image $image, $dpr, $width) { return (new Dimension($image, $dpr))->get($width); }
[ "public", "function", "getWidth", "(", "Image", "$", "image", ",", "$", "dpr", ",", "$", "width", ")", "{", "return", "(", "new", "Dimension", "(", "$", "image", ",", "$", "dpr", ")", ")", "->", "get", "(", "$", "width", ")", ";", "}" ]
Get border width. @param Image $image The source image. @param double $dpr The device pixel ratio. @param string $width The border width. @return double The resolved border width.
[ "Get", "border", "width", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Border.php#L70-L73
train
thephpleague/glide
src/Manipulators/Border.php
Border.runOverlay
public function runOverlay(Image $image, $width, $color) { return $image->rectangle( $width / 2, $width / 2, $image->width() - ($width / 2), $image->height() - ($width / 2), function ($draw) use ($width, $color) { $draw->border($wid...
php
public function runOverlay(Image $image, $width, $color) { return $image->rectangle( $width / 2, $width / 2, $image->width() - ($width / 2), $image->height() - ($width / 2), function ($draw) use ($width, $color) { $draw->border($wid...
[ "public", "function", "runOverlay", "(", "Image", "$", "image", ",", "$", "width", ",", "$", "color", ")", "{", "return", "$", "image", "->", "rectangle", "(", "$", "width", "/", "2", ",", "$", "width", "/", "2", ",", "$", "image", "->", "width", ...
Run the overlay border method. @param Image $image The source image. @param double $width The border width. @param string $color The border color. @return Image The manipulated image.
[ "Run", "the", "overlay", "border", "method", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Border.php#L123-L134
train
thephpleague/glide
src/Manipulators/Border.php
Border.runShrink
public function runShrink(Image $image, $width, $color) { return $image ->resize( $image->width() - ($width * 2), $image->height() - ($width * 2) ) ->resizeCanvas( $width * 2, $width * 2, 'cen...
php
public function runShrink(Image $image, $width, $color) { return $image ->resize( $image->width() - ($width * 2), $image->height() - ($width * 2) ) ->resizeCanvas( $width * 2, $width * 2, 'cen...
[ "public", "function", "runShrink", "(", "Image", "$", "image", ",", "$", "width", ",", "$", "color", ")", "{", "return", "$", "image", "->", "resize", "(", "$", "image", "->", "width", "(", ")", "-", "(", "$", "width", "*", "2", ")", ",", "$", ...
Run the shrink border method. @param Image $image The source image. @param double $width The border width. @param string $color The border color. @return Image The manipulated image.
[ "Run", "the", "shrink", "border", "method", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Border.php#L143-L157
train
thephpleague/glide
src/Manipulators/Border.php
Border.runExpand
public function runExpand(Image $image, $width, $color) { return $image->resizeCanvas( $width * 2, $width * 2, 'center', true, $color ); }
php
public function runExpand(Image $image, $width, $color) { return $image->resizeCanvas( $width * 2, $width * 2, 'center', true, $color ); }
[ "public", "function", "runExpand", "(", "Image", "$", "image", ",", "$", "width", ",", "$", "color", ")", "{", "return", "$", "image", "->", "resizeCanvas", "(", "$", "width", "*", "2", ",", "$", "width", "*", "2", ",", "'center'", ",", "true", ","...
Run the expand border method. @param Image $image The source image. @param double $width The border width. @param string $color The border color. @return Image The manipulated image.
[ "Run", "the", "expand", "border", "method", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Manipulators/Border.php#L166-L175
train
thephpleague/glide
src/Urls/UrlBuilder.php
UrlBuilder.setBaseUrl
public function setBaseUrl($baseUrl) { if (substr($baseUrl, 0, 2) === '//') { $baseUrl = 'http:'.$baseUrl; $this->isRelativeDomain = true; } $this->baseUrl = rtrim($baseUrl, '/'); }
php
public function setBaseUrl($baseUrl) { if (substr($baseUrl, 0, 2) === '//') { $baseUrl = 'http:'.$baseUrl; $this->isRelativeDomain = true; } $this->baseUrl = rtrim($baseUrl, '/'); }
[ "public", "function", "setBaseUrl", "(", "$", "baseUrl", ")", "{", "if", "(", "substr", "(", "$", "baseUrl", ",", "0", ",", "2", ")", "===", "'//'", ")", "{", "$", "baseUrl", "=", "'http:'", ".", "$", "baseUrl", ";", "$", "this", "->", "isRelativeD...
Set the base URL. @param string $baseUrl The base URL.
[ "Set", "the", "base", "URL", "." ]
b97616835ee2a5ef3d600177a66c4bd68cce2170
https://github.com/thephpleague/glide/blob/b97616835ee2a5ef3d600177a66c4bd68cce2170/src/Urls/UrlBuilder.php#L43-L51
train
sonata-project/SonataAdminBundle
src/Menu/MenuBuilder.php
MenuBuilder.createSidebarMenu
public function createSidebarMenu() { $menu = $this->factory->createItem('root'); foreach ($this->pool->getAdminGroups() as $name => $group) { $extras = [ 'icon' => $group['icon'], 'label_catalogue' => $group['label_catalogue'], 'roles' =>...
php
public function createSidebarMenu() { $menu = $this->factory->createItem('root'); foreach ($this->pool->getAdminGroups() as $name => $group) { $extras = [ 'icon' => $group['icon'], 'label_catalogue' => $group['label_catalogue'], 'roles' =>...
[ "public", "function", "createSidebarMenu", "(", ")", "{", "$", "menu", "=", "$", "this", "->", "factory", "->", "createItem", "(", "'root'", ")", ";", "foreach", "(", "$", "this", "->", "pool", "->", "getAdminGroups", "(", ")", "as", "$", "name", "=>",...
Builds sidebar menu. @return ItemInterface
[ "Builds", "sidebar", "menu", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Menu/MenuBuilder.php#L68-L97
train
sonata-project/SonataAdminBundle
src/Mapper/BaseGroupedMapper.php
BaseGroupedMapper.ifTrue
public function ifTrue($bool) { if (null !== $this->apply) { throw new \RuntimeException('Cannot nest ifTrue or ifFalse call'); } $this->apply = (true === $bool); return $this; }
php
public function ifTrue($bool) { if (null !== $this->apply) { throw new \RuntimeException('Cannot nest ifTrue or ifFalse call'); } $this->apply = (true === $bool); return $this; }
[ "public", "function", "ifTrue", "(", "$", "bool", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "apply", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Cannot nest ifTrue or ifFalse call'", ")", ";", "}", "$", "this", "->", "apply", ...
Only nested add if the condition match true. @param bool $bool @throws \RuntimeException @return $this
[ "Only", "nested", "add", "if", "the", "condition", "match", "true", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Mapper/BaseGroupedMapper.php#L166-L175
train
sonata-project/SonataAdminBundle
src/Mapper/BaseGroupedMapper.php
BaseGroupedMapper.ifFalse
public function ifFalse($bool) { if (null !== $this->apply) { throw new \RuntimeException('Cannot nest ifTrue or ifFalse call'); } $this->apply = (false === $bool); return $this; }
php
public function ifFalse($bool) { if (null !== $this->apply) { throw new \RuntimeException('Cannot nest ifTrue or ifFalse call'); } $this->apply = (false === $bool); return $this; }
[ "public", "function", "ifFalse", "(", "$", "bool", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "apply", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Cannot nest ifTrue or ifFalse call'", ")", ";", "}", "$", "this", "->", "apply", ...
Only nested add if the condition match false. @param bool $bool @throws \RuntimeException @return $this
[ "Only", "nested", "add", "if", "the", "condition", "match", "false", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Mapper/BaseGroupedMapper.php#L186-L195
train
sonata-project/SonataAdminBundle
src/Mapper/BaseGroupedMapper.php
BaseGroupedMapper.end
public function end() { if (null !== $this->currentGroup) { $this->currentGroup = null; } elseif (null !== $this->currentTab) { $this->currentTab = null; } else { throw new \RuntimeException('No open tabs or groups, you cannot use end()'); } ...
php
public function end() { if (null !== $this->currentGroup) { $this->currentGroup = null; } elseif (null !== $this->currentTab) { $this->currentTab = null; } else { throw new \RuntimeException('No open tabs or groups, you cannot use end()'); } ...
[ "public", "function", "end", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "currentGroup", ")", "{", "$", "this", "->", "currentGroup", "=", "null", ";", "}", "elseif", "(", "null", "!==", "$", "this", "->", "currentTab", ")", "{", "$...
Close the current group or tab. @throws \RuntimeException @return $this
[ "Close", "the", "current", "group", "or", "tab", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Mapper/BaseGroupedMapper.php#L226-L237
train
sonata-project/SonataAdminBundle
src/Mapper/BaseGroupedMapper.php
BaseGroupedMapper.addFieldToCurrentGroup
protected function addFieldToCurrentGroup($fieldName) { // Note this line must happen before the next line. // See https://github.com/sonata-project/SonataAdminBundle/pull/1351 $currentGroup = $this->getCurrentGroupName(); $groups = $this->getGroups(); $groups[$currentGroup][...
php
protected function addFieldToCurrentGroup($fieldName) { // Note this line must happen before the next line. // See https://github.com/sonata-project/SonataAdminBundle/pull/1351 $currentGroup = $this->getCurrentGroupName(); $groups = $this->getGroups(); $groups[$currentGroup][...
[ "protected", "function", "addFieldToCurrentGroup", "(", "$", "fieldName", ")", "{", "// Note this line must happen before the next line.", "// See https://github.com/sonata-project/SonataAdminBundle/pull/1351", "$", "currentGroup", "=", "$", "this", "->", "getCurrentGroupName", "("...
Add the field name to the current group. @param string $fieldName
[ "Add", "the", "field", "name", "to", "the", "current", "group", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Mapper/BaseGroupedMapper.php#L280-L290
train
sonata-project/SonataAdminBundle
src/Mapper/BaseGroupedMapper.php
BaseGroupedMapper.getCurrentGroupName
protected function getCurrentGroupName() { if (!$this->currentGroup) { $this->with($this->admin->getLabel(), ['auto_created' => true]); } return $this->currentGroup; }
php
protected function getCurrentGroupName() { if (!$this->currentGroup) { $this->with($this->admin->getLabel(), ['auto_created' => true]); } return $this->currentGroup; }
[ "protected", "function", "getCurrentGroupName", "(", ")", "{", "if", "(", "!", "$", "this", "->", "currentGroup", ")", "{", "$", "this", "->", "with", "(", "$", "this", "->", "admin", "->", "getLabel", "(", ")", ",", "[", "'auto_created'", "=>", "true"...
Return the name of the currently selected group. The method also makes sure a valid group name is currently selected. Note that this can have the side effect to change the 'group' value returned by the getGroup function @return string
[ "Return", "the", "name", "of", "the", "currently", "selected", "group", ".", "The", "method", "also", "makes", "sure", "a", "valid", "group", "name", "is", "currently", "selected", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Mapper/BaseGroupedMapper.php#L301-L308
train
sonata-project/SonataAdminBundle
src/Form/DataTransformer/ModelsToArrayTransformer.php
ModelsToArrayTransformer.legacyConstructor
private function legacyConstructor(array $args) { $choiceList = $args[0]; if (!$choiceList instanceof ModelChoiceList && !$choiceList instanceof ModelChoiceLoader && !$choiceList instanceof LazyChoiceList) { throw new RuntimeException('First param passed to Model...
php
private function legacyConstructor(array $args) { $choiceList = $args[0]; if (!$choiceList instanceof ModelChoiceList && !$choiceList instanceof ModelChoiceLoader && !$choiceList instanceof LazyChoiceList) { throw new RuntimeException('First param passed to Model...
[ "private", "function", "legacyConstructor", "(", "array", "$", "args", ")", "{", "$", "choiceList", "=", "$", "args", "[", "0", "]", ";", "if", "(", "!", "$", "choiceList", "instanceof", "ModelChoiceList", "&&", "!", "$", "choiceList", "instanceof", "Model...
Simulates the old constructor for BC. @throws RuntimeException
[ "Simulates", "the", "old", "constructor", "for", "BC", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Form/DataTransformer/ModelsToArrayTransformer.php#L170-L184
train
sonata-project/SonataAdminBundle
src/Util/AdminObjectAclManipulator.php
AdminObjectAclManipulator.createAclUsersForm
public function createAclUsersForm(AdminObjectAclData $data) { $aclValues = $data->getAclUsers(); $formBuilder = $this->formFactory->createNamedBuilder(self::ACL_USERS_FORM_NAME, FormType::class); $form = $this->buildForm($data, $formBuilder, $aclValues); $data->setAclUsersForm($form...
php
public function createAclUsersForm(AdminObjectAclData $data) { $aclValues = $data->getAclUsers(); $formBuilder = $this->formFactory->createNamedBuilder(self::ACL_USERS_FORM_NAME, FormType::class); $form = $this->buildForm($data, $formBuilder, $aclValues); $data->setAclUsersForm($form...
[ "public", "function", "createAclUsersForm", "(", "AdminObjectAclData", "$", "data", ")", "{", "$", "aclValues", "=", "$", "data", "->", "getAclUsers", "(", ")", ";", "$", "formBuilder", "=", "$", "this", "->", "formFactory", "->", "createNamedBuilder", "(", ...
Gets the ACL users form. @return Form
[ "Gets", "the", "ACL", "users", "form", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Util/AdminObjectAclManipulator.php#L91-L99
train
sonata-project/SonataAdminBundle
src/Util/AdminObjectAclManipulator.php
AdminObjectAclManipulator.createAclRolesForm
public function createAclRolesForm(AdminObjectAclData $data) { $aclValues = $data->getAclRoles(); $formBuilder = $this->formFactory->createNamedBuilder(self::ACL_ROLES_FORM_NAME, FormType::class); $form = $this->buildForm($data, $formBuilder, $aclValues); $data->setAclRolesForm($form...
php
public function createAclRolesForm(AdminObjectAclData $data) { $aclValues = $data->getAclRoles(); $formBuilder = $this->formFactory->createNamedBuilder(self::ACL_ROLES_FORM_NAME, FormType::class); $form = $this->buildForm($data, $formBuilder, $aclValues); $data->setAclRolesForm($form...
[ "public", "function", "createAclRolesForm", "(", "AdminObjectAclData", "$", "data", ")", "{", "$", "aclValues", "=", "$", "data", "->", "getAclRoles", "(", ")", ";", "$", "formBuilder", "=", "$", "this", "->", "formFactory", "->", "createNamedBuilder", "(", ...
Gets the ACL roles form. @return Form
[ "Gets", "the", "ACL", "roles", "form", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Util/AdminObjectAclManipulator.php#L106-L114
train
sonata-project/SonataAdminBundle
src/Util/AdminObjectAclManipulator.php
AdminObjectAclManipulator.updateAclUsers
public function updateAclUsers(AdminObjectAclData $data) { $aclValues = $data->getAclUsers(); $form = $data->getAclUsersForm(); $this->buildAcl($data, $form, $aclValues); }
php
public function updateAclUsers(AdminObjectAclData $data) { $aclValues = $data->getAclUsers(); $form = $data->getAclUsersForm(); $this->buildAcl($data, $form, $aclValues); }
[ "public", "function", "updateAclUsers", "(", "AdminObjectAclData", "$", "data", ")", "{", "$", "aclValues", "=", "$", "data", "->", "getAclUsers", "(", ")", ";", "$", "form", "=", "$", "data", "->", "getAclUsersForm", "(", ")", ";", "$", "this", "->", ...
Updates ACL users.
[ "Updates", "ACL", "users", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Util/AdminObjectAclManipulator.php#L119-L125
train
sonata-project/SonataAdminBundle
src/Util/AdminObjectAclManipulator.php
AdminObjectAclManipulator.updateAclRoles
public function updateAclRoles(AdminObjectAclData $data) { $aclValues = $data->getAclRoles(); $form = $data->getAclRolesForm(); $this->buildAcl($data, $form, $aclValues); }
php
public function updateAclRoles(AdminObjectAclData $data) { $aclValues = $data->getAclRoles(); $form = $data->getAclRolesForm(); $this->buildAcl($data, $form, $aclValues); }
[ "public", "function", "updateAclRoles", "(", "AdminObjectAclData", "$", "data", ")", "{", "$", "aclValues", "=", "$", "data", "->", "getAclRoles", "(", ")", ";", "$", "form", "=", "$", "data", "->", "getAclRolesForm", "(", ")", ";", "$", "this", "->", ...
Updates ACL roles.
[ "Updates", "ACL", "roles", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Util/AdminObjectAclManipulator.php#L130-L136
train
sonata-project/SonataAdminBundle
src/Util/AdminObjectAclManipulator.php
AdminObjectAclManipulator.buildAcl
protected function buildAcl(AdminObjectAclData $data, Form $form, \Traversable $aclValues) { $masks = $data->getMasks(); $acl = $data->getAcl(); $matrices = $form->getData(); foreach ($aclValues as $aclValue) { foreach ($matrices as $key => $matrix) { if ...
php
protected function buildAcl(AdminObjectAclData $data, Form $form, \Traversable $aclValues) { $masks = $data->getMasks(); $acl = $data->getAcl(); $matrices = $form->getData(); foreach ($aclValues as $aclValue) { foreach ($matrices as $key => $matrix) { if ...
[ "protected", "function", "buildAcl", "(", "AdminObjectAclData", "$", "data", ",", "Form", "$", "form", ",", "\\", "Traversable", "$", "aclValues", ")", "{", "$", "masks", "=", "$", "data", "->", "getMasks", "(", ")", ";", "$", "acl", "=", "$", "data", ...
Builds ACL.
[ "Builds", "ACL", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Util/AdminObjectAclManipulator.php#L159-L221
train
sonata-project/SonataAdminBundle
src/DependencyInjection/Compiler/ExtensionCompilerPass.php
ExtensionCompilerPass.addExtension
private function addExtension( array &$targets, string $target, string $extension, array $attributes ): void { if (!isset($targets[$target])) { $targets[$target] = new \SplPriorityQueue(); } $priority = $attributes['priority'] ?? 0; $targe...
php
private function addExtension( array &$targets, string $target, string $extension, array $attributes ): void { if (!isset($targets[$target])) { $targets[$target] = new \SplPriorityQueue(); } $priority = $attributes['priority'] ?? 0; $targe...
[ "private", "function", "addExtension", "(", "array", "&", "$", "targets", ",", "string", "$", "target", ",", "string", "$", "extension", ",", "array", "$", "attributes", ")", ":", "void", "{", "if", "(", "!", "isset", "(", "$", "targets", "[", "$", "...
Add extension configuration to the targets array.
[ "Add", "extension", "configuration", "to", "the", "targets", "array", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/DependencyInjection/Compiler/ExtensionCompilerPass.php#L218-L230
train
sonata-project/SonataAdminBundle
src/Admin/AdminHelper.php
AdminHelper.addNewInstance
public function addNewInstance($object, FieldDescriptionInterface $fieldDescription) { $instance = $fieldDescription->getAssociationAdmin()->getNewInstance(); $mapping = $fieldDescription->getAssociationMapping(); $method = sprintf('add%s', Inflector::classify($mapping['fieldName'])); ...
php
public function addNewInstance($object, FieldDescriptionInterface $fieldDescription) { $instance = $fieldDescription->getAssociationAdmin()->getNewInstance(); $mapping = $fieldDescription->getAssociationMapping(); $method = sprintf('add%s', Inflector::classify($mapping['fieldName'])); ...
[ "public", "function", "addNewInstance", "(", "$", "object", ",", "FieldDescriptionInterface", "$", "fieldDescription", ")", "{", "$", "instance", "=", "$", "fieldDescription", "->", "getAssociationAdmin", "(", ")", "->", "getNewInstance", "(", ")", ";", "$", "ma...
Add a new instance to the related FieldDescriptionInterface value. @param object $object @throws \RuntimeException
[ "Add", "a", "new", "instance", "to", "the", "related", "FieldDescriptionInterface", "value", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AdminHelper.php#L218-L240
train
sonata-project/SonataAdminBundle
src/Admin/AdminHelper.php
AdminHelper.getElementAccessPath
public function getElementAccessPath($elementId, $entity) { $propertyAccessor = $this->pool->getPropertyAccessor(); $idWithoutIdentifier = preg_replace('/^[^_]*_/', '', $elementId); $initialPath = preg_replace('#(_(\d+)_)#', '[$2]_', $idWithoutIdentifier); $parts = explode('_', $in...
php
public function getElementAccessPath($elementId, $entity) { $propertyAccessor = $this->pool->getPropertyAccessor(); $idWithoutIdentifier = preg_replace('/^[^_]*_/', '', $elementId); $initialPath = preg_replace('#(_(\d+)_)#', '[$2]_', $idWithoutIdentifier); $parts = explode('_', $in...
[ "public", "function", "getElementAccessPath", "(", "$", "elementId", ",", "$", "entity", ")", "{", "$", "propertyAccessor", "=", "$", "this", "->", "pool", "->", "getPropertyAccessor", "(", ")", ";", "$", "idWithoutIdentifier", "=", "preg_replace", "(", "'/^[^...
Get access path to element which works with PropertyAccessor. @param string $elementId expects string in format used in form id field. (uniqueIdentifier_model_sub_model or uniqueIdentifier_model_1_sub_model etc.) @param mixed $entity @throws \Exception @return string
[ "Get", "access", "path", "to", "element", "which", "works", "with", "PropertyAccessor", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AdminHelper.php#L280-L308
train
sonata-project/SonataAdminBundle
src/Admin/AdminHelper.php
AdminHelper.getEntityClassName
protected function getEntityClassName(AdminInterface $admin, $elements) { $element = array_shift($elements); $associationAdmin = $admin->getFormFieldDescription($element)->getAssociationAdmin(); if (0 === \count($elements)) { return $associationAdmin->getClass(); } ...
php
protected function getEntityClassName(AdminInterface $admin, $elements) { $element = array_shift($elements); $associationAdmin = $admin->getFormFieldDescription($element)->getAssociationAdmin(); if (0 === \count($elements)) { return $associationAdmin->getClass(); } ...
[ "protected", "function", "getEntityClassName", "(", "AdminInterface", "$", "admin", ",", "$", "elements", ")", "{", "$", "element", "=", "array_shift", "(", "$", "elements", ")", ";", "$", "associationAdmin", "=", "$", "admin", "->", "getFormFieldDescription", ...
Recursively find the class name of the admin responsible for the element at the end of an association chain. @param array $elements @return string
[ "Recursively", "find", "the", "class", "name", "of", "the", "admin", "responsible", "for", "the", "element", "at", "the", "end", "of", "an", "association", "chain", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AdminHelper.php#L317-L326
train
sonata-project/SonataAdminBundle
src/Util/AdminObjectAclData.php
AdminObjectAclData.getUserPermissions
public function getUserPermissions() { $permissions = $this->getPermissions(); if (!$this->isOwner()) { foreach (self::$ownerPermissions as $permission) { $key = array_search($permission, $permissions, true); if (false !== $key) { unse...
php
public function getUserPermissions() { $permissions = $this->getPermissions(); if (!$this->isOwner()) { foreach (self::$ownerPermissions as $permission) { $key = array_search($permission, $permissions, true); if (false !== $key) { unse...
[ "public", "function", "getUserPermissions", "(", ")", "{", "$", "permissions", "=", "$", "this", "->", "getPermissions", "(", ")", ";", "if", "(", "!", "$", "this", "->", "isOwner", "(", ")", ")", "{", "foreach", "(", "self", "::", "$", "ownerPermissio...
Get permissions that the current user can set. @return array
[ "Get", "permissions", "that", "the", "current", "user", "can", "set", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Util/AdminObjectAclData.php#L269-L283
train
sonata-project/SonataAdminBundle
src/Util/AdminObjectAclData.php
AdminObjectAclData.updateMasks
protected function updateMasks() { $permissions = $this->getPermissions(); $reflectionClass = new \ReflectionClass(new $this->maskBuilderClass()); $this->masks = []; foreach ($permissions as $permission) { $this->masks[$permission] = $reflectionClass->getConstant('MASK_'...
php
protected function updateMasks() { $permissions = $this->getPermissions(); $reflectionClass = new \ReflectionClass(new $this->maskBuilderClass()); $this->masks = []; foreach ($permissions as $permission) { $this->masks[$permission] = $reflectionClass->getConstant('MASK_'...
[ "protected", "function", "updateMasks", "(", ")", "{", "$", "permissions", "=", "$", "this", "->", "getPermissions", "(", ")", ";", "$", "reflectionClass", "=", "new", "\\", "ReflectionClass", "(", "new", "$", "this", "->", "maskBuilderClass", "(", ")", ")...
Cache masks.
[ "Cache", "masks", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Util/AdminObjectAclData.php#L322-L331
train
sonata-project/SonataAdminBundle
src/Datagrid/Pager.php
Pager.getLinks
public function getLinks($nbLinks = null) { if (null === $nbLinks) { $nbLinks = $this->getMaxPageLinks(); } $links = []; $tmp = $this->page - floor($nbLinks / 2); $check = $this->lastPage - $nbLinks + 1; $limit = $check > 0 ? $check : 1; $begin = $...
php
public function getLinks($nbLinks = null) { if (null === $nbLinks) { $nbLinks = $this->getMaxPageLinks(); } $links = []; $tmp = $this->page - floor($nbLinks / 2); $check = $this->lastPage - $nbLinks + 1; $limit = $check > 0 ? $check : 1; $begin = $...
[ "public", "function", "getLinks", "(", "$", "nbLinks", "=", "null", ")", "{", "if", "(", "null", "===", "$", "nbLinks", ")", "{", "$", "nbLinks", "=", "$", "this", "->", "getMaxPageLinks", "(", ")", ";", "}", "$", "links", "=", "[", "]", ";", "$"...
Returns an array of page numbers to use in pagination links. @param int $nbLinks The maximum number of page numbers to return @return array
[ "Returns", "an", "array", "of", "page", "numbers", "to", "use", "in", "pagination", "links", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Datagrid/Pager.php#L136-L155
train
sonata-project/SonataAdminBundle
src/Datagrid/Pager.php
Pager.setCursor
public function setCursor($pos) { if ($pos < 1) { $this->cursor = 1; } else { if ($pos > $this->nbResults) { $this->cursor = $this->nbResults; } else { $this->cursor = $pos; } } }
php
public function setCursor($pos) { if ($pos < 1) { $this->cursor = 1; } else { if ($pos > $this->nbResults) { $this->cursor = $this->nbResults; } else { $this->cursor = $pos; } } }
[ "public", "function", "setCursor", "(", "$", "pos", ")", "{", "if", "(", "$", "pos", "<", "1", ")", "{", "$", "this", "->", "cursor", "=", "1", ";", "}", "else", "{", "if", "(", "$", "pos", ">", "$", "this", "->", "nbResults", ")", "{", "$", ...
Sets the current cursor. @param int $pos
[ "Sets", "the", "current", "cursor", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Datagrid/Pager.php#L182-L193
train
sonata-project/SonataAdminBundle
src/Datagrid/Pager.php
Pager.initializeIterator
protected function initializeIterator() { $this->results = $this->getResults(); $this->resultsCounter = \count($this->results); }
php
protected function initializeIterator() { $this->results = $this->getResults(); $this->resultsCounter = \count($this->results); }
[ "protected", "function", "initializeIterator", "(", ")", "{", "$", "this", "->", "results", "=", "$", "this", "->", "getResults", "(", ")", ";", "$", "this", "->", "resultsCounter", "=", "\\", "count", "(", "$", "this", "->", "results", ")", ";", "}" ]
Loads data into properties used for iteration.
[ "Loads", "data", "into", "properties", "used", "for", "iteration", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Datagrid/Pager.php#L602-L606
train
sonata-project/SonataAdminBundle
src/Datagrid/Pager.php
Pager.retrieveObject
protected function retrieveObject($offset) { $queryForRetrieve = clone $this->getQuery(); $queryForRetrieve ->setFirstResult($offset - 1) ->setMaxResults(1); $results = $queryForRetrieve->execute(); return $results[0]; }
php
protected function retrieveObject($offset) { $queryForRetrieve = clone $this->getQuery(); $queryForRetrieve ->setFirstResult($offset - 1) ->setMaxResults(1); $results = $queryForRetrieve->execute(); return $results[0]; }
[ "protected", "function", "retrieveObject", "(", "$", "offset", ")", "{", "$", "queryForRetrieve", "=", "clone", "$", "this", "->", "getQuery", "(", ")", ";", "$", "queryForRetrieve", "->", "setFirstResult", "(", "$", "offset", "-", "1", ")", "->", "setMaxR...
Retrieve the object for a certain offset. @param int $offset @return object
[ "Retrieve", "the", "object", "for", "a", "certain", "offset", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Datagrid/Pager.php#L624-L634
train
sonata-project/SonataAdminBundle
src/Annotation/Admin.php
Admin.generateFallback
private function generateFallback($name): void { if (empty($name)) { return; } if (preg_match(AdminClass::CLASS_REGEX, $name, $matches)) { if (empty($this->group)) { $this->group = $matches[3]; } if (empty($this->label)) { ...
php
private function generateFallback($name): void { if (empty($name)) { return; } if (preg_match(AdminClass::CLASS_REGEX, $name, $matches)) { if (empty($this->group)) { $this->group = $matches[3]; } if (empty($this->label)) { ...
[ "private", "function", "generateFallback", "(", "$", "name", ")", ":", "void", "{", "if", "(", "empty", "(", "$", "name", ")", ")", "{", "return", ";", "}", "if", "(", "preg_match", "(", "AdminClass", "::", "CLASS_REGEX", ",", "$", "name", ",", "$", ...
Set group and label from class name it not set.
[ "Set", "group", "and", "label", "from", "class", "name", "it", "not", "set", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Annotation/Admin.php#L161-L176
train
sonata-project/SonataAdminBundle
src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php
AddDependencyCallsCompilerPass.applyConfigurationFromAttribute
public function applyConfigurationFromAttribute(Definition $definition, array $attributes) { $keys = [ 'model_manager', 'form_contractor', 'show_builder', 'list_builder', 'datagrid_builder', 'translator', 'configuration_pool...
php
public function applyConfigurationFromAttribute(Definition $definition, array $attributes) { $keys = [ 'model_manager', 'form_contractor', 'show_builder', 'list_builder', 'datagrid_builder', 'translator', 'configuration_pool...
[ "public", "function", "applyConfigurationFromAttribute", "(", "Definition", "$", "definition", ",", "array", "$", "attributes", ")", "{", "$", "keys", "=", "[", "'model_manager'", ",", "'form_contractor'", ",", "'show_builder'", ",", "'list_builder'", ",", "'datagri...
This method read the attribute keys and configure admin class to use the related dependency.
[ "This", "method", "read", "the", "attribute", "keys", "and", "configure", "admin", "class", "to", "use", "the", "related", "dependency", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php#L221-L247
train
sonata-project/SonataAdminBundle
src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php
AddDependencyCallsCompilerPass.replaceDefaultArguments
private function replaceDefaultArguments( array $defaultArguments, Definition $definition, Definition $parentDefinition = null ): void { $arguments = $definition->getArguments(); $parentArguments = $parentDefinition ? $parentDefinition->getArguments() : []; foreach (...
php
private function replaceDefaultArguments( array $defaultArguments, Definition $definition, Definition $parentDefinition = null ): void { $arguments = $definition->getArguments(); $parentArguments = $parentDefinition ? $parentDefinition->getArguments() : []; foreach (...
[ "private", "function", "replaceDefaultArguments", "(", "array", "$", "defaultArguments", ",", "Definition", "$", "definition", ",", "Definition", "$", "parentDefinition", "=", "null", ")", ":", "void", "{", "$", "arguments", "=", "$", "definition", "->", "getArg...
Replace the empty arguments required by the Admin service definition.
[ "Replace", "the", "empty", "arguments", "required", "by", "the", "Admin", "service", "definition", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php#L423-L441
train
sonata-project/SonataAdminBundle
src/Util/ObjectAclManipulator.php
ObjectAclManipulator.configureAcls
public function configureAcls( OutputInterface $output, AdminInterface $admin, \Traversable $oids, UserSecurityIdentity $securityIdentity = null ) { $countAdded = 0; $countUpdated = 0; $securityHandler = $admin->getSecurityHandler(); if (!$securityHand...
php
public function configureAcls( OutputInterface $output, AdminInterface $admin, \Traversable $oids, UserSecurityIdentity $securityIdentity = null ) { $countAdded = 0; $countUpdated = 0; $securityHandler = $admin->getSecurityHandler(); if (!$securityHand...
[ "public", "function", "configureAcls", "(", "OutputInterface", "$", "output", ",", "AdminInterface", "$", "admin", ",", "\\", "Traversable", "$", "oids", ",", "UserSecurityIdentity", "$", "securityIdentity", "=", "null", ")", "{", "$", "countAdded", "=", "0", ...
Configure the object ACL for the passed object identities. @throws \Exception @return array [countAdded, countUpdated]
[ "Configure", "the", "object", "ACL", "for", "the", "passed", "object", "identities", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Util/ObjectAclManipulator.php#L33-L74
train
sonata-project/SonataAdminBundle
src/Action/RetrieveAutocompleteItemsAction.php
RetrieveAutocompleteItemsAction.retrieveFilterFieldDescription
private function retrieveFilterFieldDescription( AdminInterface $admin, string $field ): FieldDescriptionInterface { $admin->getFilterFieldDescriptions(); $fieldDescription = $admin->getFilterFieldDescription($field); if (!$fieldDescription) { throw new \Runtime...
php
private function retrieveFilterFieldDescription( AdminInterface $admin, string $field ): FieldDescriptionInterface { $admin->getFilterFieldDescriptions(); $fieldDescription = $admin->getFilterFieldDescription($field); if (!$fieldDescription) { throw new \Runtime...
[ "private", "function", "retrieveFilterFieldDescription", "(", "AdminInterface", "$", "admin", ",", "string", "$", "field", ")", ":", "FieldDescriptionInterface", "{", "$", "admin", "->", "getFilterFieldDescriptions", "(", ")", ";", "$", "fieldDescription", "=", "$",...
Retrieve the filter field description given by field name. @throws \RuntimeException
[ "Retrieve", "the", "filter", "field", "description", "given", "by", "field", "name", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Action/RetrieveAutocompleteItemsAction.php#L181-L198
train
sonata-project/SonataAdminBundle
src/Admin/Pool.php
Pool.getInstance
public function getInstance($id) { if (!\in_array($id, $this->adminServiceIds, true)) { $msg = sprintf('Admin service "%s" not found in admin pool.', $id); $shortest = -1; $closest = null; $alternatives = []; foreach ($this->adminServiceIds as $adm...
php
public function getInstance($id) { if (!\in_array($id, $this->adminServiceIds, true)) { $msg = sprintf('Admin service "%s" not found in admin pool.', $id); $shortest = -1; $closest = null; $alternatives = []; foreach ($this->adminServiceIds as $adm...
[ "public", "function", "getInstance", "(", "$", "id", ")", "{", "if", "(", "!", "\\", "in_array", "(", "$", "id", ",", "$", "this", "->", "adminServiceIds", ",", "true", ")", ")", "{", "$", "msg", "=", "sprintf", "(", "'Admin service \"%s\" not found in a...
Returns a new admin instance depends on the given code. @param string $id @throws \InvalidArgumentException @return AdminInterface
[ "Returns", "a", "new", "admin", "instance", "depends", "on", "the", "given", "code", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/Pool.php#L273-L310
train
sonata-project/SonataAdminBundle
src/Bridge/Exporter/AdminExporter.php
AdminExporter.getAvailableFormats
public function getAvailableFormats(AdminInterface $admin): array { $adminExportFormats = $admin->getExportFormats(); // NEXT_MAJOR : compare with null if ($adminExportFormats !== ['json', 'xml', 'csv', 'xls']) { return $adminExportFormats; } return $this->expor...
php
public function getAvailableFormats(AdminInterface $admin): array { $adminExportFormats = $admin->getExportFormats(); // NEXT_MAJOR : compare with null if ($adminExportFormats !== ['json', 'xml', 'csv', 'xls']) { return $adminExportFormats; } return $this->expor...
[ "public", "function", "getAvailableFormats", "(", "AdminInterface", "$", "admin", ")", ":", "array", "{", "$", "adminExportFormats", "=", "$", "admin", "->", "getExportFormats", "(", ")", ";", "// NEXT_MAJOR : compare with null", "if", "(", "$", "adminExportFormats"...
Queries an admin for its default export formats, and falls back on global settings. @param AdminInterface $admin the current admin object @return string[] an array of formats
[ "Queries", "an", "admin", "for", "its", "default", "export", "formats", "and", "falls", "back", "on", "global", "settings", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Bridge/Exporter/AdminExporter.php#L44-L54
train
sonata-project/SonataAdminBundle
src/Bridge/Exporter/AdminExporter.php
AdminExporter.getExportFilename
public function getExportFilename(AdminInterface $admin, string $format): string { $class = $admin->getClass(); return sprintf( 'export_%s_%s.%s', strtolower(substr($class, strripos($class, '\\') + 1)), date('Y_m_d_H_i_s', strtotime('now')), $format ...
php
public function getExportFilename(AdminInterface $admin, string $format): string { $class = $admin->getClass(); return sprintf( 'export_%s_%s.%s', strtolower(substr($class, strripos($class, '\\') + 1)), date('Y_m_d_H_i_s', strtotime('now')), $format ...
[ "public", "function", "getExportFilename", "(", "AdminInterface", "$", "admin", ",", "string", "$", "format", ")", ":", "string", "{", "$", "class", "=", "$", "admin", "->", "getClass", "(", ")", ";", "return", "sprintf", "(", "'export_%s_%s.%s'", ",", "st...
Builds an export filename from the class associated with the provided admin, the current date, and the provided format. @param AdminInterface $admin the current admin object @param string $format the format of the export file
[ "Builds", "an", "export", "filename", "from", "the", "class", "associated", "with", "the", "provided", "admin", "the", "current", "date", "and", "the", "provided", "format", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Bridge/Exporter/AdminExporter.php#L63-L73
train
sonata-project/SonataAdminBundle
src/Controller/CoreController.php
CoreController.searchAction
public function searchAction(Request $request) { $searchAction = $this->container->get(SearchAction::class); return $searchAction($request); }
php
public function searchAction(Request $request) { $searchAction = $this->container->get(SearchAction::class); return $searchAction($request); }
[ "public", "function", "searchAction", "(", "Request", "$", "request", ")", "{", "$", "searchAction", "=", "$", "this", "->", "container", "->", "get", "(", "SearchAction", "::", "class", ")", ";", "return", "$", "searchAction", "(", "$", "request", ")", ...
The search action first render an empty page, if the query is set, then the template generates some ajax request to retrieve results for each admin. The Ajax query returns a JSON response. @throws \RuntimeException @return JsonResponse|Response
[ "The", "search", "action", "first", "render", "an", "empty", "page", "if", "the", "query", "is", "set", "then", "the", "template", "generates", "some", "ajax", "request", "to", "retrieve", "results", "for", "each", "admin", ".", "The", "Ajax", "query", "re...
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CoreController.php#L57-L62
train
sonata-project/SonataAdminBundle
src/Guesser/TypeGuesserChain.php
TypeGuesserChain.guess
private function guess(\Closure $closure): Guess { $guesses = []; foreach ($this->guessers as $guesser) { if ($guess = $closure($guesser)) { $guesses[] = $guess; } } return Guess::getBestGuess($guesses); }
php
private function guess(\Closure $closure): Guess { $guesses = []; foreach ($this->guessers as $guesser) { if ($guess = $closure($guesser)) { $guesses[] = $guess; } } return Guess::getBestGuess($guesses); }
[ "private", "function", "guess", "(", "\\", "Closure", "$", "closure", ")", ":", "Guess", "{", "$", "guesses", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "guessers", "as", "$", "guesser", ")", "{", "if", "(", "$", "guess", "=", "$", "c...
Executes a closure for each guesser and returns the best guess from the return values. @param \Closure $closure The closure to execute. Accepts a guesser as argument and should return a Guess instance @return Guess The guess with the highest confidence
[ "Executes", "a", "closure", "for", "each", "guesser", "and", "returns", "the", "best", "guess", "from", "the", "return", "values", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Guesser/TypeGuesserChain.php#L64-L75
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.initialize
public function initialize() { if (!$this->classnameLabel) { /* NEXT_MAJOR: remove cast to string, null is not supposed to be supported but was documented as such */ $this->classnameLabel = substr( (string) $this->getClass(), strrpos((strin...
php
public function initialize() { if (!$this->classnameLabel) { /* NEXT_MAJOR: remove cast to string, null is not supposed to be supported but was documented as such */ $this->classnameLabel = substr( (string) $this->getClass(), strrpos((strin...
[ "public", "function", "initialize", "(", ")", "{", "if", "(", "!", "$", "this", "->", "classnameLabel", ")", "{", "/* NEXT_MAJOR: remove cast to string, null is not supposed to be\n supported but was documented as such */", "$", "this", "->", "classnameLabel", "=",...
define custom variable.
[ "define", "custom", "variable", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L642-L657
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.getBaseRoutePattern
public function getBaseRoutePattern() { if (null !== $this->cachedBaseRoutePattern) { return $this->cachedBaseRoutePattern; } if ($this->isChild()) { // the admin class is a child, prefix it with the parent route pattern $baseRoutePattern = $this->baseRoutePattern; ...
php
public function getBaseRoutePattern() { if (null !== $this->cachedBaseRoutePattern) { return $this->cachedBaseRoutePattern; } if ($this->isChild()) { // the admin class is a child, prefix it with the parent route pattern $baseRoutePattern = $this->baseRoutePattern; ...
[ "public", "function", "getBaseRoutePattern", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "cachedBaseRoutePattern", ")", "{", "return", "$", "this", "->", "cachedBaseRoutePattern", ";", "}", "if", "(", "$", "this", "->", "isChild", "(", ")",...
Returns the baseRoutePattern used to generate the routing information. @throws \RuntimeException @return string the baseRoutePattern used to generate the routing information
[ "Returns", "the", "baseRoutePattern", "used", "to", "generate", "the", "routing", "information", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L905-L946
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.getBaseRouteName
public function getBaseRouteName() { if (null !== $this->cachedBaseRouteName) { return $this->cachedBaseRouteName; } if ($this->isChild()) { // the admin class is a child, prefix it with the parent route name $baseRouteName = $this->baseRouteName; if (!$t...
php
public function getBaseRouteName() { if (null !== $this->cachedBaseRouteName) { return $this->cachedBaseRouteName; } if ($this->isChild()) { // the admin class is a child, prefix it with the parent route name $baseRouteName = $this->baseRouteName; if (!$t...
[ "public", "function", "getBaseRouteName", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "cachedBaseRouteName", ")", "{", "return", "$", "this", "->", "cachedBaseRouteName", ";", "}", "if", "(", "$", "this", "->", "isChild", "(", ")", ")", ...
Returns the baseRouteName used to generate the routing information. @throws \RuntimeException @return string the baseRouteName used to generate the routing information
[ "Returns", "the", "baseRouteName", "used", "to", "generate", "the", "routing", "information", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L955-L994
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.buildBreadcrumbs
public function buildBreadcrumbs($action, MenuItemInterface $menu = null) { @trigger_error( 'The '.__METHOD__.' method is deprecated since version 3.2 and will be removed in 4.0.', E_USER_DEPRECATED ); if (isset($this->breadcrumbs[$action])) { return $thi...
php
public function buildBreadcrumbs($action, MenuItemInterface $menu = null) { @trigger_error( 'The '.__METHOD__.' method is deprecated since version 3.2 and will be removed in 4.0.', E_USER_DEPRECATED ); if (isset($this->breadcrumbs[$action])) { return $thi...
[ "public", "function", "buildBreadcrumbs", "(", "$", "action", ",", "MenuItemInterface", "$", "menu", "=", "null", ")", "{", "@", "trigger_error", "(", "'The '", ".", "__METHOD__", ".", "' method is deprecated since version 3.2 and will be removed in 4.0.'", ",", "E_USER...
Generates the breadcrumbs array. Note: the method will be called by the top admin instance (parent => child) @param string $action @return array
[ "Generates", "the", "breadcrumbs", "array", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L1954-L1967
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.hasAccess
public function hasAccess($action, $object = null) { $access = $this->getAccess(); if (!\array_key_exists($action, $access)) { return false; } if (!\is_array($access[$action])) { $access[$action] = [$access[$action]]; } foreach ($access[$act...
php
public function hasAccess($action, $object = null) { $access = $this->getAccess(); if (!\array_key_exists($action, $access)) { return false; } if (!\is_array($access[$action])) { $access[$action] = [$access[$action]]; } foreach ($access[$act...
[ "public", "function", "hasAccess", "(", "$", "action", ",", "$", "object", "=", "null", ")", "{", "$", "access", "=", "$", "this", "->", "getAccess", "(", ")", ";", "if", "(", "!", "\\", "array_key_exists", "(", "$", "action", ",", "$", "access", "...
Hook to handle access authorization, without throw Exception. @param string $action @param object $object @return bool
[ "Hook", "to", "handle", "access", "authorization", "without", "throw", "Exception", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L2591-L2610
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.getDashboardActions
public function getDashboardActions() { $actions = []; if ($this->hasRoute('create') && $this->hasAccess('create')) { $actions['create'] = [ 'label' => 'link_add', 'translation_domain' => 'SonataAdminBundle', // NEXT_MAJOR: Remove this lin...
php
public function getDashboardActions() { $actions = []; if ($this->hasRoute('create') && $this->hasAccess('create')) { $actions['create'] = [ 'label' => 'link_add', 'translation_domain' => 'SonataAdminBundle', // NEXT_MAJOR: Remove this lin...
[ "public", "function", "getDashboardActions", "(", ")", "{", "$", "actions", "=", "[", "]", ";", "if", "(", "$", "this", "->", "hasRoute", "(", "'create'", ")", "&&", "$", "this", "->", "hasAccess", "(", "'create'", ")", ")", "{", "$", "actions", "[",...
Get the list of actions that can be accessed directly from the dashboard. @return array
[ "Get", "the", "list", "of", "actions", "that", "can", "be", "accessed", "directly", "from", "the", "dashboard", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L2712-L2738
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.isDefaultFilter
final public function isDefaultFilter($name) { $filter = $this->getFilterParameters(); $default = $this->getDefaultFilterValues(); if (!\array_key_exists($name, $filter) || !\array_key_exists($name, $default)) { return false; } return $filter[$name] === $default...
php
final public function isDefaultFilter($name) { $filter = $this->getFilterParameters(); $default = $this->getDefaultFilterValues(); if (!\array_key_exists($name, $filter) || !\array_key_exists($name, $default)) { return false; } return $filter[$name] === $default...
[ "final", "public", "function", "isDefaultFilter", "(", "$", "name", ")", "{", "$", "filter", "=", "$", "this", "->", "getFilterParameters", "(", ")", ";", "$", "default", "=", "$", "this", "->", "getDefaultFilterValues", "(", ")", ";", "if", "(", "!", ...
Checks if a filter type is set to a default value. @param string $name @return bool
[ "Checks", "if", "a", "filter", "type", "is", "set", "to", "a", "default", "value", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L2774-L2784
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.canAccessObject
public function canAccessObject($action, $object) { return $object && $this->id($object) && $this->hasAccess($action, $object); }
php
public function canAccessObject($action, $object) { return $object && $this->id($object) && $this->hasAccess($action, $object); }
[ "public", "function", "canAccessObject", "(", "$", "action", ",", "$", "object", ")", "{", "return", "$", "object", "&&", "$", "this", "->", "id", "(", "$", "object", ")", "&&", "$", "this", "->", "hasAccess", "(", "$", "action", ",", "$", "object", ...
Check object existence and access, without throw Exception. @param string $action @param object $object @return bool
[ "Check", "object", "existence", "and", "access", "without", "throw", "Exception", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L2794-L2797
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.getDefaultFilterValues
final protected function getDefaultFilterValues() { $defaultFilterValues = []; $this->configureDefaultFilterValues($defaultFilterValues); foreach ($this->getExtensions() as $extension) { // NEXT_MAJOR: remove method check in next major release if (method_exists($ext...
php
final protected function getDefaultFilterValues() { $defaultFilterValues = []; $this->configureDefaultFilterValues($defaultFilterValues); foreach ($this->getExtensions() as $extension) { // NEXT_MAJOR: remove method check in next major release if (method_exists($ext...
[ "final", "protected", "function", "getDefaultFilterValues", "(", ")", "{", "$", "defaultFilterValues", "=", "[", "]", ";", "$", "this", "->", "configureDefaultFilterValues", "(", "$", "defaultFilterValues", ")", ";", "foreach", "(", "$", "this", "->", "getExtens...
Returns a list of default filters. @return array
[ "Returns", "a", "list", "of", "default", "filters", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L2812-L2826
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.configureTabMenu
protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) { // Use configureSideMenu not to mess with previous overrides // TODO remove once deprecation period is over $this->configureSideMenu($menu, $action, $childAdmin); }
php
protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) { // Use configureSideMenu not to mess with previous overrides // TODO remove once deprecation period is over $this->configureSideMenu($menu, $action, $childAdmin); }
[ "protected", "function", "configureTabMenu", "(", "MenuItemInterface", "$", "menu", ",", "$", "action", ",", "AdminInterface", "$", "childAdmin", "=", "null", ")", "{", "// Use configureSideMenu not to mess with previous overrides", "// TODO remove once deprecation period is ov...
Configures the tab menu in your admin. @param string $action @return mixed
[ "Configures", "the", "tab", "menu", "in", "your", "admin", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L2878-L2883
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.buildShow
protected function buildShow() { if ($this->show) { return; } $this->show = new FieldDescriptionCollection(); $mapper = new ShowMapper($this->showBuilder, $this->show, $this); $this->configureShowFields($mapper); foreach ($this->getExtensions() as $exte...
php
protected function buildShow() { if ($this->show) { return; } $this->show = new FieldDescriptionCollection(); $mapper = new ShowMapper($this->showBuilder, $this->show, $this); $this->configureShowFields($mapper); foreach ($this->getExtensions() as $exte...
[ "protected", "function", "buildShow", "(", ")", "{", "if", "(", "$", "this", "->", "show", ")", "{", "return", ";", "}", "$", "this", "->", "show", "=", "new", "FieldDescriptionCollection", "(", ")", ";", "$", "mapper", "=", "new", "ShowMapper", "(", ...
build the view FieldDescription array.
[ "build", "the", "view", "FieldDescription", "array", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L2888-L2902
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.buildList
protected function buildList() { if ($this->list) { return; } $this->list = $this->getListBuilder()->getBaseList(); $mapper = new ListMapper($this->getListBuilder(), $this->list, $this); if (\count($this->getBatchActions()) > 0 && $this->hasRequest() && !$this-...
php
protected function buildList() { if ($this->list) { return; } $this->list = $this->getListBuilder()->getBaseList(); $mapper = new ListMapper($this->getListBuilder(), $this->list, $this); if (\count($this->getBatchActions()) > 0 && $this->hasRequest() && !$this-...
[ "protected", "function", "buildList", "(", ")", "{", "if", "(", "$", "this", "->", "list", ")", "{", "return", ";", "}", "$", "this", "->", "list", "=", "$", "this", "->", "getListBuilder", "(", ")", "->", "getBaseList", "(", ")", ";", "$", "mapper...
build the list FieldDescription array.
[ "build", "the", "list", "FieldDescription", "array", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L2907-L2962
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.buildForm
protected function buildForm() { if ($this->form) { return; } // append parent object if any // todo : clean the way the Admin class can retrieve set the object if ($this->isChild() && $this->getParentAssociationMapping()) { $parent = $this->getParent...
php
protected function buildForm() { if ($this->form) { return; } // append parent object if any // todo : clean the way the Admin class can retrieve set the object if ($this->isChild() && $this->getParentAssociationMapping()) { $parent = $this->getParent...
[ "protected", "function", "buildForm", "(", ")", "{", "if", "(", "$", "this", "->", "form", ")", "{", "return", ";", "}", "// append parent object if any", "// todo : clean the way the Admin class can retrieve set the object", "if", "(", "$", "this", "->", "isChild", ...
Build the form FieldDescription collection.
[ "Build", "the", "form", "FieldDescription", "collection", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L2967-L2999
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.getSubClass
protected function getSubClass($name) { if ($this->hasSubClass($name)) { return $this->subClasses[$name]; } throw new \RuntimeException(sprintf( 'Unable to find the subclass `%s` for admin `%s`', $name, \get_class($this) )); }
php
protected function getSubClass($name) { if ($this->hasSubClass($name)) { return $this->subClasses[$name]; } throw new \RuntimeException(sprintf( 'Unable to find the subclass `%s` for admin `%s`', $name, \get_class($this) )); }
[ "protected", "function", "getSubClass", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "hasSubClass", "(", "$", "name", ")", ")", "{", "return", "$", "this", "->", "subClasses", "[", "$", "name", "]", ";", "}", "throw", "new", "\\", "Run...
Gets the subclass corresponding to the given name. @param string $name The name of the sub class @return string the subclass
[ "Gets", "the", "subclass", "corresponding", "to", "the", "given", "name", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L3008-L3019
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.attachInlineValidator
protected function attachInlineValidator() { $admin = $this; // add the custom inline validation option $metadata = $this->validator->getMetadataFor($this->getClass()); $metadata->addConstraint(new InlineConstraint([ 'service' => $this, 'method' => static fu...
php
protected function attachInlineValidator() { $admin = $this; // add the custom inline validation option $metadata = $this->validator->getMetadataFor($this->getClass()); $metadata->addConstraint(new InlineConstraint([ 'service' => $this, 'method' => static fu...
[ "protected", "function", "attachInlineValidator", "(", ")", "{", "$", "admin", "=", "$", "this", ";", "// add the custom inline validation option", "$", "metadata", "=", "$", "this", "->", "validator", "->", "getMetadataFor", "(", "$", "this", "->", "getClass", ...
Attach the inline validator to the model metadata, this must be done once per admin.
[ "Attach", "the", "inline", "validator", "to", "the", "model", "metadata", "this", "must", "be", "done", "once", "per", "admin", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L3024-L3050
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.predefinePerPageOptions
protected function predefinePerPageOptions() { array_unshift($this->perPageOptions, $this->maxPerPage); $this->perPageOptions = array_unique($this->perPageOptions); sort($this->perPageOptions); }
php
protected function predefinePerPageOptions() { array_unshift($this->perPageOptions, $this->maxPerPage); $this->perPageOptions = array_unique($this->perPageOptions); sort($this->perPageOptions); }
[ "protected", "function", "predefinePerPageOptions", "(", ")", "{", "array_unshift", "(", "$", "this", "->", "perPageOptions", ",", "$", "this", "->", "maxPerPage", ")", ";", "$", "this", "->", "perPageOptions", "=", "array_unique", "(", "$", "this", "->", "p...
Predefine per page options.
[ "Predefine", "per", "page", "options", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L3055-L3060
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.getAccess
protected function getAccess() { $access = array_merge([ 'acl' => 'MASTER', 'export' => 'EXPORT', 'historyCompareRevisions' => 'EDIT', 'historyViewRevision' => 'EDIT', 'history' => 'EDIT', 'edit' => 'EDIT', 'show' => 'VIEW',...
php
protected function getAccess() { $access = array_merge([ 'acl' => 'MASTER', 'export' => 'EXPORT', 'historyCompareRevisions' => 'EDIT', 'historyViewRevision' => 'EDIT', 'history' => 'EDIT', 'edit' => 'EDIT', 'show' => 'VIEW',...
[ "protected", "function", "getAccess", "(", ")", "{", "$", "access", "=", "array_merge", "(", "[", "'acl'", "=>", "'MASTER'", ",", "'export'", "=>", "'EXPORT'", ",", "'historyCompareRevisions'", "=>", "'EDIT'", ",", "'historyViewRevision'", "=>", "'EDIT'", ",", ...
Return list routes with permissions name. @return array
[ "Return", "list", "routes", "with", "permissions", "name", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L3067-L3091
train
sonata-project/SonataAdminBundle
src/Admin/AbstractAdmin.php
AbstractAdmin.buildRoutes
private function buildRoutes(): void { if ($this->loaded['routes']) { return; } $this->loaded['routes'] = true; $this->routes = new RouteCollection( $this->getBaseCodeRoute(), $this->getBaseRouteName(), $this->getBaseRoutePattern(), ...
php
private function buildRoutes(): void { if ($this->loaded['routes']) { return; } $this->loaded['routes'] = true; $this->routes = new RouteCollection( $this->getBaseCodeRoute(), $this->getBaseRouteName(), $this->getBaseRoutePattern(), ...
[ "private", "function", "buildRoutes", "(", ")", ":", "void", "{", "if", "(", "$", "this", "->", "loaded", "[", "'routes'", "]", ")", "{", "return", ";", "}", "$", "this", "->", "loaded", "[", "'routes'", "]", "=", "true", ";", "$", "this", "->", ...
Build all the related urls to the current admin.
[ "Build", "all", "the", "related", "urls", "to", "the", "current", "admin", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Admin/AbstractAdmin.php#L3103-L3125
train
sonata-project/SonataAdminBundle
src/Route/RouteCollection.php
RouteCollection.actionify
public function actionify($action) { if (false !== ($pos = strrpos($action, '.'))) { $action = substr($action, $pos + 1); } // if this is a service rather than just a controller name, the suffix // Action is not automatically appended to the method name if (false...
php
public function actionify($action) { if (false !== ($pos = strrpos($action, '.'))) { $action = substr($action, $pos + 1); } // if this is a service rather than just a controller name, the suffix // Action is not automatically appended to the method name if (false...
[ "public", "function", "actionify", "(", "$", "action", ")", "{", "if", "(", "false", "!==", "(", "$", "pos", "=", "strrpos", "(", "$", "action", ",", "'.'", ")", ")", ")", "{", "$", "action", "=", "substr", "(", "$", "action", ",", "$", "pos", ...
Convert a word in to the format for a symfony action action_name => actionName. @param string $action Word to actionify @return string Actionified word
[ "Convert", "a", "word", "in", "to", "the", "format", "for", "a", "symfony", "action", "action_name", "=", ">", "actionName", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Route/RouteCollection.php#L237-L250
train
sonata-project/SonataAdminBundle
src/Menu/Provider/GroupMenuProvider.php
GroupMenuProvider.get
public function get($name, array $options = []) { $group = $options['group']; $menuItem = $this->menuFactory->createItem($options['name']); if (empty($group['on_top']) || false === $group['on_top']) { foreach ($group['items'] as $item) { if ($this->canGenerateMe...
php
public function get($name, array $options = []) { $group = $options['group']; $menuItem = $this->menuFactory->createItem($options['name']); if (empty($group['on_top']) || false === $group['on_top']) { foreach ($group['items'] as $item) { if ($this->canGenerateMe...
[ "public", "function", "get", "(", "$", "name", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "group", "=", "$", "options", "[", "'group'", "]", ";", "$", "menuItem", "=", "$", "this", "->", "menuFactory", "->", "createItem", "(", "$",...
Retrieves the menu based on the group options. @param string $name @throws \InvalidArgumentException if the menu does not exists @return \Knp\Menu\ItemInterface
[ "Retrieves", "the", "menu", "based", "on", "the", "group", "options", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Menu/Provider/GroupMenuProvider.php#L82-L112
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.renderWithExtraParams
public function renderWithExtraParams($view, array $parameters = [], Response $response = null) { if (!$this->isXmlHttpRequest()) { $parameters['breadcrumbs_builder'] = $this->get('sonata.admin.breadcrumbs_builder'); } $parameters['admin'] = $parameters['admin'] ?? $t...
php
public function renderWithExtraParams($view, array $parameters = [], Response $response = null) { if (!$this->isXmlHttpRequest()) { $parameters['breadcrumbs_builder'] = $this->get('sonata.admin.breadcrumbs_builder'); } $parameters['admin'] = $parameters['admin'] ?? $t...
[ "public", "function", "renderWithExtraParams", "(", "$", "view", ",", "array", "$", "parameters", "=", "[", "]", ",", "Response", "$", "response", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "isXmlHttpRequest", "(", ")", ")", "{", "$", ...
Renders a view while passing mandatory parameters on to the template. @param string $view The view name @return Response A Response instance
[ "Renders", "a", "view", "while", "passing", "mandatory", "parameters", "on", "to", "the", "template", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L128-L143
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.batchActionDelete
public function batchActionDelete(ProxyQueryInterface $query) { $this->admin->checkAccess('batchDelete'); $modelManager = $this->admin->getModelManager(); try { $modelManager->batchDelete($this->admin->getClass(), $query); $this->addFlash( 'sonata_fl...
php
public function batchActionDelete(ProxyQueryInterface $query) { $this->admin->checkAccess('batchDelete'); $modelManager = $this->admin->getModelManager(); try { $modelManager->batchDelete($this->admin->getClass(), $query); $this->addFlash( 'sonata_fl...
[ "public", "function", "batchActionDelete", "(", "ProxyQueryInterface", "$", "query", ")", "{", "$", "this", "->", "admin", "->", "checkAccess", "(", "'batchDelete'", ")", ";", "$", "modelManager", "=", "$", "this", "->", "admin", "->", "getModelManager", "(", ...
Execute a batch delete. @throws AccessDeniedException If access is not granted @return RedirectResponse
[ "Execute", "a", "batch", "delete", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L195-L216
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.showAction
public function showAction($id = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject($id); if (!$object) { throw $this->createNotFoundException(sprintf('unable to find the object with id: %s', $i...
php
public function showAction($id = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject($id); if (!$object) { throw $this->createNotFoundException(sprintf('unable to find the object with id: %s', $i...
[ "public", "function", "showAction", "(", "$", "id", "=", "null", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$", "id", "=", "$", "request", "->", "get", "(", "$", "this", "->", "admin", "->", "getIdParameter", "(...
Show action. @param int|string|null $id @throws NotFoundHttpException If the object does not exist @throws AccessDeniedException If access is not granted @return Response
[ "Show", "action", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L692-L736
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.historyAction
public function historyAction($id = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject($id); if (!$object) { throw $this->createNotFoundException(sprintf('unable to find the object with id: %s',...
php
public function historyAction($id = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject($id); if (!$object) { throw $this->createNotFoundException(sprintf('unable to find the object with id: %s',...
[ "public", "function", "historyAction", "(", "$", "id", "=", "null", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$", "id", "=", "$", "request", "->", "get", "(", "$", "this", "->", "admin", "->", "getIdParameter", ...
Show history revisions for object. @param int|string|null $id @throws AccessDeniedException If access is not granted @throws NotFoundHttpException If the object does not exist or the audit reader is not available @return Response
[ "Show", "history", "revisions", "for", "object", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L748-L786
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.historyViewRevisionAction
public function historyViewRevisionAction($id = null, $revision = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject($id); if (!$object) { throw $this->createNotFoundException(sprintf('unable to...
php
public function historyViewRevisionAction($id = null, $revision = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject($id); if (!$object) { throw $this->createNotFoundException(sprintf('unable to...
[ "public", "function", "historyViewRevisionAction", "(", "$", "id", "=", "null", ",", "$", "revision", "=", "null", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$", "id", "=", "$", "request", "->", "get", "(", "$", ...
View history revision of object. @param int|string|null $id @param string|null $revision @throws AccessDeniedException If access is not granted @throws NotFoundHttpException If the object or revision does not exist or the audit reader is not available @return Response
[ "View", "history", "revision", "of", "object", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L799-L850
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.historyCompareRevisionsAction
public function historyCompareRevisionsAction($id = null, $base_revision = null, $compare_revision = null) { $request = $this->getRequest(); $this->admin->checkAccess('historyCompareRevisions'); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject...
php
public function historyCompareRevisionsAction($id = null, $base_revision = null, $compare_revision = null) { $request = $this->getRequest(); $this->admin->checkAccess('historyCompareRevisions'); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject...
[ "public", "function", "historyCompareRevisionsAction", "(", "$", "id", "=", "null", ",", "$", "base_revision", "=", "null", ",", "$", "compare_revision", "=", "null", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$", "th...
Compare history revisions of object. @param int|string|null $id @param int|string|null $base_revision @param int|string|null $compare_revision @throws AccessDeniedException If access is not granted @throws NotFoundHttpException If the object or revision does not exist or the audit reader is not available @return Res...
[ "Compare", "history", "revisions", "of", "object", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L864-L929
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.exportAction
public function exportAction(Request $request) { $this->admin->checkAccess('export'); $format = $request->get('format'); // NEXT_MAJOR: remove the check if (!$this->has('sonata.admin.admin_exporter')) { @trigger_error( 'Not registering the exporter bundl...
php
public function exportAction(Request $request) { $this->admin->checkAccess('export'); $format = $request->get('format'); // NEXT_MAJOR: remove the check if (!$this->has('sonata.admin.admin_exporter')) { @trigger_error( 'Not registering the exporter bundl...
[ "public", "function", "exportAction", "(", "Request", "$", "request", ")", "{", "$", "this", "->", "admin", "->", "checkAccess", "(", "'export'", ")", ";", "$", "format", "=", "$", "request", "->", "get", "(", "'format'", ")", ";", "// NEXT_MAJOR: remove t...
Export data to specified format. @throws AccessDeniedException If access is not granted @throws \RuntimeException If the export format is invalid @return Response
[ "Export", "data", "to", "specified", "format", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L939-L985
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.aclAction
public function aclAction($id = null) { $request = $this->getRequest(); if (!$this->admin->isAclEnabled()) { throw $this->createNotFoundException('ACL are not enabled for this admin'); } $id = $request->get($this->admin->getIdParameter()); $object = $this->admi...
php
public function aclAction($id = null) { $request = $this->getRequest(); if (!$this->admin->isAclEnabled()) { throw $this->createNotFoundException('ACL are not enabled for this admin'); } $id = $request->get($this->admin->getIdParameter()); $object = $this->admi...
[ "public", "function", "aclAction", "(", "$", "id", "=", "null", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "this", "->", "admin", "->", "isAclEnabled", "(", ")", ")", "{", "throw", "$", "th...
Returns the Response object associated to the acl action. @param int|string|null $id @throws AccessDeniedException If access is not granted @throws NotFoundHttpException If the object does not exist or the ACL is not enabled @return Response|RedirectResponse
[ "Returns", "the", "Response", "object", "associated", "to", "the", "acl", "action", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L997-L1068
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.getRestMethod
protected function getRestMethod() { $request = $this->getRequest(); if (Request::getHttpMethodParameterOverride() || !$request->request->has('_method')) { return $request->getMethod(); } return $request->request->get('_method'); }
php
protected function getRestMethod() { $request = $this->getRequest(); if (Request::getHttpMethodParameterOverride() || !$request->request->has('_method')) { return $request->getMethod(); } return $request->request->get('_method'); }
[ "protected", "function", "getRestMethod", "(", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "if", "(", "Request", "::", "getHttpMethodParameterOverride", "(", ")", "||", "!", "$", "request", "->", "request", "->", "has", ...
Returns the correct RESTful verb, given either by the request itself or via the "_method" parameter. @return string HTTP method, either
[ "Returns", "the", "correct", "RESTful", "verb", "given", "either", "by", "the", "request", "itself", "or", "via", "the", "_method", "parameter", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L1122-L1131
train
sonata-project/SonataAdminBundle
src/Controller/CRUDController.php
CRUDController.configure
protected function configure() { $request = $this->getRequest(); $adminCode = $request->get('_sonata_admin'); if (!$adminCode) { throw new \RuntimeException(sprintf( 'There is no `_sonata_admin` defined for the controller `%s` and the current route `%s`', ...
php
protected function configure() { $request = $this->getRequest(); $adminCode = $request->get('_sonata_admin'); if (!$adminCode) { throw new \RuntimeException(sprintf( 'There is no `_sonata_admin` defined for the controller `%s` and the current route `%s`', ...
[ "protected", "function", "configure", "(", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$", "adminCode", "=", "$", "request", "->", "get", "(", "'_sonata_admin'", ")", ";", "if", "(", "!", "$", "adminCode", ")", "{"...
Contextualize the admin class depends on the current request. @throws \RuntimeException
[ "Contextualize", "the", "admin", "class", "depends", "on", "the", "current", "request", "." ]
7e5417109126e936800ee1e9f588463af5a7b7cd
https://github.com/sonata-project/SonataAdminBundle/blob/7e5417109126e936800ee1e9f588463af5a7b7cd/src/Controller/CRUDController.php#L1138-L1181
train