id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
188,100
imbo/imbo
src/Image/Transformation/DrawPois.php
DrawPois.drawPoiRectangle
private function drawPoiRectangle($poi, $color, $borderSize, $imageWidth, $imageHeight) { $rect = new ImagickDraw(); $rect->setStrokeColor($color); $rect->setFillColor($color); $rect->setStrokeAntialias(false); $x1 = max(0, $poi['x'] - $borderSize); $x2 = min($imageWidth...
php
private function drawPoiRectangle($poi, $color, $borderSize, $imageWidth, $imageHeight) { $rect = new ImagickDraw(); $rect->setStrokeColor($color); $rect->setFillColor($color); $rect->setStrokeAntialias(false); $x1 = max(0, $poi['x'] - $borderSize); $x2 = min($imageWidth...
[ "private", "function", "drawPoiRectangle", "(", "$", "poi", ",", "$", "color", ",", "$", "borderSize", ",", "$", "imageWidth", ",", "$", "imageHeight", ")", "{", "$", "rect", "=", "new", "ImagickDraw", "(", ")", ";", "$", "rect", "->", "setStrokeColor", ...
Draw rectangle around a POI @param array $poi @param string $color @param integer $borderSize @param integer $imageWidth @param integer $imageHeight
[ "Draw", "rectangle", "around", "a", "POI" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/DrawPois.php#L91-L134
188,101
imbo/imbo
src/Image/Transformation/DrawPois.php
DrawPois.getPoisFromMetadata
private function getPoisFromMetadata() { $metadata = $this->event->getDatabase()->getMetadata( $this->image->getUser(), $this->image->getImageIdentifier() ); return isset($metadata['poi']) ? $metadata['poi'] : []; }
php
private function getPoisFromMetadata() { $metadata = $this->event->getDatabase()->getMetadata( $this->image->getUser(), $this->image->getImageIdentifier() ); return isset($metadata['poi']) ? $metadata['poi'] : []; }
[ "private", "function", "getPoisFromMetadata", "(", ")", "{", "$", "metadata", "=", "$", "this", "->", "event", "->", "getDatabase", "(", ")", "->", "getMetadata", "(", "$", "this", "->", "image", "->", "getUser", "(", ")", ",", "$", "this", "->", "imag...
Fetch POIs from metadata for the image @return array Array with POIs
[ "Fetch", "POIs", "from", "metadata", "for", "the", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/DrawPois.php#L163-L170
188,102
imbo/imbo
src/EventListener/ExifMetadata.php
ExifMetadata.populate
public function populate(EventInterface $event) { $image = $event->getRequest()->getImage(); // Get EXIF-properties from image $imagick = $this->getImagick(); $imagick->readImageBlob($image->getBlob()); $properties = $imagick->getImageProperties(); // Fix trailing space...
php
public function populate(EventInterface $event) { $image = $event->getRequest()->getImage(); // Get EXIF-properties from image $imagick = $this->getImagick(); $imagick->readImageBlob($image->getBlob()); $properties = $imagick->getImageProperties(); // Fix trailing space...
[ "public", "function", "populate", "(", "EventInterface", "$", "event", ")", "{", "$", "image", "=", "$", "event", "->", "getRequest", "(", ")", "->", "getImage", "(", ")", ";", "// Get EXIF-properties from image", "$", "imagick", "=", "$", "this", "->", "g...
Read exif data from incoming image @param EventInterface $event The triggered event @return array
[ "Read", "exif", "data", "from", "incoming", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ExifMetadata.php#L106-L128
188,103
imbo/imbo
src/EventListener/ExifMetadata.php
ExifMetadata.save
public function save(EventInterface $event) { $request = $event->getRequest(); $database = $event->getDatabase(); $user = $request->getUser(); $imageIdentifier = $request->getImage()->getImageIdentifier(); try { $database->updateMetadata( $user, ...
php
public function save(EventInterface $event) { $request = $event->getRequest(); $database = $event->getDatabase(); $user = $request->getUser(); $imageIdentifier = $request->getImage()->getImageIdentifier(); try { $database->updateMetadata( $user, ...
[ "public", "function", "save", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "database", "=", "$", "event", "->", "getDatabase", "(", ")", ";", "$", "user", "=", "$", "request...
Save metadata to database @param EventInterface $event The triggered event @throws RuntimeException
[ "Save", "metadata", "to", "database" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ExifMetadata.php#L136-L154
188,104
imbo/imbo
src/EventListener/ExifMetadata.php
ExifMetadata.filterProperties
protected function filterProperties(array $properties) { $tags = array_fill_keys($this->allowedTags, 1); if (empty($tags) || isset($tags['*'])) { return $properties; } $filtered = []; foreach ($properties as $key => $value) { if (isset($tags[$key])) { ...
php
protected function filterProperties(array $properties) { $tags = array_fill_keys($this->allowedTags, 1); if (empty($tags) || isset($tags['*'])) { return $properties; } $filtered = []; foreach ($properties as $key => $value) { if (isset($tags[$key])) { ...
[ "protected", "function", "filterProperties", "(", "array", "$", "properties", ")", "{", "$", "tags", "=", "array_fill_keys", "(", "$", "this", "->", "allowedTags", ",", "1", ")", ";", "if", "(", "empty", "(", "$", "tags", ")", "||", "isset", "(", "$", ...
Filter out any unwanted properties @param array $properties An array of properties to filter @return array A filtered array of properties
[ "Filter", "out", "any", "unwanted", "properties" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ExifMetadata.php#L162-L188
188,105
imbo/imbo
src/EventListener/ExifMetadata.php
ExifMetadata.parseProperties
protected function parseProperties(array $rawProperties) { if (isset($rawProperties['exif:GPSLatitude']) && isset($rawProperties['exif:GPSLongitude'])) { // We store coordinates in GeoJSON-format (lng/lat) $rawProperties['gps:location'] = [ $this->parseGpsCoo...
php
protected function parseProperties(array $rawProperties) { if (isset($rawProperties['exif:GPSLatitude']) && isset($rawProperties['exif:GPSLongitude'])) { // We store coordinates in GeoJSON-format (lng/lat) $rawProperties['gps:location'] = [ $this->parseGpsCoo...
[ "protected", "function", "parseProperties", "(", "array", "$", "rawProperties", ")", "{", "if", "(", "isset", "(", "$", "rawProperties", "[", "'exif:GPSLatitude'", "]", ")", "&&", "isset", "(", "$", "rawProperties", "[", "'exif:GPSLongitude'", "]", ")", ")", ...
Parse an array of properties into a storable format @param array $rawProperties An array of properties to parse @return array Parsed array of properties
[ "Parse", "an", "array", "of", "properties", "into", "a", "storable", "format" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ExifMetadata.php#L196-L232
188,106
imbo/imbo
src/EventListener/AccessControl.php
AccessControl.subscribe
public function subscribe(EventInterface $event) { $resources = Resource::getAllResources(); if ($this->params['additionalResources']) { $resources = array_merge($resources, $this->params['additionalResources']); } $events = []; foreach ($resources as $resource) { ...
php
public function subscribe(EventInterface $event) { $resources = Resource::getAllResources(); if ($this->params['additionalResources']) { $resources = array_merge($resources, $this->params['additionalResources']); } $events = []; foreach ($resources as $resource) { ...
[ "public", "function", "subscribe", "(", "EventInterface", "$", "event", ")", "{", "$", "resources", "=", "Resource", "::", "getAllResources", "(", ")", ";", "if", "(", "$", "this", "->", "params", "[", "'additionalResources'", "]", ")", "{", "$", "resource...
Figure out which resources we have available and subscribe to them @param EventInterface $event
[ "Figure", "out", "which", "resources", "we", "have", "available", "and", "subscribe", "to", "them" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/AccessControl.php#L92-L106
188,107
imbo/imbo
src/EventListener/AccessControl.php
AccessControl.checkAccess
public function checkAccess(EventInterface $event) { if ($event->hasArgument('skipAccessControl') && $event->getArgument('skipAccessControl') === true) { return; } $request = $event->getRequest(); $aclAdapter = $event->getAccessControl(); $resource = $eve...
php
public function checkAccess(EventInterface $event) { if ($event->hasArgument('skipAccessControl') && $event->getArgument('skipAccessControl') === true) { return; } $request = $event->getRequest(); $aclAdapter = $event->getAccessControl(); $resource = $eve...
[ "public", "function", "checkAccess", "(", "EventInterface", "$", "event", ")", "{", "if", "(", "$", "event", "->", "hasArgument", "(", "'skipAccessControl'", ")", "&&", "$", "event", "->", "getArgument", "(", "'skipAccessControl'", ")", "===", "true", ")", "...
Check if the public key used has access to this resource for this user @param EventInterface $event @throws RuntimeException If public key does not have access to the resource
[ "Check", "if", "the", "public", "key", "used", "has", "access", "to", "this", "resource", "for", "this", "user" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/AccessControl.php#L114-L157
188,108
imbo/imbo
src/EventListener/AccessControl.php
AccessControl.loadGroups
public function loadGroups(EventInterface $event) { $query = new GroupQuery(); $params = $event->getRequest()->query; if ($params->has('page')) { $query->page($params->get('page')); } if ($params->has('limit')) { $query->limit($params->get('limit')); ...
php
public function loadGroups(EventInterface $event) { $query = new GroupQuery(); $params = $event->getRequest()->query; if ($params->has('page')) { $query->page($params->get('page')); } if ($params->has('limit')) { $query->limit($params->get('limit')); ...
[ "public", "function", "loadGroups", "(", "EventInterface", "$", "event", ")", "{", "$", "query", "=", "new", "GroupQuery", "(", ")", ";", "$", "params", "=", "$", "event", "->", "getRequest", "(", ")", "->", "query", ";", "if", "(", "$", "params", "-...
Load groups from the configured access control adapter @param EventInterface $event An event instance
[ "Load", "groups", "from", "the", "configured", "access", "control", "adapter" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/AccessControl.php#L164-L196
188,109
imbo/imbo
src/Resource/AccessRules.php
AccessRules.getRules
public function getRules(EventInterface $event) { $request = $event->getRequest(); $publicKey = $request->getRoute()->get('publickey'); $accessControl = $event->getAccessControl(); $keyExists = $accessControl->publicKeyExists($publicKey); if (!$keyExists) { throw ne...
php
public function getRules(EventInterface $event) { $request = $event->getRequest(); $publicKey = $request->getRoute()->get('publickey'); $accessControl = $event->getAccessControl(); $keyExists = $accessControl->publicKeyExists($publicKey); if (!$keyExists) { throw ne...
[ "public", "function", "getRules", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "publicKey", "=", "$", "request", "->", "getRoute", "(", ")", "->", "get", "(", "'publickey'", "...
Get access rules for the specified public key @param EventInterface $event The current event
[ "Get", "access", "rules", "for", "the", "specified", "public", "key" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/AccessRules.php#L50-L77
188,110
imbo/imbo
src/Resource/AccessRules.php
AccessRules.addRules
public function addRules(EventInterface $event) { $accessControl = $event->getAccessControl(); if (!($accessControl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $pu...
php
public function addRules(EventInterface $event) { $accessControl = $event->getAccessControl(); if (!($accessControl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $pu...
[ "public", "function", "addRules", "(", "EventInterface", "$", "event", ")", "{", "$", "accessControl", "=", "$", "event", "->", "getAccessControl", "(", ")", ";", "if", "(", "!", "(", "$", "accessControl", "instanceof", "MutableAdapterInterface", ")", ")", "...
Add access rules for the specified public key @param EventInterface $event The current event
[ "Add", "access", "rules", "for", "the", "specified", "public", "key" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/AccessRules.php#L84-L115
188,111
imbo/imbo
src/Resource/AccessRules.php
AccessRules.isStringArray
private function isStringArray($values) { if (!is_array($values)) { return false; } return array_reduce($values, function($res, $value) { return $res && is_string($value); }, true); }
php
private function isStringArray($values) { if (!is_array($values)) { return false; } return array_reduce($values, function($res, $value) { return $res && is_string($value); }, true); }
[ "private", "function", "isStringArray", "(", "$", "values", ")", "{", "if", "(", "!", "is_array", "(", "$", "values", ")", ")", "{", "return", "false", ";", "}", "return", "array_reduce", "(", "$", "values", ",", "function", "(", "$", "res", ",", "$"...
Checks if this is an array containing only strings @param Mixed Values to test @return boolean True if all values are strings
[ "Checks", "if", "this", "is", "an", "array", "containing", "only", "strings" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/AccessRules.php#L123-L131
188,112
imbo/imbo
src/Resource/AccessRules.php
AccessRules.validateRule
private function validateRule(EventInterface $event, array $rule) { $acl = $event->getAccessControl(); $allowedProperties = ['resources', 'group', 'users']; $unknownProperties = array_diff(array_keys($rule), $allowedProperties); if (!empty($unknownProperties)) { throw new R...
php
private function validateRule(EventInterface $event, array $rule) { $acl = $event->getAccessControl(); $allowedProperties = ['resources', 'group', 'users']; $unknownProperties = array_diff(array_keys($rule), $allowedProperties); if (!empty($unknownProperties)) { throw new R...
[ "private", "function", "validateRule", "(", "EventInterface", "$", "event", ",", "array", "$", "rule", ")", "{", "$", "acl", "=", "$", "event", "->", "getAccessControl", "(", ")", ";", "$", "allowedProperties", "=", "[", "'resources'", ",", "'group'", ",",...
Validate the contents of an access rule. @param array $rule Access rule to check @throws RuntimeException
[ "Validate", "the", "contents", "of", "an", "access", "rule", "." ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/AccessRules.php#L139-L178
188,113
imbo/imbo
src/EventListener/ImageVariations.php
ImageVariations.chooseVariation
public function chooseVariation(EventInterface $event) { $request = $event->getRequest(); $response = $event->getResponse(); $user = $request->getUser(); $imageIdentifier = $request->getImageIdentifier(); // Fetch the transformations from the request and find the max width used...
php
public function chooseVariation(EventInterface $event) { $request = $event->getRequest(); $response = $event->getResponse(); $user = $request->getUser(); $imageIdentifier = $request->getImageIdentifier(); // Fetch the transformations from the request and find the max width used...
[ "public", "function", "chooseVariation", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ";", "$", "user", "=", "$",...
Choose an image variation based on the transformations and the original size of the image @param EventInterface $event The current event
[ "Choose", "an", "image", "variation", "based", "on", "the", "transformations", "and", "the", "original", "size", "of", "the", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageVariations.php#L105-L186
188,114
imbo/imbo
src/EventListener/ImageVariations.php
ImageVariations.deleteVariations
public function deleteVariations(EventInterface $event) { $request = $event->getRequest(); $user = $request->getUser(); $imageIdentifier = $request->getImageIdentifier(); try { $this->database->deleteImageVariations($user, $imageIdentifier); } catch (DatabaseExceptio...
php
public function deleteVariations(EventInterface $event) { $request = $event->getRequest(); $user = $request->getUser(); $imageIdentifier = $request->getImageIdentifier(); try { $this->database->deleteImageVariations($user, $imageIdentifier); } catch (DatabaseExceptio...
[ "public", "function", "deleteVariations", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "user", "=", "$", "request", "->", "getUser", "(", ")", ";", "$", "imageIdentifier", "=", ...
Delete all image variations attached to an image If any of the delete operations fail Imbo will trigger an error @param EventInterface $event The current event
[ "Delete", "all", "image", "variations", "attached", "to", "an", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageVariations.php#L305-L321
188,115
imbo/imbo
src/EventListener/ImageVariations.php
ImageVariations.configureDatabase
private function configureDatabase(array $config) { if (!isset($config['database']) || !isset($config['database']['adapter'])) { throw new InvalidArgumentException('Missing database adapter configuration for the image variations event listener', 500); } $config = $config['database']...
php
private function configureDatabase(array $config) { if (!isset($config['database']) || !isset($config['database']['adapter'])) { throw new InvalidArgumentException('Missing database adapter configuration for the image variations event listener', 500); } $config = $config['database']...
[ "private", "function", "configureDatabase", "(", "array", "$", "config", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "'database'", "]", ")", "||", "!", "isset", "(", "$", "config", "[", "'database'", "]", "[", "'adapter'", "]", ")", "...
Configure the database adapter @param array $config The event listener configuration @throws InvalidArgumentException
[ "Configure", "the", "database", "adapter" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageVariations.php#L329-L349
188,116
imbo/imbo
src/EventListener/ImageVariations.php
ImageVariations.configureStorage
private function configureStorage(array $config) { if (!isset($config['storage']) || !isset($config['storage']['adapter'])) { throw new InvalidArgumentException('Missing storage adapter configuration for the image variations event listener', 500); } $config = $config['storage']; ...
php
private function configureStorage(array $config) { if (!isset($config['storage']) || !isset($config['storage']['adapter'])) { throw new InvalidArgumentException('Missing storage adapter configuration for the image variations event listener', 500); } $config = $config['storage']; ...
[ "private", "function", "configureStorage", "(", "array", "$", "config", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "'storage'", "]", ")", "||", "!", "isset", "(", "$", "config", "[", "'storage'", "]", "[", "'adapter'", "]", ")", ")",...
Configure the storage adapter @param array $config The event listener configuration @throws InvalidArgumentException
[ "Configure", "the", "storage", "adapter" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageVariations.php#L357-L377
188,117
imbo/imbo
src/EventListener/Authenticate.php
Authenticate.signatureIsValid
private function signatureIsValid($httpMethod, $url, $publicKey, $privateKey, $timestamp, $signature) { // Generate data for the HMAC $data = $httpMethod . '|' . $url . '|' . $publicKey . '|' . $timestamp; // Compare if ($signature === hash_hmac($this->algorithm, $data, $privateKey)) { ...
php
private function signatureIsValid($httpMethod, $url, $publicKey, $privateKey, $timestamp, $signature) { // Generate data for the HMAC $data = $httpMethod . '|' . $url . '|' . $publicKey . '|' . $timestamp; // Compare if ($signature === hash_hmac($this->algorithm, $data, $privateKey)) { ...
[ "private", "function", "signatureIsValid", "(", "$", "httpMethod", ",", "$", "url", ",", "$", "publicKey", ",", "$", "privateKey", ",", "$", "timestamp", ",", "$", "signature", ")", "{", "// Generate data for the HMAC", "$", "data", "=", "$", "httpMethod", "...
Check if the signature is valid @param string $httpMethod The current HTTP method @param string $url The accessed URL @param string $publicKey The current public key @param array $privateKey The private key to sign the hash with @param string $timestamp A valid timestamp @param string $signature The signature to comp...
[ "Check", "if", "the", "signature", "is", "valid" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Authenticate.php#L169-L179
188,118
imbo/imbo
src/EventListener/Authenticate.php
Authenticate.timestampHasExpired
private function timestampHasExpired($timestamp) { $year = substr($timestamp, 0, 4); $month = substr($timestamp, 5, 2); $day = substr($timestamp, 8, 2); $hour = substr($timestamp, 11, 2); $minute = substr($timestamp, 14, 2); $second = substr($timestamp, 17, 2); ...
php
private function timestampHasExpired($timestamp) { $year = substr($timestamp, 0, 4); $month = substr($timestamp, 5, 2); $day = substr($timestamp, 8, 2); $hour = substr($timestamp, 11, 2); $minute = substr($timestamp, 14, 2); $second = substr($timestamp, 17, 2); ...
[ "private", "function", "timestampHasExpired", "(", "$", "timestamp", ")", "{", "$", "year", "=", "substr", "(", "$", "timestamp", ",", "0", ",", "4", ")", ";", "$", "month", "=", "substr", "(", "$", "timestamp", ",", "5", ",", "2", ")", ";", "$", ...
Check if the timestamp has expired @param string $timestamp A valid timestamp @return boolean
[ "Check", "if", "the", "timestamp", "has", "expired" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Authenticate.php#L201-L218
188,119
imbo/imbo
src/EventListener/DatabaseOperations.php
DatabaseOperations.loadUser
public function loadUser(EventInterface $event) { $request = $event->getRequest(); $response = $event->getResponse(); $user = $request->getUser(); $database = $event->getDatabase(); $numImages = $database->getNumImages($user); $lastModified = $database->getLastModified([...
php
public function loadUser(EventInterface $event) { $request = $event->getRequest(); $response = $event->getResponse(); $user = $request->getUser(); $database = $event->getDatabase(); $numImages = $database->getNumImages($user); $lastModified = $database->getLastModified([...
[ "public", "function", "loadUser", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ";", "$", "user", "=", "$", "req...
Load user data @param EventInterface $event An event instance
[ "Load", "user", "data" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/DatabaseOperations.php#L304-L320
188,120
imbo/imbo
src/Image/Transformation/SmartSize.php
SmartSize.calculateCrop
private function calculateCrop(array $parameters, array $imageSize) { $focalX = $parameters['poi'][0]; $focalY = $parameters['poi'][1]; $sourceWidth = $imageSize['width']; $sourceHeight = $imageSize['height']; $sourceRatio = $sourceWidth / $sourceHeight; $targetWidth ...
php
private function calculateCrop(array $parameters, array $imageSize) { $focalX = $parameters['poi'][0]; $focalY = $parameters['poi'][1]; $sourceWidth = $imageSize['width']; $sourceHeight = $imageSize['height']; $sourceRatio = $sourceWidth / $sourceHeight; $targetWidth ...
[ "private", "function", "calculateCrop", "(", "array", "$", "parameters", ",", "array", "$", "imageSize", ")", "{", "$", "focalX", "=", "$", "parameters", "[", "'poi'", "]", "[", "0", "]", ";", "$", "focalY", "=", "$", "parameters", "[", "'poi'", "]", ...
Calculate the coordinates and size of the crop area @param array $parameters @param array $imageSize @return array Crop data
[ "Calculate", "the", "coordinates", "and", "size", "of", "the", "crop", "area" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/SmartSize.php#L69-L127
188,121
imbo/imbo
src/Image/Transformation/SmartSize.php
SmartSize.getPoiFromMetadata
private function getPoiFromMetadata() { if ($this->metadata === null) { $metadata = $this->event->getDatabase()->getMetadata( $this->image->getUser(), $this->image->getImageIdentifier() ); $poi = isset($metadata['poi'][0]) ? $metadata['poi'][0...
php
private function getPoiFromMetadata() { if ($this->metadata === null) { $metadata = $this->event->getDatabase()->getMetadata( $this->image->getUser(), $this->image->getImageIdentifier() ); $poi = isset($metadata['poi'][0]) ? $metadata['poi'][0...
[ "private", "function", "getPoiFromMetadata", "(", ")", "{", "if", "(", "$", "this", "->", "metadata", "===", "null", ")", "{", "$", "metadata", "=", "$", "this", "->", "event", "->", "getDatabase", "(", ")", "->", "getMetadata", "(", "$", "this", "->",...
Fetch POI from metadata for the image @param EventInterface $event @param Image $image @return array|false Array with x and y coordinate, or false if no POI was found
[ "Fetch", "POI", "from", "metadata", "for", "the", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/SmartSize.php#L136-L166
188,122
imbo/imbo
src/Image/Transformation/SmartSize.php
SmartSize.validateParameters
private function validateParameters(array $params) { if (empty($params['width']) || empty($params['height'])) { throw new TransformationException('Both width and height needs to be specified', 400); } // Get POI from transformation params $poi = empty($params['poi']) ? null ...
php
private function validateParameters(array $params) { if (empty($params['width']) || empty($params['height'])) { throw new TransformationException('Both width and height needs to be specified', 400); } // Get POI from transformation params $poi = empty($params['poi']) ? null ...
[ "private", "function", "validateParameters", "(", "array", "$", "params", ")", "{", "if", "(", "empty", "(", "$", "params", "[", "'width'", "]", ")", "||", "empty", "(", "$", "params", "[", "'height'", "]", ")", ")", "{", "throw", "new", "Transformatio...
Validate parameters and return a normalized parameter array @param array $params @return array @throws TransformationException Thrown on invalid or missing parameters
[ "Validate", "parameters", "and", "return", "a", "normalized", "parameter", "array" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/SmartSize.php#L246-L277
188,123
imbo/imbo
src/Helpers/Urls.php
Urls.buildFromParseUrlParts
public static function buildFromParseUrlParts(array $parts) { $url = ''; $url .= isset($parts['scheme']) ? $parts['scheme'] : 'http'; $url .= '://'; if (isset($parts['user'])) { $url .= $parts['user']; if (isset($parts['pass'])) { $url .= ':' . ...
php
public static function buildFromParseUrlParts(array $parts) { $url = ''; $url .= isset($parts['scheme']) ? $parts['scheme'] : 'http'; $url .= '://'; if (isset($parts['user'])) { $url .= $parts['user']; if (isset($parts['pass'])) { $url .= ':' . ...
[ "public", "static", "function", "buildFromParseUrlParts", "(", "array", "$", "parts", ")", "{", "$", "url", "=", "''", ";", "$", "url", ".=", "isset", "(", "$", "parts", "[", "'scheme'", "]", ")", "?", "$", "parts", "[", "'scheme'", "]", ":", "'http'...
Generate a URL from an array with similar structure as returned from parse_url. @param array $parts An array in the format produced from parse_url @return string
[ "Generate", "a", "URL", "from", "an", "array", "with", "similar", "structure", "as", "returned", "from", "parse_url", "." ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Helpers/Urls.php#L26-L49
188,124
imbo/imbo
src/Resource/ShortUrls.php
ShortUrls.createShortUrl
public function createShortUrl(EventInterface $event) { $request = $event->getRequest(); $image = $request->getContent(); if (empty($image)) { throw new InvalidArgumentException('Missing JSON data', 400); } else { $image = json_decode($image, true); ...
php
public function createShortUrl(EventInterface $event) { $request = $event->getRequest(); $image = $request->getContent(); if (empty($image)) { throw new InvalidArgumentException('Missing JSON data', 400); } else { $image = json_decode($image, true); ...
[ "public", "function", "createShortUrl", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "image", "=", "$", "request", "->", "getContent", "(", ")", ";", "if", "(", "empty", "(", ...
Add a short URL to the database @param EventInterface $event
[ "Add", "a", "short", "URL", "to", "the", "database" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/ShortUrls.php#L51-L119
188,125
imbo/imbo
src/Resource/ShortUrls.php
ShortUrls.deleteImageShortUrls
public function deleteImageShortUrls(EventInterface $event) { $request = $event->getRequest(); $user = $request->getUser(); $imageIdentifier = $request->getImageIdentifier(); $event->getDatabase()->deleteShortUrls( $user, $imageIdentifier ); if (...
php
public function deleteImageShortUrls(EventInterface $event) { $request = $event->getRequest(); $user = $request->getUser(); $imageIdentifier = $request->getImageIdentifier(); $event->getDatabase()->deleteShortUrls( $user, $imageIdentifier ); if (...
[ "public", "function", "deleteImageShortUrls", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "user", "=", "$", "request", "->", "getUser", "(", ")", ";", "$", "imageIdentifier", "...
Delete all short URLs for a given image @param EventInterface $event
[ "Delete", "all", "short", "URLs", "for", "a", "given", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/ShortUrls.php#L126-L147
188,126
imbo/imbo
src/Resource/ShortUrls.php
ShortUrls.getShortUrlId
private function getShortUrlId($len = 7) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; $charsLen = 62; $key = ''; for ($i = 0; $i < $len; $i++) { $key .= $chars[mt_rand() % $charsLen]; } return $key; }
php
private function getShortUrlId($len = 7) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; $charsLen = 62; $key = ''; for ($i = 0; $i < $len; $i++) { $key .= $chars[mt_rand() % $charsLen]; } return $key; }
[ "private", "function", "getShortUrlId", "(", "$", "len", "=", "7", ")", "{", "$", "chars", "=", "'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'", ";", "$", "charsLen", "=", "62", ";", "$", "key", "=", "''", ";", "for", "(", "$", "i", "=", ...
Method for generating short URL keys @return string
[ "Method", "for", "generating", "short", "URL", "keys" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/ShortUrls.php#L154-L164
188,127
imbo/imbo
src/Resource/AccessRule.php
AccessRule.getRule
public function getRule(EventInterface $event) { $acl = $event->getAccessControl(); $request = $event->getRequest(); $publicKey = $request->getRoute()->get('publickey'); $accessRuleId = $request->getRoute()->get('accessRuleId'); $keyExists = $acl->publicKeyExists($publicKey); ...
php
public function getRule(EventInterface $event) { $acl = $event->getAccessControl(); $request = $event->getRequest(); $publicKey = $request->getRoute()->get('publickey'); $accessRuleId = $request->getRoute()->get('accessRuleId'); $keyExists = $acl->publicKeyExists($publicKey); ...
[ "public", "function", "getRule", "(", "EventInterface", "$", "event", ")", "{", "$", "acl", "=", "$", "event", "->", "getAccessControl", "(", ")", ";", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "publicKey", "=", "$", ...
Get an access control rule specified by ID @param EventInterface $event The current event
[ "Get", "an", "access", "control", "rule", "specified", "by", "ID" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/AccessRule.php#L49-L81
188,128
imbo/imbo
src/Resource/AccessRule.php
AccessRule.deleteRule
public function deleteRule(EventInterface $event) { $acl = $event->getAccessControl(); if (!($acl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $publicKey = $request...
php
public function deleteRule(EventInterface $event) { $acl = $event->getAccessControl(); if (!($acl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $publicKey = $request...
[ "public", "function", "deleteRule", "(", "EventInterface", "$", "event", ")", "{", "$", "acl", "=", "$", "event", "->", "getAccessControl", "(", ")", ";", "if", "(", "!", "(", "$", "acl", "instanceof", "MutableAdapterInterface", ")", ")", "{", "throw", "...
Delete the specified access control rule @param EventInterface $event The current event
[ "Delete", "the", "specified", "access", "control", "rule" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/AccessRule.php#L88-L112
188,129
imbo/imbo
src/Auth/AccessControl/Adapter/SimpleArrayAdapter.php
SimpleArrayAdapter.getExpandedAclList
public function getExpandedAclList(array $accessList) { $entries = []; foreach ($accessList as $publicKey => $privateKey) { if (is_array($privateKey)) { throw new InvalidArgumentException('A public key can only have a single private key (as of 2.0.0)'); } ...
php
public function getExpandedAclList(array $accessList) { $entries = []; foreach ($accessList as $publicKey => $privateKey) { if (is_array($privateKey)) { throw new InvalidArgumentException('A public key can only have a single private key (as of 2.0.0)'); } ...
[ "public", "function", "getExpandedAclList", "(", "array", "$", "accessList", ")", "{", "$", "entries", "=", "[", "]", ";", "foreach", "(", "$", "accessList", "as", "$", "publicKey", "=>", "$", "privateKey", ")", "{", "if", "(", "is_array", "(", "$", "p...
Converts public => private key pairs into the array format accepted by ArrayAdapter @param array $accessList
[ "Converts", "public", "=", ">", "private", "key", "pairs", "into", "the", "array", "format", "accepted", "by", "ArrayAdapter" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Auth/AccessControl/Adapter/SimpleArrayAdapter.php#L46-L65
188,130
imbo/imbo
src/EventListener/StatsAccess.php
StatsAccess.isAllowed
private function isAllowed($ip) { // Look for a wildcard if (in_array('*', $this->params['allow'])) { // There is a wildcard in the list, all IP's are allowed return true; } // Remove IP's which is not of the same type as $ip before matching if ($this->is...
php
private function isAllowed($ip) { // Look for a wildcard if (in_array('*', $this->params['allow'])) { // There is a wildcard in the list, all IP's are allowed return true; } // Remove IP's which is not of the same type as $ip before matching if ($this->is...
[ "private", "function", "isAllowed", "(", "$", "ip", ")", "{", "// Look for a wildcard", "if", "(", "in_array", "(", "'*'", ",", "$", "this", "->", "params", "[", "'allow'", "]", ")", ")", "{", "// There is a wildcard in the list, all IP's are allowed", "return", ...
See if an IP address is allowed @param string $ip An IP address @return boolean
[ "See", "if", "an", "IP", "address", "is", "allowed" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/StatsAccess.php#L87-L108
188,131
imbo/imbo
src/EventListener/StatsAccess.php
StatsAccess.cidrMatch
private function cidrMatch($ip, $range) { if ($this->isIPv6($ip)) { return $this->cidr6Match($ip, $range); } else { return $this->cidr4Match($ip, $range); } }
php
private function cidrMatch($ip, $range) { if ($this->isIPv6($ip)) { return $this->cidr6Match($ip, $range); } else { return $this->cidr4Match($ip, $range); } }
[ "private", "function", "cidrMatch", "(", "$", "ip", ",", "$", "range", ")", "{", "if", "(", "$", "this", "->", "isIPv6", "(", "$", "ip", ")", ")", "{", "return", "$", "this", "->", "cidr6Match", "(", "$", "ip", ",", "$", "range", ")", ";", "}",...
Check if an IP address is in a subnet @param string $ip The IP address to check @param string $range A CIDR notated IP address and routing prefix @return boolean
[ "Check", "if", "an", "IP", "address", "is", "in", "a", "subnet" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/StatsAccess.php#L117-L123
188,132
imbo/imbo
src/EventListener/StatsAccess.php
StatsAccess.cidr6Match
private function cidr6Match($ip, $range) { // Split CIDR on / list($subnet, $mask) = explode('/', $range); // Convert IP's to their in_addr representations $ip = inet_pton($ip); $subnet = inet_pton($subnet); // Convert the mask $mask = $this->getBinaryMask((int)...
php
private function cidr6Match($ip, $range) { // Split CIDR on / list($subnet, $mask) = explode('/', $range); // Convert IP's to their in_addr representations $ip = inet_pton($ip); $subnet = inet_pton($subnet); // Convert the mask $mask = $this->getBinaryMask((int)...
[ "private", "function", "cidr6Match", "(", "$", "ip", ",", "$", "range", ")", "{", "// Split CIDR on /", "list", "(", "$", "subnet", ",", "$", "mask", ")", "=", "explode", "(", "'/'", ",", "$", "range", ")", ";", "// Convert IP's to their in_addr representati...
Check an IPv6 address is in a subnet @param string $ip The IP address to check (for instance 2001:db8:0:0:0:0:0:0) @param string $range A CIDR notated IP address and routing prefix (for instance 2001:db8::/48) @return boolean
[ "Check", "an", "IPv6", "address", "is", "in", "a", "subnet" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/StatsAccess.php#L155-L167
188,133
imbo/imbo
src/EventListener/StatsAccess.php
StatsAccess.getBinaryMask
private function getBinaryMask($mask) { // Prefix the string $hexMask = str_repeat('f', $mask / 4); // Add the remainder switch ($mask % 4) { case 1: $hexMask .= '8'; break; case 2: $hexMask .= 'c'; ...
php
private function getBinaryMask($mask) { // Prefix the string $hexMask = str_repeat('f', $mask / 4); // Add the remainder switch ($mask % 4) { case 1: $hexMask .= '8'; break; case 2: $hexMask .= 'c'; ...
[ "private", "function", "getBinaryMask", "(", "$", "mask", ")", "{", "// Prefix the string", "$", "hexMask", "=", "str_repeat", "(", "'f'", ",", "$", "mask", "/", "4", ")", ";", "// Add the remainder", "switch", "(", "$", "mask", "%", "4", ")", "{", "case...
Fetch the binary representation of a mask @param int $mask A mask from a CIDR @return string
[ "Fetch", "the", "binary", "representation", "of", "a", "mask" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/StatsAccess.php#L175-L197
188,134
imbo/imbo
src/EventListener/StatsAccess.php
StatsAccess.expandIPv6
private function expandIPv6($ip) { // Convert to in_addr an unpack as hex $hex = strtolower(bin2hex(inet_pton($ip))); // Inject colons return substr(preg_replace('/([a-f0-9]{4})/', '$1:', $hex), 0, -1); }
php
private function expandIPv6($ip) { // Convert to in_addr an unpack as hex $hex = strtolower(bin2hex(inet_pton($ip))); // Inject colons return substr(preg_replace('/([a-f0-9]{4})/', '$1:', $hex), 0, -1); }
[ "private", "function", "expandIPv6", "(", "$", "ip", ")", "{", "// Convert to in_addr an unpack as hex", "$", "hex", "=", "strtolower", "(", "bin2hex", "(", "inet_pton", "(", "$", "ip", ")", ")", ")", ";", "// Inject colons", "return", "substr", "(", "preg_rep...
Expand a short IPv6 @param string $ip For instance 2a00:1b60:1011::1338 @return string 2a00:1b60:1011:0000:0000:0000:0000:1338
[ "Expand", "a", "short", "IPv6" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/StatsAccess.php#L225-L231
188,135
imbo/imbo
src/EventListener/StatsAccess.php
StatsAccess.expandIPv6InFilters
private function expandIPv6InFilters(&$ip) { if ($this->isIPv6($ip)) { if (($pos = strpos($ip, '/')) !== false) { // The IPv6 has a routing prefix attached to it $mask = substr($ip, $pos); $ip = $this->expandIPv6(substr($ip, 0, $pos)) . $mask; ...
php
private function expandIPv6InFilters(&$ip) { if ($this->isIPv6($ip)) { if (($pos = strpos($ip, '/')) !== false) { // The IPv6 has a routing prefix attached to it $mask = substr($ip, $pos); $ip = $this->expandIPv6(substr($ip, 0, $pos)) . $mask; ...
[ "private", "function", "expandIPv6InFilters", "(", "&", "$", "ip", ")", "{", "if", "(", "$", "this", "->", "isIPv6", "(", "$", "ip", ")", ")", "{", "if", "(", "(", "$", "pos", "=", "strpos", "(", "$", "ip", ",", "'/'", ")", ")", "!==", "false",...
Expand all IPv6 addresses in a filter @param string $ip An IP address that might be expanded
[ "Expand", "all", "IPv6", "addresses", "in", "a", "filter" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/StatsAccess.php#L238-L249
188,136
imbo/imbo
src/EventListener/LoaderOutputConverterImagick.php
LoaderOutputConverterImagick.populateImagickInstance
public function populateImagickInstance(EventInterface $event) { $event->getInputLoaderManager()->setImagick($this->imagick); $event->getOutputConverterManager()->setImagick($this->imagick); }
php
public function populateImagickInstance(EventInterface $event) { $event->getInputLoaderManager()->setImagick($this->imagick); $event->getOutputConverterManager()->setImagick($this->imagick); }
[ "public", "function", "populateImagickInstance", "(", "EventInterface", "$", "event", ")", "{", "$", "event", "->", "getInputLoaderManager", "(", ")", "->", "setImagick", "(", "$", "this", "->", "imagick", ")", ";", "$", "event", "->", "getOutputConverterManager...
Set the Imagick instance in the loader manager and the output converter manager @param EventInterface $event
[ "Set", "the", "Imagick", "instance", "in", "the", "loader", "manager", "and", "the", "output", "converter", "manager" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/LoaderOutputConverterImagick.php#L50-L53
188,137
imbo/imbo
src/Router.php
Router.route
public function route(Request $request) { $httpMethod = $request->getMethod(); if ($httpMethod === 'BREW') { throw new RuntimeException('I\'m a teapot!', 418); } if (!isset(self::$supportedHttpMethods[$httpMethod])) { throw new RuntimeException('Unsupported HTTP...
php
public function route(Request $request) { $httpMethod = $request->getMethod(); if ($httpMethod === 'BREW') { throw new RuntimeException('I\'m a teapot!', 418); } if (!isset(self::$supportedHttpMethods[$httpMethod])) { throw new RuntimeException('Unsupported HTTP...
[ "public", "function", "route", "(", "Request", "$", "request", ")", "{", "$", "httpMethod", "=", "$", "request", "->", "getMethod", "(", ")", ";", "if", "(", "$", "httpMethod", "===", "'BREW'", ")", "{", "throw", "new", "RuntimeException", "(", "'I\\'m a...
Route the current request @param Request $request The current request
[ "Route", "the", "current", "request" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Router.php#L77-L115
188,138
imbo/imbo
src/EventListener/Cors.php
Cors.subscribe
public function subscribe(EventInterface $event) { $events = []; // Enable the event listener only for resources and methods specified foreach ($this->params['allowedMethods'] as $resource => $methods) { foreach ($methods as $method) { $eventName = $resource . '.' . ...
php
public function subscribe(EventInterface $event) { $events = []; // Enable the event listener only for resources and methods specified foreach ($this->params['allowedMethods'] as $resource => $methods) { foreach ($methods as $method) { $eventName = $resource . '.' . ...
[ "public", "function", "subscribe", "(", "EventInterface", "$", "event", ")", "{", "$", "events", "=", "[", "]", ";", "// Enable the event listener only for resources and methods specified", "foreach", "(", "$", "this", "->", "params", "[", "'allowedMethods'", "]", "...
Subscribe to events based on configuration parameters @param EventInterface $event The event instance
[ "Subscribe", "to", "events", "based", "on", "configuration", "parameters" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Cors.php#L88-L108
188,139
imbo/imbo
src/EventListener/Cors.php
Cors.setExposedHeaders
public function setExposedHeaders(EventInterface $event) { // If this request was disallowed, don't expose any headers if (!$this->requestAllowed) { return; } $headers = [ // The ResponseSender-listener will add this header and send the response, // s...
php
public function setExposedHeaders(EventInterface $event) { // If this request was disallowed, don't expose any headers if (!$this->requestAllowed) { return; } $headers = [ // The ResponseSender-listener will add this header and send the response, // s...
[ "public", "function", "setExposedHeaders", "(", "EventInterface", "$", "event", ")", "{", "// If this request was disallowed, don't expose any headers", "if", "(", "!", "$", "this", "->", "requestAllowed", ")", "{", "return", ";", "}", "$", "headers", "=", "[", "/...
Right before the response is sent to the client, whitelist all included Imbo-headers in the "Access-Control-Expose-Headers"-header @param EventInterface $event The event instance
[ "Right", "before", "the", "response", "is", "sent", "to", "the", "client", "whitelist", "all", "included", "Imbo", "-", "headers", "in", "the", "Access", "-", "Control", "-", "Expose", "-", "Headers", "-", "header" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Cors.php#L116-L137
188,140
imbo/imbo
src/EventListener/Cors.php
Cors.options
public function options(EventInterface $event) { $request = $event->getRequest(); $response = $event->getResponse(); $origin = $request->headers->get('Origin'); // This is an OPTIONS request, send 204 since no more content will follow $response->setStatusCode(204); // V...
php
public function options(EventInterface $event) { $request = $event->getRequest(); $response = $event->getResponse(); $origin = $request->headers->get('Origin'); // This is an OPTIONS request, send 204 since no more content will follow $response->setStatusCode(204); // V...
[ "public", "function", "options", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ";", "$", "origin", "=", "$", "re...
Handle the OPTIONS requests @param EventInterface $event The event instance
[ "Handle", "the", "OPTIONS", "requests" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Cors.php#L144-L188
188,141
imbo/imbo
src/EventListener/Cors.php
Cors.invoke
public function invoke(EventInterface $event) { $request = $event->getRequest(); $resource = (string) $request->getRoute(); $method = $request->getMethod(); $allowed = $this->params['allowedMethods']; if (!isset($allowed[$resource]) || !in_array($method, $allowed[$resource])) { ...
php
public function invoke(EventInterface $event) { $request = $event->getRequest(); $resource = (string) $request->getRoute(); $method = $request->getMethod(); $allowed = $this->params['allowedMethods']; if (!isset($allowed[$resource]) || !in_array($method, $allowed[$resource])) { ...
[ "public", "function", "invoke", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "resource", "=", "(", "string", ")", "$", "request", "->", "getRoute", "(", ")", ";", "$", "meth...
Handle other requests @param EventInterface $event The event instance
[ "Handle", "other", "requests" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Cors.php#L195-L222
188,142
imbo/imbo
src/EventListener/Cors.php
Cors.originIsAllowed
private function originIsAllowed($origin) { // Global wildcard defined? if (in_array('*', $this->params['allowedOrigins'])) { return true; } // Origin defined? if (in_array($origin, $this->params['allowedOrigins'])) { return true; } retur...
php
private function originIsAllowed($origin) { // Global wildcard defined? if (in_array('*', $this->params['allowedOrigins'])) { return true; } // Origin defined? if (in_array($origin, $this->params['allowedOrigins'])) { return true; } retur...
[ "private", "function", "originIsAllowed", "(", "$", "origin", ")", "{", "// Global wildcard defined?", "if", "(", "in_array", "(", "'*'", ",", "$", "this", "->", "params", "[", "'allowedOrigins'", "]", ")", ")", "{", "return", "true", ";", "}", "// Origin de...
Check if the given origin is defined as an allowed origin @param string $origin Origin to validate @return boolean True if allowed, false otherwise
[ "Check", "if", "the", "given", "origin", "is", "defined", "as", "an", "allowed", "origin" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Cors.php#L239-L251
188,143
imbo/imbo
src/Image/Transformation/Blur.php
Blur.checkRequiredParams
private function checkRequiredParams(array $params, array $required) { foreach ($required as $param) { if (!isset($params[$param])) { throw new TransformationException('Missing required parameter: ' . $param, 400); } } }
php
private function checkRequiredParams(array $params, array $required) { foreach ($required as $param) { if (!isset($params[$param])) { throw new TransformationException('Missing required parameter: ' . $param, 400); } } }
[ "private", "function", "checkRequiredParams", "(", "array", "$", "params", ",", "array", "$", "required", ")", "{", "foreach", "(", "$", "required", "as", "$", "param", ")", "{", "if", "(", "!", "isset", "(", "$", "params", "[", "$", "param", "]", ")...
Check that all params are present @param array $params Transformation parameter list @param array $required Array with required parameters @throws TransformationException
[ "Check", "that", "all", "params", "are", "present" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/Blur.php#L57-L63
188,144
imbo/imbo
src/Image/Transformation/Blur.php
Blur.blur
private function blur(array $params, $adaptive = false) { $this->checkRequiredParams($params, ['radius', 'sigma']); $radius = (float) $params['radius']; $sigma = (float) $params['sigma']; try { if ($adaptive) { $this->imagick->adaptiveBlurImage($radius, $sig...
php
private function blur(array $params, $adaptive = false) { $this->checkRequiredParams($params, ['radius', 'sigma']); $radius = (float) $params['radius']; $sigma = (float) $params['sigma']; try { if ($adaptive) { $this->imagick->adaptiveBlurImage($radius, $sig...
[ "private", "function", "blur", "(", "array", "$", "params", ",", "$", "adaptive", "=", "false", ")", "{", "$", "this", "->", "checkRequiredParams", "(", "$", "params", ",", "[", "'radius'", ",", "'sigma'", "]", ")", ";", "$", "radius", "=", "(", "flo...
Add Gaussian or adaptive blur to the image @param array $params The transformation parameters @param bool $adaptive Perform adaptive blur or not
[ "Add", "Gaussian", "or", "adaptive", "blur", "to", "the", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/Blur.php#L71-L88
188,145
imbo/imbo
src/Image/Transformation/Blur.php
Blur.motionBlur
private function motionBlur(array $params) { $this->checkRequiredParams($params, ['radius', 'sigma', 'angle']); $radius = (float) $params['radius']; $sigma = (float) $params['sigma']; $angle = (float) $params['angle']; try { $this->imagick->motionBlurImage($radius, ...
php
private function motionBlur(array $params) { $this->checkRequiredParams($params, ['radius', 'sigma', 'angle']); $radius = (float) $params['radius']; $sigma = (float) $params['sigma']; $angle = (float) $params['angle']; try { $this->imagick->motionBlurImage($radius, ...
[ "private", "function", "motionBlur", "(", "array", "$", "params", ")", "{", "$", "this", "->", "checkRequiredParams", "(", "$", "params", ",", "[", "'radius'", ",", "'sigma'", ",", "'angle'", "]", ")", ";", "$", "radius", "=", "(", "float", ")", "$", ...
Add motion blur to the image @param array $params The transformation parameters
[ "Add", "motion", "blur", "to", "the", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/Blur.php#L95-L109
188,146
imbo/imbo
src/Image/Transformation/Blur.php
Blur.radialBlur
private function radialBlur(array $params) { $this->checkRequiredParams($params, ['angle']); $angle = (float) $params['angle']; try { $this->imagick->radialBlurImage($angle); } catch (ImagickException $e) { throw new TransformationException($e->getMessage(), 400...
php
private function radialBlur(array $params) { $this->checkRequiredParams($params, ['angle']); $angle = (float) $params['angle']; try { $this->imagick->radialBlurImage($angle); } catch (ImagickException $e) { throw new TransformationException($e->getMessage(), 400...
[ "private", "function", "radialBlur", "(", "array", "$", "params", ")", "{", "$", "this", "->", "checkRequiredParams", "(", "$", "params", ",", "[", "'angle'", "]", ")", ";", "$", "angle", "=", "(", "float", ")", "$", "params", "[", "'angle'", "]", ";...
Add radial blur to the image @param array $params The transformation parameters
[ "Add", "radial", "blur", "to", "the", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/Blur.php#L116-L128
188,147
imbo/imbo
src/EventListener/ImageTransformationLimiter.php
ImageTransformationLimiter.checkTransformationCount
public function checkTransformationCount(EventInterface $event) { $transformations = $event->getRequest()->getTransformations(); if ($this->transformationLimit && (count($transformations) > $this->transformationLimit)) { throw new ResourceException('Too many transformations applied to resou...
php
public function checkTransformationCount(EventInterface $event) { $transformations = $event->getRequest()->getTransformations(); if ($this->transformationLimit && (count($transformations) > $this->transformationLimit)) { throw new ResourceException('Too many transformations applied to resou...
[ "public", "function", "checkTransformationCount", "(", "EventInterface", "$", "event", ")", "{", "$", "transformations", "=", "$", "event", "->", "getRequest", "(", ")", "->", "getTransformations", "(", ")", ";", "if", "(", "$", "this", "->", "transformationLi...
Check the number of transformations in a request and generate a 403 if there's an excessive number of transformations. @param EventInterface $event The triggered event @throws ResourceException Throws an exception if the transformation count exceeds the allowed value.
[ "Check", "the", "number", "of", "transformations", "in", "a", "request", "and", "generate", "a", "403", "if", "there", "s", "an", "excessive", "number", "of", "transformations", "." ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageTransformationLimiter.php#L66-L73
188,148
imbo/imbo
src/Helpers/BSONToArray.php
BSONToArray.toArray
public function toArray($document) { if ($this->isBSONModel($document)) { // If the document is a BSON model, get the array copy first $document = $document->getArrayCopy(); } else if (!is_array($document)) { // The variable to convert is not an array, simply return i...
php
public function toArray($document) { if ($this->isBSONModel($document)) { // If the document is a BSON model, get the array copy first $document = $document->getArrayCopy(); } else if (!is_array($document)) { // The variable to convert is not an array, simply return i...
[ "public", "function", "toArray", "(", "$", "document", ")", "{", "if", "(", "$", "this", "->", "isBSONModel", "(", "$", "document", ")", ")", "{", "// If the document is a BSON model, get the array copy first", "$", "document", "=", "$", "document", "->", "getAr...
Convert to array, recursively @param array|BSONDocument|BSONArray $document @return mixed
[ "Convert", "to", "array", "recursively" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Helpers/BSONToArray.php#L29-L51
188,149
imbo/imbo
src/Image/OutputConverterManager.php
OutputConverterManager.addConverters
public function addConverters(array $converters) { foreach ($converters as $converter) { if (is_string($converter)) { $converter = new $converter(); } if (!$converter instanceof OutputConverterInterface) { $name = is_object($converter) ? get_c...
php
public function addConverters(array $converters) { foreach ($converters as $converter) { if (is_string($converter)) { $converter = new $converter(); } if (!$converter instanceof OutputConverterInterface) { $name = is_object($converter) ? get_c...
[ "public", "function", "addConverters", "(", "array", "$", "converters", ")", "{", "foreach", "(", "$", "converters", "as", "$", "converter", ")", "{", "if", "(", "is_string", "(", "$", "converter", ")", ")", "{", "$", "converter", "=", "new", "$", "con...
Add a list of converters to the available output converters. @param array $converters A list of objects or object names (strings) implementing `OutputConverterInterface`. @return self
[ "Add", "a", "list", "of", "converters", "to", "the", "available", "output", "converters", "." ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/OutputConverterManager.php#L61-L76
188,150
imbo/imbo
src/Image/OutputConverterManager.php
OutputConverterManager.registerConverter
public function registerConverter(OutputConverterInterface $converter) { foreach ($converter->getSupportedMimeTypes() as $mimeType => $extensions) { if (!is_array($extensions)) { $extensions = [$extensions]; } if (!isset($this->convertersByMimeType[$mimeType]...
php
public function registerConverter(OutputConverterInterface $converter) { foreach ($converter->getSupportedMimeTypes() as $mimeType => $extensions) { if (!is_array($extensions)) { $extensions = [$extensions]; } if (!isset($this->convertersByMimeType[$mimeType]...
[ "public", "function", "registerConverter", "(", "OutputConverterInterface", "$", "converter", ")", "{", "foreach", "(", "$", "converter", "->", "getSupportedMimeTypes", "(", ")", "as", "$", "mimeType", "=>", "$", "extensions", ")", "{", "if", "(", "!", "is_arr...
Register a single output converter with the manager to make it available inside Imbo. @param OutputConverterInterface $converter The converter to register @return self
[ "Register", "a", "single", "output", "converter", "with", "the", "manager", "to", "make", "it", "available", "inside", "Imbo", "." ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/OutputConverterManager.php#L84-L114
188,151
imbo/imbo
src/Image/OutputConverterManager.php
OutputConverterManager.getMimeTypeFromExtension
public function getMimeTypeFromExtension($extension) { return isset($this->extensionToMimeType[$extension]) ? $this->extensionToMimeType[$extension] : null; }
php
public function getMimeTypeFromExtension($extension) { return isset($this->extensionToMimeType[$extension]) ? $this->extensionToMimeType[$extension] : null; }
[ "public", "function", "getMimeTypeFromExtension", "(", "$", "extension", ")", "{", "return", "isset", "(", "$", "this", "->", "extensionToMimeType", "[", "$", "extension", "]", ")", "?", "$", "this", "->", "extensionToMimeType", "[", "$", "extension", "]", "...
Look up the mime type of a given extension. @param string $extension The extension to look up the mime type for @return string|null
[ "Look", "up", "the", "mime", "type", "of", "a", "given", "extension", "." ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/OutputConverterManager.php#L174-L176
188,152
imbo/imbo
src/Image/OutputConverterManager.php
OutputConverterManager.getExtensionFromMimeType
public function getExtensionFromMimeType($mimeType) { return isset($this->mimeTypeToExtension[$mimeType]) ? $this->mimeTypeToExtension[$mimeType] : null; }
php
public function getExtensionFromMimeType($mimeType) { return isset($this->mimeTypeToExtension[$mimeType]) ? $this->mimeTypeToExtension[$mimeType] : null; }
[ "public", "function", "getExtensionFromMimeType", "(", "$", "mimeType", ")", "{", "return", "isset", "(", "$", "this", "->", "mimeTypeToExtension", "[", "$", "mimeType", "]", ")", "?", "$", "this", "->", "mimeTypeToExtension", "[", "$", "mimeType", "]", ":",...
Look up the extension for a given mime type. @param string $mimeType The mime type to look up the extension for. @return string|null Returns the first registered mime type for a given extension
[ "Look", "up", "the", "extension", "for", "a", "given", "mime", "type", "." ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/OutputConverterManager.php#L184-L186
188,153
imbo/imbo
src/CliCommand/AddPublicKey.php
AddPublicKey.askForResources
private function askForResources(InputInterface $input, OutputInterface $output) { $question = new ChoiceQuestion( 'Which resources should the public key have access to? ', [ self::RESOURCES_READ_ONLY, self::RESOURCES_READ_WRITE, self::RESO...
php
private function askForResources(InputInterface $input, OutputInterface $output) { $question = new ChoiceQuestion( 'Which resources should the public key have access to? ', [ self::RESOURCES_READ_ONLY, self::RESOURCES_READ_WRITE, self::RESO...
[ "private", "function", "askForResources", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "question", "=", "new", "ChoiceQuestion", "(", "'Which resources should the public key have access to? '", ",", "[", "self", "::", "RES...
Ask user which resources the public key should have access to @param InputInterface $input @param OutputInterface $output @return array
[ "Ask", "user", "which", "resources", "the", "public", "key", "should", "have", "access", "to" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/CliCommand/AddPublicKey.php#L109-L135
188,154
imbo/imbo
src/CliCommand/AddPublicKey.php
AddPublicKey.askForSpecificResources
private function askForSpecificResources(InputInterface $input, OutputInterface $output) { $resources = Resource::getAllResources(); sort($resources); $question = new ChoiceQuestion( 'Which resources should the public key have access to? (comma-separated) ', $resources ...
php
private function askForSpecificResources(InputInterface $input, OutputInterface $output) { $resources = Resource::getAllResources(); sort($resources); $question = new ChoiceQuestion( 'Which resources should the public key have access to? (comma-separated) ', $resources ...
[ "private", "function", "askForSpecificResources", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "resources", "=", "Resource", "::", "getAllResources", "(", ")", ";", "sort", "(", "$", "resources", ")", ";", "$", "...
Ask user which specific resources the public key should have access to @param InputInterface $input @param OutputInterface $output @return array
[ "Ask", "user", "which", "specific", "resources", "the", "public", "key", "should", "have", "access", "to" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/CliCommand/AddPublicKey.php#L144-L155
188,155
imbo/imbo
src/CliCommand/AddPublicKey.php
AddPublicKey.askForCustomResources
private function askForCustomResources(InputInterface $input, OutputInterface $output) { $question = new Question( 'Which custom resources should the public key have access to?' . PHP_EOL . '(comma-separated) ' ); $question->setValidator(function($answer) { $...
php
private function askForCustomResources(InputInterface $input, OutputInterface $output) { $question = new Question( 'Which custom resources should the public key have access to?' . PHP_EOL . '(comma-separated) ' ); $question->setValidator(function($answer) { $...
[ "private", "function", "askForCustomResources", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "question", "=", "new", "Question", "(", "'Which custom resources should the public key have access to?'", ".", "PHP_EOL", ".", "'(...
Ask the user which custom resources the public key should have access to @param InputInterface $input @param OutputInterface $output @return array|string
[ "Ask", "the", "user", "which", "custom", "resources", "the", "public", "key", "should", "have", "access", "to" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/CliCommand/AddPublicKey.php#L164-L183
188,156
imbo/imbo
src/CliCommand/AddPublicKey.php
AddPublicKey.askForAnotherAclRule
private function askForAnotherAclRule(InputInterface $input, OutputInterface $output) { return $this->getHelper('question')->ask($input, $output, new ConfirmationQuestion( 'Create more ACL-rules for this public key? (y/N) ', false )); }
php
private function askForAnotherAclRule(InputInterface $input, OutputInterface $output) { return $this->getHelper('question')->ask($input, $output, new ConfirmationQuestion( 'Create more ACL-rules for this public key? (y/N) ', false )); }
[ "private", "function", "askForAnotherAclRule", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "return", "$", "this", "->", "getHelper", "(", "'question'", ")", "->", "ask", "(", "$", "input", ",", "$", "output", ",", ...
Ask the user if she wants to add more ACL-rules @param InputInterface $input @param OutputInterface $output @return boolean
[ "Ask", "the", "user", "if", "she", "wants", "to", "add", "more", "ACL", "-", "rules" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/CliCommand/AddPublicKey.php#L219-L224
188,157
imbo/imbo
src/CliCommand/AddPublicKey.php
AddPublicKey.getAclAdapter
private function getAclAdapter() { $config = $this->getConfig(); // Access control adapter $accessControl = $config['accessControl']; if (is_callable($accessControl) && !($accessControl instanceof AdapterInterface)) { $accessControl = $accessControl(); } if...
php
private function getAclAdapter() { $config = $this->getConfig(); // Access control adapter $accessControl = $config['accessControl']; if (is_callable($accessControl) && !($accessControl instanceof AdapterInterface)) { $accessControl = $accessControl(); } if...
[ "private", "function", "getAclAdapter", "(", ")", "{", "$", "config", "=", "$", "this", "->", "getConfig", "(", ")", ";", "// Access control adapter", "$", "accessControl", "=", "$", "config", "[", "'accessControl'", "]", ";", "if", "(", "is_callable", "(", ...
Get the configured ACL adapter and ensure it is mutable @return MutableAdapterInterface
[ "Get", "the", "configured", "ACL", "adapter", "and", "ensure", "it", "is", "mutable" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/CliCommand/AddPublicKey.php#L249-L268
188,158
imbo/imbo
src/Http/Response/ResponseFormatter.php
ResponseFormatter.format
public function format(EventInterface $event) { $response = $event->getResponse(); $model = $response->getModel(); if ($response->getStatusCode() === 204 || !$model) { // No content to write return; } $request = $event->getRequest(); // If we ar...
php
public function format(EventInterface $event) { $response = $event->getResponse(); $model = $response->getModel(); if ($response->getStatusCode() === 204 || !$model) { // No content to write return; } $request = $event->getRequest(); // If we ar...
[ "public", "function", "format", "(", "EventInterface", "$", "event", ")", "{", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ";", "$", "model", "=", "$", "response", "->", "getModel", "(", ")", ";", "if", "(", "$", "response", "-...
Response send hook @param EventInterface $event The current event
[ "Response", "send", "hook" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Http/Response/ResponseFormatter.php#L255-L317
188,159
imbo/imbo
src/Image/Transformation/Border.php
Border.expandImage
private function expandImage($color, $borderWidth, $borderHeight) { $this->imageWidth = $this->image->getWidth(); $this->imageHeight = $this->image->getHeight(); $original = clone $this->imagick; // Clear the original and make the canvas $this->imagick->clear(); $this-...
php
private function expandImage($color, $borderWidth, $borderHeight) { $this->imageWidth = $this->image->getWidth(); $this->imageHeight = $this->image->getHeight(); $original = clone $this->imagick; // Clear the original and make the canvas $this->imagick->clear(); $this-...
[ "private", "function", "expandImage", "(", "$", "color", ",", "$", "borderWidth", ",", "$", "borderHeight", ")", "{", "$", "this", "->", "imageWidth", "=", "$", "this", "->", "image", "->", "getWidth", "(", ")", ";", "$", "this", "->", "imageHeight", "...
Expand the image so that we can fit the width and height of the borders specified on each side, than copy the original image to the center of the canvas. @param string $color @param integer $borderWidth @param integer $borderHeight
[ "Expand", "the", "image", "so", "that", "we", "can", "fit", "the", "width", "and", "height", "of", "the", "borders", "specified", "on", "each", "side", "than", "copy", "the", "original", "image", "to", "the", "center", "of", "the", "canvas", "." ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/Border.php#L102-L125
188,160
imbo/imbo
src/EventListener/ResponseETag.php
ResponseETag.fixIfNoneMatchHeader
public function fixIfNoneMatchHeader(EventInterface $event) { $request = $event->getRequest(); $ifNoneMatch = $request->headers->get('if-none-match', false); if ($ifNoneMatch && strlen($ifNoneMatch) > 34) { // Remote quotes $ifNoneMatch = trim($ifNoneMatch, '"'); ...
php
public function fixIfNoneMatchHeader(EventInterface $event) { $request = $event->getRequest(); $ifNoneMatch = $request->headers->get('if-none-match', false); if ($ifNoneMatch && strlen($ifNoneMatch) > 34) { // Remote quotes $ifNoneMatch = trim($ifNoneMatch, '"'); ...
[ "public", "function", "fixIfNoneMatchHeader", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "ifNoneMatch", "=", "$", "request", "->", "headers", "->", "get", "(", "'if-none-match'", ...
Clean up a possibly tainted If-None-Match request header Apache for instance can add "-gzip" to the ETag response header value, causing the matching in Imbo to fail when this value comes back with a "-gzip" appended to it. @param EventInterface $event The current event
[ "Clean", "up", "a", "possibly", "tainted", "If", "-", "None", "-", "Match", "request", "header" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ResponseETag.php#L42-L54
188,161
imbo/imbo
src/EventListener/ResponseETag.php
ResponseETag.setETag
public function setETag(EventInterface $event) { $response = $event->getResponse(); $request = $event->getRequest(); $routesWithETags = [ 'user' => true, 'images' => true, 'image' => true, 'metadata' => true, 'globalshorturl' => true, ...
php
public function setETag(EventInterface $event) { $response = $event->getResponse(); $request = $event->getRequest(); $routesWithETags = [ 'user' => true, 'images' => true, 'image' => true, 'metadata' => true, 'globalshorturl' => true, ...
[ "public", "function", "setETag", "(", "EventInterface", "$", "event", ")", "{", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ";", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "routesWithETags", "=", "...
Set the correct ETag for the response @param EventInterface $event The current event
[ "Set", "the", "correct", "ETag", "for", "the", "response" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ResponseETag.php#L61-L82
188,162
imbo/imbo
src/EventManager/EventManager.php
EventManager.addEventHandler
public function addEventHandler($name, $handler, array $params = []) { if (is_string($handler)) { $this->eventHandlers[$name] = [ 'handler' => $handler, 'params' => $params, ]; } else { $this->eventHandlers[$name] = $handler; } ...
php
public function addEventHandler($name, $handler, array $params = []) { if (is_string($handler)) { $this->eventHandlers[$name] = [ 'handler' => $handler, 'params' => $params, ]; } else { $this->eventHandlers[$name] = $handler; } ...
[ "public", "function", "addEventHandler", "(", "$", "name", ",", "$", "handler", ",", "array", "$", "params", "=", "[", "]", ")", "{", "if", "(", "is_string", "(", "$", "handler", ")", ")", "{", "$", "this", "->", "eventHandlers", "[", "$", "name", ...
Register an event handler @param string $name The name of the handler @param mixed $handler The handler itself @param array $params Parameters for the handler if $handler is a string @return self
[ "Register", "an", "event", "handler" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventManager/EventManager.php#L60-L71
188,163
imbo/imbo
src/EventManager/EventManager.php
EventManager.addCallbacks
public function addCallbacks($name, array $events, array $users = []) { // Default priority $defaultPriority = 0; foreach ($events as $event => $callback) { if (!isset($this->callbacks[$event])) { // Create a priority queue for this event $this->callb...
php
public function addCallbacks($name, array $events, array $users = []) { // Default priority $defaultPriority = 0; foreach ($events as $event => $callback) { if (!isset($this->callbacks[$event])) { // Create a priority queue for this event $this->callb...
[ "public", "function", "addCallbacks", "(", "$", "name", ",", "array", "$", "events", ",", "array", "$", "users", "=", "[", "]", ")", "{", "// Default priority", "$", "defaultPriority", "=", "0", ";", "foreach", "(", "$", "events", "as", "$", "event", "...
Add one or more callbacks @param string $name The name of the handler that owns the callback @param array $events Which events the callback will trigger for @param array $users User filter for the events @return self
[ "Add", "one", "or", "more", "callbacks" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventManager/EventManager.php#L81-L125
188,164
imbo/imbo
src/EventManager/EventManager.php
EventManager.getHandlerInstance
public function getHandlerInstance($name) { if (is_array($this->eventHandlers[$name])) { // The listener has not been initialized $className = $this->eventHandlers[$name]['handler']; $params = $this->eventHandlers[$name]['params']; $handler = new $className($param...
php
public function getHandlerInstance($name) { if (is_array($this->eventHandlers[$name])) { // The listener has not been initialized $className = $this->eventHandlers[$name]['handler']; $params = $this->eventHandlers[$name]['params']; $handler = new $className($param...
[ "public", "function", "getHandlerInstance", "(", "$", "name", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "eventHandlers", "[", "$", "name", "]", ")", ")", "{", "// The listener has not been initialized", "$", "className", "=", "$", "this", "->"...
Get a handler instance @param string $name The name of the handler @return ListenerInterface
[ "Get", "a", "handler", "instance" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventManager/EventManager.php#L133-L149
188,165
imbo/imbo
src/EventManager/EventManager.php
EventManager.trigger
public function trigger($eventName, array $params = []) { $event = clone $this->event; $event->setName($eventName); // Add optional extra arguments foreach ($params as $key => $value) { $event->setArgument($key, $value); } // Fetch current user $user...
php
public function trigger($eventName, array $params = []) { $event = clone $this->event; $event->setName($eventName); // Add optional extra arguments foreach ($params as $key => $value) { $event->setArgument($key, $value); } // Fetch current user $user...
[ "public", "function", "trigger", "(", "$", "eventName", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "event", "=", "clone", "$", "this", "->", "event", ";", "$", "event", "->", "setName", "(", "$", "eventName", ")", ";", "// Add optiona...
Trigger a given event @param string $eventName The name of the event to trigger @param array $params Extra parameters for the event @return EventManager
[ "Trigger", "a", "given", "event" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventManager/EventManager.php#L179-L214
188,166
imbo/imbo
src/EventManager/EventManager.php
EventManager.getListenersForEvent
private function getListenersForEvent($event) { $listeners = []; foreach ($this->getEventNameParts($event) as $name) { if (isset($this->callbacks[$name])) { foreach (clone $this->callbacks[$name] as $listener) { $listeners[] = $listener; }...
php
private function getListenersForEvent($event) { $listeners = []; foreach ($this->getEventNameParts($event) as $name) { if (isset($this->callbacks[$name])) { foreach (clone $this->callbacks[$name] as $listener) { $listeners[] = $listener; }...
[ "private", "function", "getListenersForEvent", "(", "$", "event", ")", "{", "$", "listeners", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getEventNameParts", "(", "$", "event", ")", "as", "$", "name", ")", "{", "if", "(", "isset", "(", "$...
Get all listeners that listens for an event, including wildcard listeners @param string $event Name of the event @return PriorityQueue[]
[ "Get", "all", "listeners", "that", "listens", "for", "an", "event", "including", "wildcard", "listeners" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventManager/EventManager.php#L222-L234
188,167
imbo/imbo
src/EventManager/EventManager.php
EventManager.getEventNameParts
private function getEventNameParts($event) { $parts = ['*']; $offset = 0; while ($offset = strpos($event, '.', $offset + 1)) { $parts[] = substr($event, 0, $offset) . '.*'; } $parts[] = $event; return $parts; }
php
private function getEventNameParts($event) { $parts = ['*']; $offset = 0; while ($offset = strpos($event, '.', $offset + 1)) { $parts[] = substr($event, 0, $offset) . '.*'; } $parts[] = $event; return $parts; }
[ "private", "function", "getEventNameParts", "(", "$", "event", ")", "{", "$", "parts", "=", "[", "'*'", "]", ";", "$", "offset", "=", "0", ";", "while", "(", "$", "offset", "=", "strpos", "(", "$", "event", ",", "'.'", ",", "$", "offset", "+", "1...
Get all parts of an event name @param string $event @param string[]
[ "Get", "all", "parts", "of", "an", "event", "name" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventManager/EventManager.php#L242-L253
188,168
imbo/imbo
src/EventManager/EventManager.php
EventManager.triggersFor
private function triggersFor($user = null, array $filter = []) { if (empty($user) || empty($filter)) { return true; } $filter = array_merge(['whitelist' => [], 'blacklist' => []], $filter); $whitelist = array_flip($filter['whitelist']); $blacklist = array_flip($fil...
php
private function triggersFor($user = null, array $filter = []) { if (empty($user) || empty($filter)) { return true; } $filter = array_merge(['whitelist' => [], 'blacklist' => []], $filter); $whitelist = array_flip($filter['whitelist']); $blacklist = array_flip($fil...
[ "private", "function", "triggersFor", "(", "$", "user", "=", "null", ",", "array", "$", "filter", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "user", ")", "||", "empty", "(", "$", "filter", ")", ")", "{", "return", "true", ";", "}", ...
Check if a listener will trigger for a given user @param string $user The user to check for, can be null @param array $filter The array from the listener with "whitelist" and "blacklist" @return boolean
[ "Check", "if", "a", "listener", "will", "trigger", "for", "a", "given", "user" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventManager/EventManager.php#L286-L310
188,169
imbo/imbo
src/Database/Doctrine.php
Doctrine.denormalizeMetadata
private function denormalizeMetadata(array $data) { $result = []; foreach ($data as $key => $value) { $keys = explode($this->metadataNamespaceSeparator, $key); $tmp = &$result; foreach ($keys as $i => $key) { if (!isset($tmp[$key])) { ...
php
private function denormalizeMetadata(array $data) { $result = []; foreach ($data as $key => $value) { $keys = explode($this->metadataNamespaceSeparator, $key); $tmp = &$result; foreach ($keys as $i => $key) { if (!isset($tmp[$key])) { ...
[ "private", "function", "denormalizeMetadata", "(", "array", "$", "data", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "keys", "=", "explode", "(", "$", "this", "->", ...
De-normalize metadata @param array $data Metadata @return array
[ "De", "-", "normalize", "metadata" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Database/Doctrine.php#L742-L761
188,170
imbo/imbo
src/Image/Transformation/Transformation.php
Transformation.getQuantumRange
protected function getQuantumRange() { // Newer versions of Imagick expose getQuantumRange as a static method, // and won't allow phpunit to mock it even when called on an instance if (is_callable([$this->imagick, 'getQuantumRange'])) { $quantumRange = $this->imagick->getQuantumRange...
php
protected function getQuantumRange() { // Newer versions of Imagick expose getQuantumRange as a static method, // and won't allow phpunit to mock it even when called on an instance if (is_callable([$this->imagick, 'getQuantumRange'])) { $quantumRange = $this->imagick->getQuantumRange...
[ "protected", "function", "getQuantumRange", "(", ")", "{", "// Newer versions of Imagick expose getQuantumRange as a static method,", "// and won't allow phpunit to mock it even when called on an instance", "if", "(", "is_callable", "(", "[", "$", "this", "->", "imagick", ",", "'...
Get the quantum range of an image @return int
[ "Get", "the", "quantum", "range", "of", "an", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/Transformation.php#L103-L113
188,171
imbo/imbo
src/EventListener/EightbimMetadata.php
EightbimMetadata.populate
public function populate(EventInterface $event) { // Read the image $image = $event->getRequest()->getImage(); $this->imagick->readImageBlob($image->getBlob()); // Get 8BIM-properties from image - this seems to be the best way to get the identifiers // with path names in a raw f...
php
public function populate(EventInterface $event) { // Read the image $image = $event->getRequest()->getImage(); $this->imagick->readImageBlob($image->getBlob()); // Get 8BIM-properties from image - this seems to be the best way to get the identifiers // with path names in a raw f...
[ "public", "function", "populate", "(", "EventInterface", "$", "event", ")", "{", "// Read the image", "$", "image", "=", "$", "event", "->", "getRequest", "(", ")", "->", "getImage", "(", ")", ";", "$", "this", "->", "imagick", "->", "readImageBlob", "(", ...
Read 8BIM data from incoming image @param EventInterface $event The triggered event @return array
[ "Read", "8BIM", "data", "from", "incoming", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/EightbimMetadata.php#L70-L97
188,172
imbo/imbo
src/EventListener/HttpCache.php
HttpCache.setHeaders
public function setHeaders(EventInterface $event) { $method = $event->getRequest()->getMethod(); // Obviously we shouldn't bother doing any HTTP caching logic for non-GET/HEAD requests if ($method !== 'GET' && $method !== 'HEAD') { return; } $response = $event->getR...
php
public function setHeaders(EventInterface $event) { $method = $event->getRequest()->getMethod(); // Obviously we shouldn't bother doing any HTTP caching logic for non-GET/HEAD requests if ($method !== 'GET' && $method !== 'HEAD') { return; } $response = $event->getR...
[ "public", "function", "setHeaders", "(", "EventInterface", "$", "event", ")", "{", "$", "method", "=", "$", "event", "->", "getRequest", "(", ")", "->", "getMethod", "(", ")", ";", "// Obviously we shouldn't bother doing any HTTP caching logic for non-GET/HEAD requests"...
Right before the response is sent to the client, check if any HTTP cache control headers have explicity been set for this response. If not, apply the configured defaults. @param EventInterface $event The event instance
[ "Right", "before", "the", "response", "is", "sent", "to", "the", "client", "check", "if", "any", "HTTP", "cache", "control", "headers", "have", "explicity", "been", "set", "for", "this", "response", ".", "If", "not", "apply", "the", "configured", "defaults",...
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/HttpCache.php#L40-L77
188,173
imbo/imbo
src/Storage/S3.php
S3.getClient
protected function getClient() { if ($this->client === null) { $params = [ 'credentials' => [ 'key' => $this->params['key'], 'secret' => $this->params['secret'], ], 'version' => $this->params['version'], ...
php
protected function getClient() { if ($this->client === null) { $params = [ 'credentials' => [ 'key' => $this->params['key'], 'secret' => $this->params['secret'], ], 'version' => $this->params['version'], ...
[ "protected", "function", "getClient", "(", ")", "{", "if", "(", "$", "this", "->", "client", "===", "null", ")", "{", "$", "params", "=", "[", "'credentials'", "=>", "[", "'key'", "=>", "$", "this", "->", "params", "[", "'key'", "]", ",", "'secret'",...
Get the S3Client instance @return S3Client
[ "Get", "the", "S3Client", "instance" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Storage/S3.php#L224-L242
188,174
imbo/imbo
src/Http/Request/Request.php
Request.getPublicKey
public function getPublicKey() { return ( $this->headers->get('X-Imbo-PublicKey', null) ?: $this->query->get('publicKey', null) ?: ($this->route ? $this->route->get('user') : null) ); }
php
public function getPublicKey() { return ( $this->headers->get('X-Imbo-PublicKey', null) ?: $this->query->get('publicKey', null) ?: ($this->route ? $this->route->get('user') : null) ); }
[ "public", "function", "getPublicKey", "(", ")", "{", "return", "(", "$", "this", "->", "headers", "->", "get", "(", "'X-Imbo-PublicKey'", ",", "null", ")", "?", ":", "$", "this", "->", "query", "->", "get", "(", "'publicKey'", ",", "null", ")", "?", ...
Get the public key found in the request @return string
[ "Get", "the", "public", "key", "found", "in", "the", "request" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Http/Request/Request.php#L72-L78
188,175
imbo/imbo
src/Http/Request/Request.php
Request.getUsers
public function getUsers() { $routeUser = $this->getUser(); $queryUsers = $this->query->get('users', []); if (!$routeUser && !$queryUsers) { return []; } elseif (!$queryUsers) { return [$routeUser]; } elseif (!$routeUser) { return $queryUsers;...
php
public function getUsers() { $routeUser = $this->getUser(); $queryUsers = $this->query->get('users', []); if (!$routeUser && !$queryUsers) { return []; } elseif (!$queryUsers) { return [$routeUser]; } elseif (!$routeUser) { return $queryUsers;...
[ "public", "function", "getUsers", "(", ")", "{", "$", "routeUser", "=", "$", "this", "->", "getUser", "(", ")", ";", "$", "queryUsers", "=", "$", "this", "->", "query", "->", "get", "(", "'users'", ",", "[", "]", ")", ";", "if", "(", "!", "$", ...
Get users specified in the request @return array Users specified in the request
[ "Get", "users", "specified", "in", "the", "request" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Http/Request/Request.php#L94-L107
188,176
imbo/imbo
src/Http/Request/Request.php
Request.getTransformations
public function getTransformations() { if ($this->transformations === null) { $this->transformations = []; $transformations = $this->query->get('t', []); if (!is_array($transformations)) { throw new InvalidArgumentException('Transformations must be specifed ...
php
public function getTransformations() { if ($this->transformations === null) { $this->transformations = []; $transformations = $this->query->get('t', []); if (!is_array($transformations)) { throw new InvalidArgumentException('Transformations must be specifed ...
[ "public", "function", "getTransformations", "(", ")", "{", "if", "(", "$", "this", "->", "transformations", "===", "null", ")", "{", "$", "this", "->", "transformations", "=", "[", "]", ";", "$", "transformations", "=", "$", "this", "->", "query", "->", ...
Get image transformations from the request @return array
[ "Get", "image", "transformations", "from", "the", "request" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Http/Request/Request.php#L114-L161
188,177
imbo/imbo
src/Http/Request/Request.php
Request.getRawUri
public function getRawUri() { $query = $this->server->get('QUERY_STRING'); if (!empty($query)) { $query = '?' . urldecode($query); } return $this->getSchemeAndHttpHost() . $this->getBaseUrl() . $this->getPathInfo() . $query; }
php
public function getRawUri() { $query = $this->server->get('QUERY_STRING'); if (!empty($query)) { $query = '?' . urldecode($query); } return $this->getSchemeAndHttpHost() . $this->getBaseUrl() . $this->getPathInfo() . $query; }
[ "public", "function", "getRawUri", "(", ")", "{", "$", "query", "=", "$", "this", "->", "server", "->", "get", "(", "'QUERY_STRING'", ")", ";", "if", "(", "!", "empty", "(", "$", "query", ")", ")", "{", "$", "query", "=", "'?'", ".", "urldecode", ...
Get the URI without the Symfony normalization applied to the query string, un-encoded @return string
[ "Get", "the", "URI", "without", "the", "Symfony", "normalization", "applied", "to", "the", "query", "string", "un", "-", "encoded" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Http/Request/Request.php#L213-L221
188,178
imbo/imbo
src/EventListener/VarnishHashTwo.php
VarnishHashTwo.addHeader
public function addHeader(EventInterface $event) { $request = $event->getRequest(); $response = $event->getResponse(); $user = $request->getUser(); $imageIdentifier = $response->getModel()->getImageIdentifier(); $response->headers->set( $this->header, [ ...
php
public function addHeader(EventInterface $event) { $request = $event->getRequest(); $response = $event->getResponse(); $user = $request->getUser(); $imageIdentifier = $response->getModel()->getImageIdentifier(); $response->headers->set( $this->header, [ ...
[ "public", "function", "addHeader", "(", "EventInterface", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ";", "$", "user", "=", "$", "re...
Add the HashTwo header to the response @param EventInterface $event The current event
[ "Add", "the", "HashTwo", "header", "to", "the", "response" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/VarnishHashTwo.php#L59-L73
188,179
imbo/imbo
src/Http/Response/Response.php
Response.setError
public function setError(Model\Error $error) { $errorMessage = $error->getErrorMessage(); $this->headers->add([ 'X-Imbo-Error-Message' => $errorMessage, 'X-Imbo-Error-InternalCode' => $error->getImboErrorCode(), 'X-Imbo-Error-Date' => $error->getDate()->format('D, d ...
php
public function setError(Model\Error $error) { $errorMessage = $error->getErrorMessage(); $this->headers->add([ 'X-Imbo-Error-Message' => $errorMessage, 'X-Imbo-Error-InternalCode' => $error->getImboErrorCode(), 'X-Imbo-Error-Date' => $error->getDate()->format('D, d ...
[ "public", "function", "setError", "(", "Model", "\\", "Error", "$", "error", ")", "{", "$", "errorMessage", "=", "$", "error", "->", "getErrorMessage", "(", ")", ";", "$", "this", "->", "headers", "->", "add", "(", "[", "'X-Imbo-Error-Message'", "=>", "$...
Set an error model and update some parts of the response object @param Model\Error $error An error model instance @return Response
[ "Set", "an", "error", "model", "and", "update", "some", "parts", "of", "the", "response", "object" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Http/Response/Response.php#L67-L83
188,180
imbo/imbo
src/Resource/Group.php
Group.getGroup
public function getGroup(EventInterface $event) { $route = $event->getRequest()->getRoute(); $groupName = $route->get('group'); $adapter = $event->getAccessControl(); if (!$adapter->groupExists($groupName)) { throw new ResourceException('Resource group not found', 404); ...
php
public function getGroup(EventInterface $event) { $route = $event->getRequest()->getRoute(); $groupName = $route->get('group'); $adapter = $event->getAccessControl(); if (!$adapter->groupExists($groupName)) { throw new ResourceException('Resource group not found', 404); ...
[ "public", "function", "getGroup", "(", "EventInterface", "$", "event", ")", "{", "$", "route", "=", "$", "event", "->", "getRequest", "(", ")", "->", "getRoute", "(", ")", ";", "$", "groupName", "=", "$", "route", "->", "get", "(", "'group'", ")", ";...
Get the resources associated with a specific group @param EventInterface $event The current event
[ "Get", "the", "resources", "associated", "with", "a", "specific", "group" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Group.php#L49-L67
188,181
imbo/imbo
src/Resource/Group.php
Group.addGroup
public function addGroup(EventInterface $event) { $accessControl = $event->getAccessControl(); if (!($accessControl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $rou...
php
public function addGroup(EventInterface $event) { $accessControl = $event->getAccessControl(); if (!($accessControl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $rou...
[ "public", "function", "addGroup", "(", "EventInterface", "$", "event", ")", "{", "$", "accessControl", "=", "$", "event", "->", "getAccessControl", "(", ")", ";", "if", "(", "!", "(", "$", "accessControl", "instanceof", "MutableAdapterInterface", ")", ")", "...
Add resources to a group @param EventInterface $event The current event
[ "Add", "resources", "to", "a", "group" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Group.php#L74-L107
188,182
imbo/imbo
src/Resource/Group.php
Group.deleteGroup
public function deleteGroup(EventInterface $event) { $accessControl = $event->getAccessControl(); if (!($accessControl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $route = $event->getRequest()->getRoute();...
php
public function deleteGroup(EventInterface $event) { $accessControl = $event->getAccessControl(); if (!($accessControl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $route = $event->getRequest()->getRoute();...
[ "public", "function", "deleteGroup", "(", "EventInterface", "$", "event", ")", "{", "$", "accessControl", "=", "$", "event", "->", "getAccessControl", "(", ")", ";", "if", "(", "!", "(", "$", "accessControl", "instanceof", "MutableAdapterInterface", ")", ")", ...
Delete a resource group @param EventInterface $event The current event
[ "Delete", "a", "resource", "group" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Group.php#L114-L129
188,183
imbo/imbo
src/EventListener/Imagick.php
Imagick.readImageBlob
public function readImageBlob(EventInterface $event) { $eventName = $event->getName(); $config = $event->getConfig(); $jpegSizeHintEnabled = $config['optimizations']['jpegSizeHint']; if ($event->hasArgument('image')) { // The image has been specified as an argument to the ev...
php
public function readImageBlob(EventInterface $event) { $eventName = $event->getName(); $config = $event->getConfig(); $jpegSizeHintEnabled = $config['optimizations']['jpegSizeHint']; if ($event->hasArgument('image')) { // The image has been specified as an argument to the ev...
[ "public", "function", "readImageBlob", "(", "EventInterface", "$", "event", ")", "{", "$", "eventName", "=", "$", "event", "->", "getName", "(", ")", ";", "$", "config", "=", "$", "event", "->", "getConfig", "(", ")", ";", "$", "jpegSizeHintEnabled", "="...
Inject the image blob from the image model into the shared imagick instance @param EventInterface $event The event instance
[ "Inject", "the", "image", "blob", "from", "the", "image", "model", "into", "the", "shared", "imagick", "instance" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Imagick.php#L70-L109
188,184
imbo/imbo
src/EventListener/Imagick.php
Imagick.updateModelBeforeStoring
public function updateModelBeforeStoring(EventInterface $event) { $image = $event->getRequest()->getImage(); if ($image->hasBeenTransformed()) { $image->setBlob($this->imagick->getImageBlob()); } }
php
public function updateModelBeforeStoring(EventInterface $event) { $image = $event->getRequest()->getImage(); if ($image->hasBeenTransformed()) { $image->setBlob($this->imagick->getImageBlob()); } }
[ "public", "function", "updateModelBeforeStoring", "(", "EventInterface", "$", "event", ")", "{", "$", "image", "=", "$", "event", "->", "getRequest", "(", ")", "->", "getImage", "(", ")", ";", "if", "(", "$", "image", "->", "hasBeenTransformed", "(", ")", ...
Update the image model blob before storing it in case an event listener has changed the image @param EventInterface $event The event instance
[ "Update", "the", "image", "model", "blob", "before", "storing", "it", "in", "case", "an", "event", "listener", "has", "changed", "the", "image" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Imagick.php#L117-L123
188,185
imbo/imbo
src/EventListener/Imagick.php
Imagick.updateModel
public function updateModel(EventInterface $event) { $image = $event->getArgument('image'); if ($image->hasBeenTransformed()) { $image->setBlob($this->imagick->getImageBlob()); } }
php
public function updateModel(EventInterface $event) { $image = $event->getArgument('image'); if ($image->hasBeenTransformed()) { $image->setBlob($this->imagick->getImageBlob()); } }
[ "public", "function", "updateModel", "(", "EventInterface", "$", "event", ")", "{", "$", "image", "=", "$", "event", "->", "getArgument", "(", "'image'", ")", ";", "if", "(", "$", "image", "->", "hasBeenTransformed", "(", ")", ")", "{", "$", "image", "...
Update the model data if the image has been changed @param EventInterface $event The event instance
[ "Update", "the", "model", "data", "if", "the", "image", "has", "been", "changed" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/Imagick.php#L130-L136
188,186
imbo/imbo
src/Model/Error.php
Error.createFromException
public static function createFromException(Exception $exception, Request $request) { $date = new DateTime('now', new DateTimeZone('UTC')); $model = new self(); $model->setHttpCode($exception->getCode()) ->setErrorMessage($exception->getMessage()) ->setDate($date) ...
php
public static function createFromException(Exception $exception, Request $request) { $date = new DateTime('now', new DateTimeZone('UTC')); $model = new self(); $model->setHttpCode($exception->getCode()) ->setErrorMessage($exception->getMessage()) ->setDate($date) ...
[ "public", "static", "function", "createFromException", "(", "Exception", "$", "exception", ",", "Request", "$", "request", ")", "{", "$", "date", "=", "new", "DateTime", "(", "'now'", ",", "new", "DateTimeZone", "(", "'UTC'", ")", ")", ";", "$", "model", ...
Create an error based on an exception instance @param Exception $exception An Imbo\Exception instance @param Request The current request @return Error
[ "Create", "an", "error", "based", "on", "an", "exception", "instance" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Model/Error.php#L185-L201
188,187
imbo/imbo
src/Resource/ShortUrl.php
ShortUrl.deleteShortUrl
public function deleteShortUrl(EventInterface $event) { $database = $event->getDatabase(); $request = $event->getRequest(); $user = $request->getUser(); $imageIdentifier = $request->getImageIdentifier(); $shortUrlId = $request->getRoute()->get('shortUrlId'); if (!$params...
php
public function deleteShortUrl(EventInterface $event) { $database = $event->getDatabase(); $request = $event->getRequest(); $user = $request->getUser(); $imageIdentifier = $request->getImageIdentifier(); $shortUrlId = $request->getRoute()->get('shortUrlId'); if (!$params...
[ "public", "function", "deleteShortUrl", "(", "EventInterface", "$", "event", ")", "{", "$", "database", "=", "$", "event", "->", "getDatabase", "(", ")", ";", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "user", "=", "$", ...
Delete a single short URL @param EventInterface $event
[ "Delete", "a", "single", "short", "URL" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/ShortUrl.php#L45-L72
188,188
imbo/imbo
src/Resource/Keys.php
Keys.getKey
public function getKey(EventInterface $event) { $acl = $event->getAccessControl(); $publicKey = $event->getRequest()->getRoute()->get('publickey'); if (!$acl->publicKeyExists($publicKey)) { throw new RuntimeException('Public key not found', 404); } }
php
public function getKey(EventInterface $event) { $acl = $event->getAccessControl(); $publicKey = $event->getRequest()->getRoute()->get('publickey'); if (!$acl->publicKeyExists($publicKey)) { throw new RuntimeException('Public key not found', 404); } }
[ "public", "function", "getKey", "(", "EventInterface", "$", "event", ")", "{", "$", "acl", "=", "$", "event", "->", "getAccessControl", "(", ")", ";", "$", "publicKey", "=", "$", "event", "->", "getRequest", "(", ")", "->", "getRoute", "(", ")", "->", ...
Get a public key, but return only status code, not private key information @param EventInterface $event The current event
[ "Get", "a", "public", "key", "but", "return", "only", "status", "code", "not", "private", "key", "information" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Keys.php#L52-L60
188,189
imbo/imbo
src/Resource/Keys.php
Keys.setKey
public function setKey(EventInterface $event) { $acl = $event->getAccessControl(); if (!($acl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $data = json_decode($requ...
php
public function setKey(EventInterface $event) { $acl = $event->getAccessControl(); if (!($acl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $data = json_decode($requ...
[ "public", "function", "setKey", "(", "EventInterface", "$", "event", ")", "{", "$", "acl", "=", "$", "event", "->", "getAccessControl", "(", ")", ";", "if", "(", "!", "(", "$", "acl", "instanceof", "MutableAdapterInterface", ")", ")", "{", "throw", "new"...
Add or update public key @param EventInterface $event The current event
[ "Add", "or", "update", "public", "key" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Keys.php#L67-L93
188,190
imbo/imbo
src/Resource/Keys.php
Keys.deleteKey
public function deleteKey(EventInterface $event) { $acl = $event->getAccessControl(); if (!($acl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $publicKey = $request-...
php
public function deleteKey(EventInterface $event) { $acl = $event->getAccessControl(); if (!($acl instanceof MutableAdapterInterface)) { throw new ResourceException('Access control adapter is immutable', 405); } $request = $event->getRequest(); $publicKey = $request-...
[ "public", "function", "deleteKey", "(", "EventInterface", "$", "event", ")", "{", "$", "acl", "=", "$", "event", "->", "getAccessControl", "(", ")", ";", "if", "(", "!", "(", "$", "acl", "instanceof", "MutableAdapterInterface", ")", ")", "{", "throw", "n...
Delete public key @param EventInterface $event The current event
[ "Delete", "public", "key" ]
22125d1c477d67e8308b9eae604d029d79fe7d1f
https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Keys.php#L100-L120
188,191
mitchellvanw/laravel-doctrine
src/Configuration/SqliteMapper.php
SqliteMapper.map
public function map(array $configuration) { $sqliteConfig = [ 'driver' => 'pdo_sqlite', 'user' => @$configuration['username'], 'password' => @$configuration['password'], 'prefix' => @$configuration['prefix'] ? $configuration['prefix'] : null ]; $this->databaseLocation($configuration...
php
public function map(array $configuration) { $sqliteConfig = [ 'driver' => 'pdo_sqlite', 'user' => @$configuration['username'], 'password' => @$configuration['password'], 'prefix' => @$configuration['prefix'] ? $configuration['prefix'] : null ]; $this->databaseLocation($configuration...
[ "public", "function", "map", "(", "array", "$", "configuration", ")", "{", "$", "sqliteConfig", "=", "[", "'driver'", "=>", "'pdo_sqlite'", ",", "'user'", "=>", "@", "$", "configuration", "[", "'username'", "]", ",", "'password'", "=>", "@", "$", "configur...
Map the L4 configuration array to a sqlite-friendly doctrine configuration. @param array $configuration @return array
[ "Map", "the", "L4", "configuration", "array", "to", "a", "sqlite", "-", "friendly", "doctrine", "configuration", "." ]
703154d2285232cf9da714b2c1ca127499700ccb
https://github.com/mitchellvanw/laravel-doctrine/blob/703154d2285232cf9da714b2c1ca127499700ccb/src/Configuration/SqliteMapper.php#L11-L21
188,192
mitchellvanw/laravel-doctrine
src/Configuration/DriverMapper.php
DriverMapper.map
public function map($configuration) { foreach ($this->mappers as $mapper) if ($mapper->isAppropriateFor($configuration)) return $mapper->map($configuration); throw new Exception("Driver {$configuration['driver']} unsupported by package at this time."); }
php
public function map($configuration) { foreach ($this->mappers as $mapper) if ($mapper->isAppropriateFor($configuration)) return $mapper->map($configuration); throw new Exception("Driver {$configuration['driver']} unsupported by package at this time."); }
[ "public", "function", "map", "(", "$", "configuration", ")", "{", "foreach", "(", "$", "this", "->", "mappers", "as", "$", "mapper", ")", "if", "(", "$", "mapper", "->", "isAppropriateFor", "(", "$", "configuration", ")", ")", "return", "$", "mapper", ...
Map the Laravel configuration to a configuration driver, return the result. @param $configuration @return array @throws Exception
[ "Map", "the", "Laravel", "configuration", "to", "a", "configuration", "driver", "return", "the", "result", "." ]
703154d2285232cf9da714b2c1ca127499700ccb
https://github.com/mitchellvanw/laravel-doctrine/blob/703154d2285232cf9da714b2c1ca127499700ccb/src/Configuration/DriverMapper.php#L32-L39
188,193
McNetic/PHPZipStreamer
src/ZipStreamer.php
ZipStreamer.sendHeaders
public function sendHeaders($archiveName = 'archive.zip', $contentType = 'application/zip') { $headerFile = null; $headerLine = null; if (!headers_sent($headerFile, $headerLine) or die("<p><strong>Error:</strong> Unable to send file " . "$archiveName. HTML Headers have already bee...
php
public function sendHeaders($archiveName = 'archive.zip', $contentType = 'application/zip') { $headerFile = null; $headerLine = null; if (!headers_sent($headerFile, $headerLine) or die("<p><strong>Error:</strong> Unable to send file " . "$archiveName. HTML Headers have already bee...
[ "public", "function", "sendHeaders", "(", "$", "archiveName", "=", "'archive.zip'", ",", "$", "contentType", "=", "'application/zip'", ")", "{", "$", "headerFile", "=", "null", ";", "$", "headerLine", "=", "null", ";", "if", "(", "!", "headers_sent", "(", ...
Send appropriate http headers before streaming the zip file and disable output buffering. This method, if used, has to be called before adding anything to the zip file. @param string $archiveName Filename of archive to be created (optional, default 'archive.zip') @param string $contentType Content mime type to be set ...
[ "Send", "appropriate", "http", "headers", "before", "streaming", "the", "zip", "file", "and", "disable", "output", "buffering", ".", "This", "method", "if", "used", "has", "to", "be", "called", "before", "adding", "anything", "to", "the", "zip", "file", "." ...
e57c198486242476587d04844084adbe8330581d
https://github.com/McNetic/PHPZipStreamer/blob/e57c198486242476587d04844084adbe8330581d/src/ZipStreamer.php#L151-L182
188,194
McNetic/PHPZipStreamer
src/ZipStreamer.php
ZipStreamer.addEmptyDir
public function addEmptyDir($directoryPath, $options = NULL) { if ($this->isFinalized) { return false; } $defaultOptions = array( 'timestamp' => NULL, 'comment' => NULL, ); if (is_null($options)) { $options = array(); } $options = array_merge($defaultOptions, $options)...
php
public function addEmptyDir($directoryPath, $options = NULL) { if ($this->isFinalized) { return false; } $defaultOptions = array( 'timestamp' => NULL, 'comment' => NULL, ); if (is_null($options)) { $options = array(); } $options = array_merge($defaultOptions, $options)...
[ "public", "function", "addEmptyDir", "(", "$", "directoryPath", ",", "$", "options", "=", "NULL", ")", "{", "if", "(", "$", "this", "->", "isFinalized", ")", "{", "return", "false", ";", "}", "$", "defaultOptions", "=", "array", "(", "'timestamp'", "=>",...
Add an empty directory entry to the zip archive. @param string $directoryPath Directory Path and name to be added to the archive. @param array $options Optional, additional options Valid options are: * int timestamp: timestamp for the file (default: current time) * string comment: comment to be added for this fi...
[ "Add", "an", "empty", "directory", "entry", "to", "the", "zip", "archive", "." ]
e57c198486242476587d04844084adbe8330581d
https://github.com/McNetic/PHPZipStreamer/blob/e57c198486242476587d04844084adbe8330581d/src/ZipStreamer.php#L246-L276
188,195
McNetic/PHPZipStreamer
src/ZipStreamer.php
ZipStreamer.finalize
public function finalize() { if (!$this->isFinalized) { // print central directory $cd = implode('', $this->cdRec); $this->write($cd); if ($this->zip64) { // print the zip64 end of central directory record $this->write($this->buildZip64EndOfCentralDirectoryRecord(strlen($cd...
php
public function finalize() { if (!$this->isFinalized) { // print central directory $cd = implode('', $this->cdRec); $this->write($cd); if ($this->zip64) { // print the zip64 end of central directory record $this->write($this->buildZip64EndOfCentralDirectoryRecord(strlen($cd...
[ "public", "function", "finalize", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isFinalized", ")", "{", "// print central directory", "$", "cd", "=", "implode", "(", "''", ",", "$", "this", "->", "cdRec", ")", ";", "$", "this", "->", "write", "(...
Close the archive. A closed archive can no longer have new files added to it. After closing, the zip file is completely written to the output stream. @return bool $success
[ "Close", "the", "archive", ".", "A", "closed", "archive", "can", "no", "longer", "have", "new", "files", "added", "to", "it", ".", "After", "closing", "the", "zip", "file", "is", "completely", "written", "to", "the", "output", "stream", "." ]
e57c198486242476587d04844084adbe8330581d
https://github.com/McNetic/PHPZipStreamer/blob/e57c198486242476587d04844084adbe8330581d/src/ZipStreamer.php#L284-L311
188,196
mitchellvanw/laravel-doctrine
src/Configuration/SqlMapper.php
SqlMapper.map
public function map(array $configuration) { return [ 'driver' => $this->driver($configuration['driver']), 'host' => $configuration['host'], 'dbname' => $configuration['database'], 'user' => $configuration['username'], 'password' => $configuration['password'], 'charset' => $configuration['charset'],...
php
public function map(array $configuration) { return [ 'driver' => $this->driver($configuration['driver']), 'host' => $configuration['host'], 'dbname' => $configuration['database'], 'user' => $configuration['username'], 'password' => $configuration['password'], 'charset' => $configuration['charset'],...
[ "public", "function", "map", "(", "array", "$", "configuration", ")", "{", "return", "[", "'driver'", "=>", "$", "this", "->", "driver", "(", "$", "configuration", "[", "'driver'", "]", ")", ",", "'host'", "=>", "$", "configuration", "[", "'host'", "]", ...
Creates the configuration mapping for SQL database engines, including SQL server, MySQL and PostgreSQL. @param array $configuration @return array
[ "Creates", "the", "configuration", "mapping", "for", "SQL", "database", "engines", "including", "SQL", "server", "MySQL", "and", "PostgreSQL", "." ]
703154d2285232cf9da714b2c1ca127499700ccb
https://github.com/mitchellvanw/laravel-doctrine/blob/703154d2285232cf9da714b2c1ca127499700ccb/src/Configuration/SqlMapper.php#L11-L22
188,197
mitchellvanw/laravel-doctrine
src/LaravelDoctrineServiceProvider.php
LaravelDoctrineServiceProvider.registerConfigurationMapper
private function registerConfigurationMapper() { $this->app->bind(DriverMapper::class, function () { $mapper = new DriverMapper; $mapper->registerMapper(new SqlMapper); $mapper->registerMapper(new SqliteMapper); $mapper->registerMapper(new OCIMapper); ...
php
private function registerConfigurationMapper() { $this->app->bind(DriverMapper::class, function () { $mapper = new DriverMapper; $mapper->registerMapper(new SqlMapper); $mapper->registerMapper(new SqliteMapper); $mapper->registerMapper(new OCIMapper); ...
[ "private", "function", "registerConfigurationMapper", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "DriverMapper", "::", "class", ",", "function", "(", ")", "{", "$", "mapper", "=", "new", "DriverMapper", ";", "$", "mapper", "->", "registerM...
The driver mapper's instance needs to be accessible from anywhere in the application, for registering new mapping configurations or other storage libraries.
[ "The", "driver", "mapper", "s", "instance", "needs", "to", "be", "accessible", "from", "anywhere", "in", "the", "application", "for", "registering", "new", "mapping", "configurations", "or", "other", "storage", "libraries", "." ]
703154d2285232cf9da714b2c1ca127499700ccb
https://github.com/mitchellvanw/laravel-doctrine/blob/703154d2285232cf9da714b2c1ca127499700ccb/src/LaravelDoctrineServiceProvider.php#L61-L70
188,198
mitchellvanw/laravel-doctrine
src/LaravelDoctrineServiceProvider.php
LaravelDoctrineServiceProvider.mapLaravelToDoctrineConfig
private function mapLaravelToDoctrineConfig($config) { $default = $config['database.default']; $connection = $config["database.connections.{$default}"]; return App::make(DriverMapper::class)->map($connection); }
php
private function mapLaravelToDoctrineConfig($config) { $default = $config['database.default']; $connection = $config["database.connections.{$default}"]; return App::make(DriverMapper::class)->map($connection); }
[ "private", "function", "mapLaravelToDoctrineConfig", "(", "$", "config", ")", "{", "$", "default", "=", "$", "config", "[", "'database.default'", "]", ";", "$", "connection", "=", "$", "config", "[", "\"database.connections.{$default}\"", "]", ";", "return", "Ap...
Map Laravel's to Doctrine's database configuration requirements. @param $config @throws \Exception @return array
[ "Map", "Laravel", "s", "to", "Doctrine", "s", "database", "configuration", "requirements", "." ]
703154d2285232cf9da714b2c1ca127499700ccb
https://github.com/mitchellvanw/laravel-doctrine/blob/703154d2285232cf9da714b2c1ca127499700ccb/src/LaravelDoctrineServiceProvider.php#L162-L167
188,199
mitchellvanw/laravel-doctrine
src/Configuration/OCIMapper.php
OCIMapper.map
public function map(array $configuration) { $defaults = ['pooled' => false]; $optional = ['servicename', 'instancename']; foreach ($optional as $opt) { if(isset($configuration[$opt])) $defaults[$opt] = $configuration[$opt]; } return array_merge($defaults...
php
public function map(array $configuration) { $defaults = ['pooled' => false]; $optional = ['servicename', 'instancename']; foreach ($optional as $opt) { if(isset($configuration[$opt])) $defaults[$opt] = $configuration[$opt]; } return array_merge($defaults...
[ "public", "function", "map", "(", "array", "$", "configuration", ")", "{", "$", "defaults", "=", "[", "'pooled'", "=>", "false", "]", ";", "$", "optional", "=", "[", "'servicename'", ",", "'instancename'", "]", ";", "foreach", "(", "$", "optional", "as",...
Creates the configuration mapping for Oracle databases @param array $configuration @return array
[ "Creates", "the", "configuration", "mapping", "for", "Oracle", "databases" ]
703154d2285232cf9da714b2c1ca127499700ccb
https://github.com/mitchellvanw/laravel-doctrine/blob/703154d2285232cf9da714b2c1ca127499700ccb/src/Configuration/OCIMapper.php#L11-L32