repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
Adldap2/Adldap2-Laravel
src/Commands/Import.php
Import.sync
protected function sync(Model $model) { // Set the users LDAP identifier. $model->setAttribute( Resolver::getDatabaseIdColumn(), $this->getUserObjectGuid() ); foreach ($this->getLdapSyncAttributes() as $modelField => $ldapField) { // If the field is a loaded ...
php
protected function sync(Model $model) { // Set the users LDAP identifier. $model->setAttribute( Resolver::getDatabaseIdColumn(), $this->getUserObjectGuid() ); foreach ($this->getLdapSyncAttributes() as $modelField => $ldapField) { // If the field is a loaded ...
[ "protected", "function", "sync", "(", "Model", "$", "model", ")", "{", "// Set the users LDAP identifier.", "$", "model", "->", "setAttribute", "(", "Resolver", "::", "getDatabaseIdColumn", "(", ")", ",", "$", "this", "->", "getUserObjectGuid", "(", ")", ")", ...
Fills a models attributes by the specified Users attributes. @param Model $model @return void
[ "Fills", "a", "models", "attributes", "by", "the", "specified", "Users", "attributes", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Import.php#L121-L146
Adldap2/Adldap2-Laravel
src/Commands/Import.php
Import.getUserUsername
protected function getUserUsername() { $attribute = Resolver::getLdapDiscoveryAttribute(); $username = $this->user->getFirstAttribute($attribute); if (trim($username) == false) { throw new UnexpectedValueException( "Unable to locate a user without a {$attribute}...
php
protected function getUserUsername() { $attribute = Resolver::getLdapDiscoveryAttribute(); $username = $this->user->getFirstAttribute($attribute); if (trim($username) == false) { throw new UnexpectedValueException( "Unable to locate a user without a {$attribute}...
[ "protected", "function", "getUserUsername", "(", ")", "{", "$", "attribute", "=", "Resolver", "::", "getLdapDiscoveryAttribute", "(", ")", ";", "$", "username", "=", "$", "this", "->", "user", "->", "getFirstAttribute", "(", "$", "attribute", ")", ";", "if",...
Returns the LDAP users configured username. @return string @throws UnexpectedValueException
[ "Returns", "the", "LDAP", "users", "configured", "username", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Import.php#L155-L168
Adldap2/Adldap2-Laravel
src/Commands/Import.php
Import.getUserObjectGuid
protected function getUserObjectGuid() { $guid = $this->user->getConvertedGuid(); if (trim($guid) == false) { $attribute = $this->user->getSchema()->objectGuid(); throw new UnexpectedValueException( "Unable to locate a user without a {$attribute}" ...
php
protected function getUserObjectGuid() { $guid = $this->user->getConvertedGuid(); if (trim($guid) == false) { $attribute = $this->user->getSchema()->objectGuid(); throw new UnexpectedValueException( "Unable to locate a user without a {$attribute}" ...
[ "protected", "function", "getUserObjectGuid", "(", ")", "{", "$", "guid", "=", "$", "this", "->", "user", "->", "getConvertedGuid", "(", ")", ";", "if", "(", "trim", "(", "$", "guid", ")", "==", "false", ")", "{", "$", "attribute", "=", "$", "this", ...
Returns the LDAP users object GUID. @return string @throws UnexpectedValueException
[ "Returns", "the", "LDAP", "users", "object", "GUID", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Import.php#L177-L190
Adldap2/Adldap2-Laravel
src/Scopes/MemberOfScope.php
MemberOfScope.getSelectedAttributes
protected function getSelectedAttributes(Builder $builder) { $selected = $builder->getSelects(); return array_merge($selected, [ $builder->getSchema()->memberOf(), ]); }
php
protected function getSelectedAttributes(Builder $builder) { $selected = $builder->getSelects(); return array_merge($selected, [ $builder->getSchema()->memberOf(), ]); }
[ "protected", "function", "getSelectedAttributes", "(", "Builder", "$", "builder", ")", "{", "$", "selected", "=", "$", "builder", "->", "getSelects", "(", ")", ";", "return", "array_merge", "(", "$", "selected", ",", "[", "$", "builder", "->", "getSchema", ...
Retrieve the attributes to select for the scope. This merges the current queries selected attributes so we don't overwrite any other scopes selected attributes. @param Builder $builder @return array
[ "Retrieve", "the", "attributes", "to", "select", "for", "the", "scope", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Scopes/MemberOfScope.php#L27-L34
Adldap2/Adldap2-Laravel
src/Validation/Rules/DenyTrashed.php
DenyTrashed.isValid
public function isValid() { if ($this->isTrashed()) { Event::dispatch( new AuthenticatedModelTrashed($this->user, $this->model) ); return false; } return true; }
php
public function isValid() { if ($this->isTrashed()) { Event::dispatch( new AuthenticatedModelTrashed($this->user, $this->model) ); return false; } return true; }
[ "public", "function", "isValid", "(", ")", "{", "if", "(", "$", "this", "->", "isTrashed", "(", ")", ")", "{", "Event", "::", "dispatch", "(", "new", "AuthenticatedModelTrashed", "(", "$", "this", "->", "user", ",", "$", "this", "->", "model", ")", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Validation/Rules/DenyTrashed.php#L13-L24
Adldap2/Adldap2-Laravel
src/Traits/ValidatesUsers.php
ValidatesUsers.passesValidation
protected function passesValidation(User $user, Model $model = null) { return (new Validator( $this->rules($user, $model) ))->passes(); }
php
protected function passesValidation(User $user, Model $model = null) { return (new Validator( $this->rules($user, $model) ))->passes(); }
[ "protected", "function", "passesValidation", "(", "User", "$", "user", ",", "Model", "$", "model", "=", "null", ")", "{", "return", "(", "new", "Validator", "(", "$", "this", "->", "rules", "(", "$", "user", ",", "$", "model", ")", ")", ")", "->", ...
Determines if the model passes validation. @param User $user @param Model $model @return bool
[ "Determines", "if", "the", "model", "passes", "validation", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Traits/ValidatesUsers.php#L20-L25
Adldap2/Adldap2-Laravel
src/Traits/ValidatesUsers.php
ValidatesUsers.rules
protected function rules(User $user, Model $model = null) { $rules = []; foreach ($this->getRules() as $rule) { $rules[] = new $rule($user, $model); } return $rules; }
php
protected function rules(User $user, Model $model = null) { $rules = []; foreach ($this->getRules() as $rule) { $rules[] = new $rule($user, $model); } return $rules; }
[ "protected", "function", "rules", "(", "User", "$", "user", ",", "Model", "$", "model", "=", "null", ")", "{", "$", "rules", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getRules", "(", ")", "as", "$", "rule", ")", "{", "$", "rules", ...
Returns an array of constructed rules. @param User $user @param Model|null $model @return array
[ "Returns", "an", "array", "of", "constructed", "rules", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Traits/ValidatesUsers.php#L35-L44
Adldap2/Adldap2-Laravel
src/Listeners/BindsLdapUserModel.php
BindsLdapUserModel.handle
public function handle($event) { $guard = null; // We'll retrieve the auth guard if available. if (property_exists($event, 'guard')) { $guard = $event->guard; } // Before we bind the users LDAP model, we will verify they are using // the Adldap authentic...
php
public function handle($event) { $guard = null; // We'll retrieve the auth guard if available. if (property_exists($event, 'guard')) { $guard = $event->guard; } // Before we bind the users LDAP model, we will verify they are using // the Adldap authentic...
[ "public", "function", "handle", "(", "$", "event", ")", "{", "$", "guard", "=", "null", ";", "// We'll retrieve the auth guard if available.", "if", "(", "property_exists", "(", "$", "event", ",", "'guard'", ")", ")", "{", "$", "guard", "=", "$", "event", ...
Binds the LDAP user record to their model. @param \Illuminate\Auth\Events\Login|\Illuminate\Auth\Events\Authenticated $event @return void
[ "Binds", "the", "LDAP", "user", "record", "to", "their", "model", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Listeners/BindsLdapUserModel.php#L20-L36
Adldap2/Adldap2-Laravel
src/Listeners/BindsLdapUserModel.php
BindsLdapUserModel.canBind
protected function canBind(Authenticatable $user) : bool { return array_key_exists(HasLdapUser::class, class_uses_recursive($user)) && is_null($user->ldap); }
php
protected function canBind(Authenticatable $user) : bool { return array_key_exists(HasLdapUser::class, class_uses_recursive($user)) && is_null($user->ldap); }
[ "protected", "function", "canBind", "(", "Authenticatable", "$", "user", ")", ":", "bool", "{", "return", "array_key_exists", "(", "HasLdapUser", "::", "class", ",", "class_uses_recursive", "(", "$", "user", ")", ")", "&&", "is_null", "(", "$", "user", "->",...
Determines if we're able to bind to the user. @param Authenticatable $user @return bool
[ "Determines", "if", "we", "re", "able", "to", "bind", "to", "the", "user", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Listeners/BindsLdapUserModel.php#L57-L60
Adldap2/Adldap2-Laravel
src/Listeners/LogAuthentication.php
LogAuthentication.handle
public function handle(Authenticating $event) { $username = $this->getPrefix().$event->username.$this->getSuffix(); Log::info("User '{$event->user->getCommonName()}' is authenticating with username: '{$username}'"); }
php
public function handle(Authenticating $event) { $username = $this->getPrefix().$event->username.$this->getSuffix(); Log::info("User '{$event->user->getCommonName()}' is authenticating with username: '{$username}'"); }
[ "public", "function", "handle", "(", "Authenticating", "$", "event", ")", "{", "$", "username", "=", "$", "this", "->", "getPrefix", "(", ")", ".", "$", "event", "->", "username", ".", "$", "this", "->", "getSuffix", "(", ")", ";", "Log", "::", "info...
Handle the event. @param Authenticating $event @return void
[ "Handle", "the", "event", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Listeners/LogAuthentication.php#L18-L23
Adldap2/Adldap2-Laravel
src/AdldapAuthServiceProvider.php
AdldapAuthServiceProvider.boot
public function boot() { // Register the lDAP auth provider. Auth::provider('ldap', function ($app, array $config) { return $this->makeUserProvider($app['hash'], $config); }); if ($this->app->runningInConsole()) { $config = __DIR__ . '/Config/auth.php'; ...
php
public function boot() { // Register the lDAP auth provider. Auth::provider('ldap', function ($app, array $config) { return $this->makeUserProvider($app['hash'], $config); }); if ($this->app->runningInConsole()) { $config = __DIR__ . '/Config/auth.php'; ...
[ "public", "function", "boot", "(", ")", "{", "// Register the lDAP auth provider.", "Auth", "::", "provider", "(", "'ldap'", ",", "function", "(", "$", "app", ",", "array", "$", "config", ")", "{", "return", "$", "this", "->", "makeUserProvider", "(", "$", ...
Run service provider boot operations. @return void
[ "Run", "service", "provider", "boot", "operations", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/AdldapAuthServiceProvider.php#L26-L43
Adldap2/Adldap2-Laravel
src/AdldapAuthServiceProvider.php
AdldapAuthServiceProvider.register
public function register() { // Bind the user resolver instance into the IoC. $this->app->bind(ResolverInterface::class, function () { return new UserResolver( $this->app->make(AdldapInterface::class) ); }); // Here we will register the event ...
php
public function register() { // Bind the user resolver instance into the IoC. $this->app->bind(ResolverInterface::class, function () { return new UserResolver( $this->app->make(AdldapInterface::class) ); }); // Here we will register the event ...
[ "public", "function", "register", "(", ")", "{", "// Bind the user resolver instance into the IoC.", "$", "this", "->", "app", "->", "bind", "(", "ResolverInterface", "::", "class", ",", "function", "(", ")", "{", "return", "new", "UserResolver", "(", "$", "this...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/AdldapAuthServiceProvider.php#L50-L72
Adldap2/Adldap2-Laravel
src/AdldapAuthServiceProvider.php
AdldapAuthServiceProvider.makeUserProvider
protected function makeUserProvider(Hasher $hasher, array $config) { $provider = Config::get('ldap_auth.provider', DatabaseUserProvider::class); // The DatabaseUserProvider requires a model to be configured // in the configuration. We will validate this here. if (is_a($provider, Dat...
php
protected function makeUserProvider(Hasher $hasher, array $config) { $provider = Config::get('ldap_auth.provider', DatabaseUserProvider::class); // The DatabaseUserProvider requires a model to be configured // in the configuration. We will validate this here. if (is_a($provider, Dat...
[ "protected", "function", "makeUserProvider", "(", "Hasher", "$", "hasher", ",", "array", "$", "config", ")", "{", "$", "provider", "=", "Config", "::", "get", "(", "'ldap_auth.provider'", ",", "DatabaseUserProvider", "::", "class", ")", ";", "// The DatabaseUser...
Returns a new Adldap user provider. @param Hasher $hasher @param array $config @throws RuntimeException @return \Illuminate\Contracts\Auth\UserProvider
[ "Returns", "a", "new", "Adldap", "user", "provider", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/AdldapAuthServiceProvider.php#L84-L105
Adldap2/Adldap2-Laravel
src/Auth/NoDatabaseUserProvider.php
NoDatabaseUserProvider.retrieveById
public function retrieveById($identifier) { $user = Resolver::byId($identifier); // We'll verify we have the correct instance just to ensure we // don't return an incompatible model that may be returned. return $user instanceof Authenticatable ? $user : null; }
php
public function retrieveById($identifier) { $user = Resolver::byId($identifier); // We'll verify we have the correct instance just to ensure we // don't return an incompatible model that may be returned. return $user instanceof Authenticatable ? $user : null; }
[ "public", "function", "retrieveById", "(", "$", "identifier", ")", "{", "$", "user", "=", "Resolver", "::", "byId", "(", "$", "identifier", ")", ";", "// We'll verify we have the correct instance just to ensure we", "// don't return an incompatible model that may be returned....
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Auth/NoDatabaseUserProvider.php#L22-L29
Adldap2/Adldap2-Laravel
src/Auth/NoDatabaseUserProvider.php
NoDatabaseUserProvider.retrieveByCredentials
public function retrieveByCredentials(array $credentials) { if ($user = Resolver::byCredentials($credentials)) { Event::dispatch(new DiscoveredWithCredentials($user)); return $user; } }
php
public function retrieveByCredentials(array $credentials) { if ($user = Resolver::byCredentials($credentials)) { Event::dispatch(new DiscoveredWithCredentials($user)); return $user; } }
[ "public", "function", "retrieveByCredentials", "(", "array", "$", "credentials", ")", "{", "if", "(", "$", "user", "=", "Resolver", "::", "byCredentials", "(", "$", "credentials", ")", ")", "{", "Event", "::", "dispatch", "(", "new", "DiscoveredWithCredentials...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Auth/NoDatabaseUserProvider.php#L52-L59
Adldap2/Adldap2-Laravel
src/Auth/NoDatabaseUserProvider.php
NoDatabaseUserProvider.validateCredentials
public function validateCredentials(Authenticatable $user, array $credentials) { if (Resolver::authenticate($user, $credentials)) { Event::dispatch(new AuthenticatedWithCredentials($user)); if ($this->passesValidation($user)) { Event::dispatch(new AuthenticationSucce...
php
public function validateCredentials(Authenticatable $user, array $credentials) { if (Resolver::authenticate($user, $credentials)) { Event::dispatch(new AuthenticatedWithCredentials($user)); if ($this->passesValidation($user)) { Event::dispatch(new AuthenticationSucce...
[ "public", "function", "validateCredentials", "(", "Authenticatable", "$", "user", ",", "array", "$", "credentials", ")", "{", "if", "(", "Resolver", "::", "authenticate", "(", "$", "user", ",", "$", "credentials", ")", ")", "{", "Event", "::", "dispatch", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Auth/NoDatabaseUserProvider.php#L64-L79
Adldap2/Adldap2-Laravel
src/Commands/SyncPassword.php
SyncPassword.handle
public function handle() : Model { if ($this->hasPasswordColumn()) { $password = $this->canSync() ? $this->password() : Str::random(); if ($this->passwordNeedsUpdate($password)) { $this->applyPassword($password); } } retur...
php
public function handle() : Model { if ($this->hasPasswordColumn()) { $password = $this->canSync() ? $this->password() : Str::random(); if ($this->passwordNeedsUpdate($password)) { $this->applyPassword($password); } } retur...
[ "public", "function", "handle", "(", ")", ":", "Model", "{", "if", "(", "$", "this", "->", "hasPasswordColumn", "(", ")", ")", "{", "$", "password", "=", "$", "this", "->", "canSync", "(", ")", "?", "$", "this", "->", "password", "(", ")", ":", "...
Sets the password on the users model. @return Model
[ "Sets", "the", "password", "on", "the", "users", "model", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/SyncPassword.php#L43-L55
Adldap2/Adldap2-Laravel
src/Commands/SyncPassword.php
SyncPassword.applyPassword
protected function applyPassword($password) { // If the model has a mutator for the password field, we // can assume hashing passwords is taken care of. // Otherwise, we will hash it normally. $password = $this->model->hasSetMutator($this->column()) ? $password : Hash::make($password...
php
protected function applyPassword($password) { // If the model has a mutator for the password field, we // can assume hashing passwords is taken care of. // Otherwise, we will hash it normally. $password = $this->model->hasSetMutator($this->column()) ? $password : Hash::make($password...
[ "protected", "function", "applyPassword", "(", "$", "password", ")", "{", "// If the model has a mutator for the password field, we", "// can assume hashing passwords is taken care of.", "// Otherwise, we will hash it normally.", "$", "password", "=", "$", "this", "->", "model", ...
Applies the password to the users model. @param string $password @return void
[ "Applies", "the", "password", "to", "the", "users", "model", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/SyncPassword.php#L64-L72
Adldap2/Adldap2-Laravel
src/Commands/SyncPassword.php
SyncPassword.passwordNeedsUpdate
protected function passwordNeedsUpdate($password = null) : bool { $current = $this->currentModelPassword(); if ($current !== null && $this->canSync()) { return ! Hash::check($password, $current); } return is_null($current); }
php
protected function passwordNeedsUpdate($password = null) : bool { $current = $this->currentModelPassword(); if ($current !== null && $this->canSync()) { return ! Hash::check($password, $current); } return is_null($current); }
[ "protected", "function", "passwordNeedsUpdate", "(", "$", "password", "=", "null", ")", ":", "bool", "{", "$", "current", "=", "$", "this", "->", "currentModelPassword", "(", ")", ";", "if", "(", "$", "current", "!==", "null", "&&", "$", "this", "->", ...
Determines if the current model requires a password update. This checks if the model does not currently have a password, or if the password fails a hash check. @param string|null $password @return bool
[ "Determines", "if", "the", "current", "model", "requires", "a", "password", "update", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/SyncPassword.php#L84-L93
Adldap2/Adldap2-Laravel
src/Commands/Console/Import.php
Import.handle
public function handle() { $users = $this->getUsers(); $count = count($users); if ($count === 0) { throw new RuntimeException("There were no users found to import."); } else if ($count === 1) { $this->info("Found user '{$users[0]->getCommonName()}'."); ...
php
public function handle() { $users = $this->getUsers(); $count = count($users); if ($count === 0) { throw new RuntimeException("There were no users found to import."); } else if ($count === 1) { $this->info("Found user '{$users[0]->getCommonName()}'."); ...
[ "public", "function", "handle", "(", ")", "{", "$", "users", "=", "$", "this", "->", "getUsers", "(", ")", ";", "$", "count", "=", "count", "(", "$", "users", ")", ";", "if", "(", "$", "count", "===", "0", ")", "{", "throw", "new", "RuntimeExcept...
Execute the console command. @return void @throws RuntimeException @throws \Adldap\Models\ModelNotFoundException
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Console/Import.php#L55-L86
Adldap2/Adldap2-Laravel
src/Commands/Console/Import.php
Import.import
public function import(array $users = []) : int { $imported = 0; $this->output->progressStart(count($users)); foreach ($users as $user) { try { // Import the user and retrieve it's model. $model = Bus::dispatch( new ImportUser...
php
public function import(array $users = []) : int { $imported = 0; $this->output->progressStart(count($users)); foreach ($users as $user) { try { // Import the user and retrieve it's model. $model = Bus::dispatch( new ImportUser...
[ "public", "function", "import", "(", "array", "$", "users", "=", "[", "]", ")", ":", "int", "{", "$", "imported", "=", "0", ";", "$", "this", "->", "output", "->", "progressStart", "(", "count", "(", "$", "users", ")", ")", ";", "foreach", "(", "...
Imports the specified users and returns the total number of users successfully imported. @param array $users @return int
[ "Imports", "the", "specified", "users", "and", "returns", "the", "total", "number", "of", "users", "successfully", "imported", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Console/Import.php#L96-L137
Adldap2/Adldap2-Laravel
src/Commands/Console/Import.php
Import.display
public function display(array $users = []) { $headers = ['Name', 'Account Name', 'UPN']; $data = []; array_map(function (User $user) use (&$data) { $data[] = [ 'name' => $user->getCommonName(), 'account_name' => $user->getAccountName(), ...
php
public function display(array $users = []) { $headers = ['Name', 'Account Name', 'UPN']; $data = []; array_map(function (User $user) use (&$data) { $data[] = [ 'name' => $user->getCommonName(), 'account_name' => $user->getAccountName(), ...
[ "public", "function", "display", "(", "array", "$", "users", "=", "[", "]", ")", "{", "$", "headers", "=", "[", "'Name'", ",", "'Account Name'", ",", "'UPN'", "]", ";", "$", "data", "=", "[", "]", ";", "array_map", "(", "function", "(", "User", "$"...
Displays the given users in a table. @param array $users @return void
[ "Displays", "the", "given", "users", "in", "a", "table", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Console/Import.php#L146-L161
Adldap2/Adldap2-Laravel
src/Commands/Console/Import.php
Import.getUsers
public function getUsers() : array { /** @var \Adldap\Query\Builder $query */ $query = Resolver::query(); if ($filter = $this->option('filter')) { // If the filter option was given, we'll // insert it into our search query. $query->rawFilter($filter); ...
php
public function getUsers() : array { /** @var \Adldap\Query\Builder $query */ $query = Resolver::query(); if ($filter = $this->option('filter')) { // If the filter option was given, we'll // insert it into our search query. $query->rawFilter($filter); ...
[ "public", "function", "getUsers", "(", ")", ":", "array", "{", "/** @var \\Adldap\\Query\\Builder $query */", "$", "query", "=", "Resolver", "::", "query", "(", ")", ";", "if", "(", "$", "filter", "=", "$", "this", "->", "option", "(", "'filter'", ")", ")"...
Retrieves users to be imported. @return array @throws \Adldap\Models\ModelNotFoundException
[ "Retrieves", "users", "to", "be", "imported", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Console/Import.php#L202-L228
Adldap2/Adldap2-Laravel
src/Commands/Console/Import.php
Import.save
protected function save(User $user, Model $model) : bool { if ($model->save() && $model->wasRecentlyCreated) { Event::dispatch(new Imported($user, $model)); // Log the successful import. if ($this->isLogging()) { logger()->info("Imported user {$user->getC...
php
protected function save(User $user, Model $model) : bool { if ($model->save() && $model->wasRecentlyCreated) { Event::dispatch(new Imported($user, $model)); // Log the successful import. if ($this->isLogging()) { logger()->info("Imported user {$user->getC...
[ "protected", "function", "save", "(", "User", "$", "user", ",", "Model", "$", "model", ")", ":", "bool", "{", "if", "(", "$", "model", "->", "save", "(", ")", "&&", "$", "model", "->", "wasRecentlyCreated", ")", "{", "Event", "::", "dispatch", "(", ...
Saves the specified user with its model. @param User $user @param Model $model @return bool
[ "Saves", "the", "specified", "user", "with", "its", "model", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Console/Import.php#L238-L252
Adldap2/Adldap2-Laravel
src/Commands/Console/Import.php
Import.restore
protected function restore(User $user, Model $model) { if ( $this->isUsingSoftDeletes($model) && $model->trashed() && $user->isEnabled() ) { // If the model has soft-deletes enabled, the model is // currently deleted, and the LDAP user acco...
php
protected function restore(User $user, Model $model) { if ( $this->isUsingSoftDeletes($model) && $model->trashed() && $user->isEnabled() ) { // If the model has soft-deletes enabled, the model is // currently deleted, and the LDAP user acco...
[ "protected", "function", "restore", "(", "User", "$", "user", ",", "Model", "$", "model", ")", "{", "if", "(", "$", "this", "->", "isUsingSoftDeletes", "(", "$", "model", ")", "&&", "$", "model", "->", "trashed", "(", ")", "&&", "$", "user", "->", ...
Restores soft-deleted models if their LDAP account is enabled. @param User $user @param Model $model @return void
[ "Restores", "soft", "-", "deleted", "models", "if", "their", "LDAP", "account", "is", "enabled", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Console/Import.php#L262-L280
Adldap2/Adldap2-Laravel
src/Commands/Console/Import.php
Import.delete
protected function delete(User $user, Model $model) { if ( $this->isUsingSoftDeletes($model) && ! $model->trashed() && $user->isDisabled() ) { // If deleting is enabled, the model supports soft deletes, the model // isn't already deleted, a...
php
protected function delete(User $user, Model $model) { if ( $this->isUsingSoftDeletes($model) && ! $model->trashed() && $user->isDisabled() ) { // If deleting is enabled, the model supports soft deletes, the model // isn't already deleted, a...
[ "protected", "function", "delete", "(", "User", "$", "user", ",", "Model", "$", "model", ")", "{", "if", "(", "$", "this", "->", "isUsingSoftDeletes", "(", "$", "model", ")", "&&", "!", "$", "model", "->", "trashed", "(", ")", "&&", "$", "user", "-...
Soft deletes the specified model if their LDAP account is disabled. @param User $user @param Model $model @return void @throws Exception
[ "Soft", "deletes", "the", "specified", "model", "if", "their", "LDAP", "account", "is", "disabled", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Console/Import.php#L292-L310
Adldap2/Adldap2-Laravel
src/Commands/Console/Import.php
Import.model
protected function model() : Model { if (! $this->model) { $this->model = $this->option('model') ?? Config::get('ldap_auth.model') ?: $this->determineModel(); } return new $this->model; }
php
protected function model() : Model { if (! $this->model) { $this->model = $this->option('model') ?? Config::get('ldap_auth.model') ?: $this->determineModel(); } return new $this->model; }
[ "protected", "function", "model", "(", ")", ":", "Model", "{", "if", "(", "!", "$", "this", "->", "model", ")", "{", "$", "this", "->", "model", "=", "$", "this", "->", "option", "(", "'model'", ")", "??", "Config", "::", "get", "(", "'ldap_auth.mo...
Set and create a new instance of the eloquent model to use. @return Model
[ "Set", "and", "create", "a", "new", "instance", "of", "the", "eloquent", "model", "to", "use", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Console/Import.php#L317-L324
Adldap2/Adldap2-Laravel
src/Commands/Console/Import.php
Import.determineModel
protected function determineModel() { // Retrieve all of the configured authentication providers that // use the LDAP driver and have a configured model. $providers = array_where(Config::get('auth.providers'), function ($value, $key) { return $value['driver'] == 'ldap' && array_k...
php
protected function determineModel() { // Retrieve all of the configured authentication providers that // use the LDAP driver and have a configured model. $providers = array_where(Config::get('auth.providers'), function ($value, $key) { return $value['driver'] == 'ldap' && array_k...
[ "protected", "function", "determineModel", "(", ")", "{", "// Retrieve all of the configured authentication providers that", "// use the LDAP driver and have a configured model.", "$", "providers", "=", "array_where", "(", "Config", "::", "get", "(", "'auth.providers'", ")", ",...
Retrieves the model by checking the configured LDAP authentication providers. @return string @throws UnexpectedValueException
[ "Retrieves", "the", "model", "by", "checking", "the", "configured", "LDAP", "authentication", "providers", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/Commands/Console/Import.php#L333-L349
Adldap2/Adldap2-Laravel
src/AdldapServiceProvider.php
AdldapServiceProvider.boot
public function boot() { if (Config::get('ldap.logging')) { Adldap::setLogger(logger()); } if ($this->isLumen()) { return; } if ($this->app->runningInConsole()) { $config = __DIR__ . '/Config/config.php'; $this->publishes([ ...
php
public function boot() { if (Config::get('ldap.logging')) { Adldap::setLogger(logger()); } if ($this->isLumen()) { return; } if ($this->app->runningInConsole()) { $config = __DIR__ . '/Config/config.php'; $this->publishes([ ...
[ "public", "function", "boot", "(", ")", "{", "if", "(", "Config", "::", "get", "(", "'ldap.logging'", ")", ")", "{", "Adldap", "::", "setLogger", "(", "logger", "(", ")", ")", ";", "}", "if", "(", "$", "this", "->", "isLumen", "(", ")", ")", "{",...
Run service provider boot operations. @return void
[ "Run", "service", "provider", "boot", "operations", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/AdldapServiceProvider.php#L29-L46
Adldap2/Adldap2-Laravel
src/AdldapServiceProvider.php
AdldapServiceProvider.register
public function register() { // Bind the Adldap contract to the Adldap object // in the IoC for dependency injection. $this->app->singleton(AdldapInterface::class, function (Container $app) { $config = $app->make('config')->get('ldap'); // Verify configuration exists...
php
public function register() { // Bind the Adldap contract to the Adldap object // in the IoC for dependency injection. $this->app->singleton(AdldapInterface::class, function (Container $app) { $config = $app->make('config')->get('ldap'); // Verify configuration exists...
[ "public", "function", "register", "(", ")", "{", "// Bind the Adldap contract to the Adldap object", "// in the IoC for dependency injection.", "$", "this", "->", "app", "->", "singleton", "(", "AdldapInterface", "::", "class", ",", "function", "(", "Container", "$", "a...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/AdldapServiceProvider.php#L53-L69
Adldap2/Adldap2-Laravel
src/AdldapServiceProvider.php
AdldapServiceProvider.addProviders
protected function addProviders(Adldap $adldap, array $connections = []) { // Go through each connection and construct a Provider. foreach ($connections as $name => $config) { // Create a new provider. $provider = $this->newProvider( $config['settings'], ...
php
protected function addProviders(Adldap $adldap, array $connections = []) { // Go through each connection and construct a Provider. foreach ($connections as $name => $config) { // Create a new provider. $provider = $this->newProvider( $config['settings'], ...
[ "protected", "function", "addProviders", "(", "Adldap", "$", "adldap", ",", "array", "$", "connections", "=", "[", "]", ")", "{", "// Go through each connection and construct a Provider.", "foreach", "(", "$", "connections", "as", "$", "name", "=>", "$", "config",...
Adds providers to the specified Adldap instance. If a provider is configured to auto connect, this method will throw a BindException. @param Adldap $adldap @param array $connections @throws \Adldap\Auth\BindException @return Adldap
[ "Adds", "providers", "to", "the", "specified", "Adldap", "instance", "." ]
train
https://github.com/Adldap2/Adldap2-Laravel/blob/a14d5040bfec62a2e57718d3565341333e4068f2/src/AdldapServiceProvider.php#L94-L120
liip/LiipImagineBundle
Imagine/Cache/Resolver/ProxyResolver.php
ProxyResolver.store
public function store(BinaryInterface $binary, $targetPath, $filter) { return $this->resolver->store($binary, $targetPath, $filter); }
php
public function store(BinaryInterface $binary, $targetPath, $filter) { return $this->resolver->store($binary, $targetPath, $filter); }
[ "public", "function", "store", "(", "BinaryInterface", "$", "binary", ",", "$", "targetPath", ",", "$", "filter", ")", "{", "return", "$", "this", "->", "resolver", "->", "store", "(", "$", "binary", ",", "$", "targetPath", ",", "$", "filter", ")", ";"...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/ProxyResolver.php#L56-L59
liip/LiipImagineBundle
Imagine/Cache/Resolver/ProxyResolver.php
ProxyResolver.rewriteUrl
protected function rewriteUrl($url) { if (empty($this->hosts)) { return $url; } $randKey = array_rand($this->hosts, 1); // BC if (is_numeric($randKey)) { $host = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST); $proxyH...
php
protected function rewriteUrl($url) { if (empty($this->hosts)) { return $url; } $randKey = array_rand($this->hosts, 1); // BC if (is_numeric($randKey)) { $host = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST); $proxyH...
[ "protected", "function", "rewriteUrl", "(", "$", "url", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "hosts", ")", ")", "{", "return", "$", "url", ";", "}", "$", "randKey", "=", "array_rand", "(", "$", "this", "->", "hosts", ",", "1", ")...
@param $url @return string
[ "@param", "$url" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/ProxyResolver.php#L82-L105
liip/LiipImagineBundle
Factory/Config/Filter/ThumbnailFactory.php
ThumbnailFactory.create
public function create(array $options): FilterInterface { $size = $this->sizeFactory->createFromOptions($options); $mode = $options['mode'] ?? null; $allowUpscale = $options['allow_upscale'] ?? null; $filter = $options['filter'] ?? null; return new Thumbnail($size, $mode, $a...
php
public function create(array $options): FilterInterface { $size = $this->sizeFactory->createFromOptions($options); $mode = $options['mode'] ?? null; $allowUpscale = $options['allow_upscale'] ?? null; $filter = $options['filter'] ?? null; return new Thumbnail($size, $mode, $a...
[ "public", "function", "create", "(", "array", "$", "options", ")", ":", "FilterInterface", "{", "$", "size", "=", "$", "this", "->", "sizeFactory", "->", "createFromOptions", "(", "$", "options", ")", ";", "$", "mode", "=", "$", "options", "[", "'mode'",...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/Filter/ThumbnailFactory.php#L46-L54
liip/LiipImagineBundle
Imagine/Cache/Resolver/AbstractFilesystemResolver.php
AbstractFilesystemResolver.store
public function store(BinaryInterface $binary, $path, $filter) { $filePath = $this->getFilePath($path, $filter); $dir = pathinfo($filePath, PATHINFO_DIRNAME); $this->makeFolder($dir); file_put_contents($filePath, $binary->getContent()); }
php
public function store(BinaryInterface $binary, $path, $filter) { $filePath = $this->getFilePath($path, $filter); $dir = pathinfo($filePath, PATHINFO_DIRNAME); $this->makeFolder($dir); file_put_contents($filePath, $binary->getContent()); }
[ "public", "function", "store", "(", "BinaryInterface", "$", "binary", ",", "$", "path", ",", "$", "filter", ")", "{", "$", "filePath", "=", "$", "this", "->", "getFilePath", "(", "$", "path", ",", "$", "filter", ")", ";", "$", "dir", "=", "pathinfo",...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AbstractFilesystemResolver.php#L102-L111
liip/LiipImagineBundle
Imagine/Cache/Resolver/AbstractFilesystemResolver.php
AbstractFilesystemResolver.remove
public function remove(array $paths, array $filters) { if (empty($paths) && empty($filters)) { return; } // TODO: this logic has to be refactored. [$rootCachePath] = explode(current($filters), $this->getFilePath('whateverpath', current($filters))); if (empty($pa...
php
public function remove(array $paths, array $filters) { if (empty($paths) && empty($filters)) { return; } // TODO: this logic has to be refactored. [$rootCachePath] = explode(current($filters), $this->getFilePath('whateverpath', current($filters))); if (empty($pa...
[ "public", "function", "remove", "(", "array", "$", "paths", ",", "array", "$", "filters", ")", "{", "if", "(", "empty", "(", "$", "paths", ")", "&&", "empty", "(", "$", "filters", ")", ")", "{", "return", ";", "}", "// TODO: this logic has to be refactor...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AbstractFilesystemResolver.php#L116-L144
liip/LiipImagineBundle
Imagine/Cache/Resolver/AbstractFilesystemResolver.php
AbstractFilesystemResolver.makeFolder
protected function makeFolder($dir) { if (!is_dir($dir)) { $parent = \dirname($dir); try { $this->makeFolder($parent); $this->filesystem->mkdir($dir); $this->filesystem->chmod($dir, $this->folderPermissions); } catch (IOExce...
php
protected function makeFolder($dir) { if (!is_dir($dir)) { $parent = \dirname($dir); try { $this->makeFolder($parent); $this->filesystem->mkdir($dir); $this->filesystem->chmod($dir, $this->folderPermissions); } catch (IOExce...
[ "protected", "function", "makeFolder", "(", "$", "dir", ")", "{", "if", "(", "!", "is_dir", "(", "$", "dir", ")", ")", "{", "$", "parent", "=", "\\", "dirname", "(", "$", "dir", ")", ";", "try", "{", "$", "this", "->", "makeFolder", "(", "$", "...
@param string $dir @throws \RuntimeException
[ "@param", "string", "$dir" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AbstractFilesystemResolver.php#L165-L177
liip/LiipImagineBundle
DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php
FileSystemLoaderFactory.create
public function create(ContainerBuilder $container, $loaderName, array $config) { $locatorDefinition = new ChildDefinition(sprintf('liip_imagine.binary.locator.%s', $config['locator'])); $locatorDefinition->replaceArgument(0, $this->resolveDataRoots($config['data_root'], $config['bundle_resources'],...
php
public function create(ContainerBuilder $container, $loaderName, array $config) { $locatorDefinition = new ChildDefinition(sprintf('liip_imagine.binary.locator.%s', $config['locator'])); $locatorDefinition->replaceArgument(0, $this->resolveDataRoots($config['data_root'], $config['bundle_resources'],...
[ "public", "function", "create", "(", "ContainerBuilder", "$", "container", ",", "$", "loaderName", ",", "array", "$", "config", ")", "{", "$", "locatorDefinition", "=", "new", "ChildDefinition", "(", "sprintf", "(", "'liip_imagine.binary.locator.%s'", ",", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php#L25-L34
liip/LiipImagineBundle
DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php
FileSystemLoaderFactory.addConfiguration
public function addConfiguration(ArrayNodeDefinition $builder) { $builder ->children() ->enumNode('locator') ->values(['filesystem', 'filesystem_insecure']) ->info('Using the "filesystem_insecure" locator is not recommended due to a less se...
php
public function addConfiguration(ArrayNodeDefinition $builder) { $builder ->children() ->enumNode('locator') ->values(['filesystem', 'filesystem_insecure']) ->info('Using the "filesystem_insecure" locator is not recommended due to a less se...
[ "public", "function", "addConfiguration", "(", "ArrayNodeDefinition", "$", "builder", ")", "{", "$", "builder", "->", "children", "(", ")", "->", "enumNode", "(", "'locator'", ")", "->", "values", "(", "[", "'filesystem'", ",", "'filesystem_insecure'", "]", ")...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php#L47-L90
liip/LiipImagineBundle
DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php
FileSystemLoaderFactory.resolveDataRoots
private function resolveDataRoots(array $staticPaths, array $config, ContainerBuilder $container) { if (false === $config['enabled']) { return $staticPaths; } $resourcePaths = []; foreach ($this->getBundleResourcePaths($container) as $name => $path) { if (('...
php
private function resolveDataRoots(array $staticPaths, array $config, ContainerBuilder $container) { if (false === $config['enabled']) { return $staticPaths; } $resourcePaths = []; foreach ($this->getBundleResourcePaths($container) as $name => $path) { if (('...
[ "private", "function", "resolveDataRoots", "(", "array", "$", "staticPaths", ",", "array", "$", "config", ",", "ContainerBuilder", "$", "container", ")", "{", "if", "(", "false", "===", "$", "config", "[", "'enabled'", "]", ")", "{", "return", "$", "static...
/* @param string[] $staticPaths @param array $config @param ContainerBuilder $container @return string[]
[ "/", "*", "@param", "string", "[]", "$staticPaths", "@param", "array", "$config", "@param", "ContainerBuilder", "$container" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php#L99-L114
liip/LiipImagineBundle
DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php
FileSystemLoaderFactory.getBundleResourcePaths
private function getBundleResourcePaths(ContainerBuilder $container) { if ($container->hasParameter('kernel.bundles_metadata')) { $paths = $this->getBundlePathsUsingMetadata($container->getParameter('kernel.bundles_metadata')); } else { $paths = $this->getBundlePathsUsingName...
php
private function getBundleResourcePaths(ContainerBuilder $container) { if ($container->hasParameter('kernel.bundles_metadata')) { $paths = $this->getBundlePathsUsingMetadata($container->getParameter('kernel.bundles_metadata')); } else { $paths = $this->getBundlePathsUsingName...
[ "private", "function", "getBundleResourcePaths", "(", "ContainerBuilder", "$", "container", ")", "{", "if", "(", "$", "container", "->", "hasParameter", "(", "'kernel.bundles_metadata'", ")", ")", "{", "$", "paths", "=", "$", "this", "->", "getBundlePathsUsingMeta...
@param ContainerBuilder $container @return string[]
[ "@param", "ContainerBuilder", "$container" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php#L121-L132
liip/LiipImagineBundle
DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php
FileSystemLoaderFactory.getBundlePathsUsingNamedObj
private function getBundlePathsUsingNamedObj(array $classes) { $paths = []; foreach ($classes as $c) { try { $r = new \ReflectionClass($c); } catch (\ReflectionException $exception) { throw new InvalidArgumentException(sprintf('Unable to resol...
php
private function getBundlePathsUsingNamedObj(array $classes) { $paths = []; foreach ($classes as $c) { try { $r = new \ReflectionClass($c); } catch (\ReflectionException $exception) { throw new InvalidArgumentException(sprintf('Unable to resol...
[ "private", "function", "getBundlePathsUsingNamedObj", "(", "array", "$", "classes", ")", "{", "$", "paths", "=", "[", "]", ";", "foreach", "(", "$", "classes", "as", "$", "c", ")", "{", "try", "{", "$", "r", "=", "new", "\\", "ReflectionClass", "(", ...
@param string[] $classes @return string[]
[ "@param", "string", "[]", "$classes" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Loader/FileSystemLoaderFactory.php#L151-L166
liip/LiipImagineBundle
DependencyInjection/Factory/Loader/AbstractLoaderFactory.php
AbstractLoaderFactory.setTaggedLoaderDefinition
final protected function setTaggedLoaderDefinition($name, Definition $definition, ContainerBuilder $container) { $definition->addTag(static::$namePrefix, [ 'loader' => $name, ]); $definition->setPublic(true); $container->setDefinition( $id = sprintf('%s.%s',...
php
final protected function setTaggedLoaderDefinition($name, Definition $definition, ContainerBuilder $container) { $definition->addTag(static::$namePrefix, [ 'loader' => $name, ]); $definition->setPublic(true); $container->setDefinition( $id = sprintf('%s.%s',...
[ "final", "protected", "function", "setTaggedLoaderDefinition", "(", "$", "name", ",", "Definition", "$", "definition", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "definition", "->", "addTag", "(", "static", "::", "$", "namePrefix", ",", "[", "'l...
@param string $name @param Definition $definition @param ContainerBuilder $container @return string
[ "@param", "string", "$name", "@param", "Definition", "$definition", "@param", "ContainerBuilder", "$container" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Loader/AbstractLoaderFactory.php#L40-L54
liip/LiipImagineBundle
Imagine/Filter/Loader/InterlaceFilterLoader.php
InterlaceFilterLoader.load
public function load(ImageInterface $image, array $options = []) { $mode = ImageInterface::INTERLACE_LINE; if (!empty($options['mode'])) { $mode = $options['mode']; } $image->interlace($mode); return $image; }
php
public function load(ImageInterface $image, array $options = []) { $mode = ImageInterface::INTERLACE_LINE; if (!empty($options['mode'])) { $mode = $options['mode']; } $image->interlace($mode); return $image; }
[ "public", "function", "load", "(", "ImageInterface", "$", "image", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "mode", "=", "ImageInterface", "::", "INTERLACE_LINE", ";", "if", "(", "!", "empty", "(", "$", "options", "[", "'mode'", "]",...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/InterlaceFilterLoader.php#L21-L31
liip/LiipImagineBundle
Factory/Config/Filter/UpscaleFactory.php
UpscaleFactory.create
public function create(array $options): FilterInterface { $min = $this->sizeFactory->createFromOptions($options, 'min'); $by = isset($options['by']) ? (float) $options['by'] : null; return new Upscale($min, $by); }
php
public function create(array $options): FilterInterface { $min = $this->sizeFactory->createFromOptions($options, 'min'); $by = isset($options['by']) ? (float) $options['by'] : null; return new Upscale($min, $by); }
[ "public", "function", "create", "(", "array", "$", "options", ")", ":", "FilterInterface", "{", "$", "min", "=", "$", "this", "->", "sizeFactory", "->", "createFromOptions", "(", "$", "options", ",", "'min'", ")", ";", "$", "by", "=", "isset", "(", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/Filter/UpscaleFactory.php#L46-L52
liip/LiipImagineBundle
Imagine/Filter/Loader/ResizeFilterLoader.php
ResizeFilterLoader.load
public function load(ImageInterface $image, array $options = []) { $width = isset($options['size'][0]) ? $options['size'][0] : null; $height = isset($options['size'][1]) ? $options['size'][1] : null; $filter = new Resize(new Box($width, $height)); return $filter->apply($image); ...
php
public function load(ImageInterface $image, array $options = []) { $width = isset($options['size'][0]) ? $options['size'][0] : null; $height = isset($options['size'][1]) ? $options['size'][1] : null; $filter = new Resize(new Box($width, $height)); return $filter->apply($image); ...
[ "public", "function", "load", "(", "ImageInterface", "$", "image", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "width", "=", "isset", "(", "$", "options", "[", "'size'", "]", "[", "0", "]", ")", "?", "$", "options", "[", "'size'", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/ResizeFilterLoader.php#L28-L36
liip/LiipImagineBundle
Imagine/Filter/Loader/AutoRotateFilterLoader.php
AutoRotateFilterLoader.load
public function load(ImageInterface $image, array $options = []) { if (null !== $orientation = $this->getOrientation($image)) { if ($orientation < 1 || $orientation > 8) { return $image; } // Rotates if necessary. $degree = $this->calculateRot...
php
public function load(ImageInterface $image, array $options = []) { if (null !== $orientation = $this->getOrientation($image)) { if ($orientation < 1 || $orientation > 8) { return $image; } // Rotates if necessary. $degree = $this->calculateRot...
[ "public", "function", "load", "(", "ImageInterface", "$", "image", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "null", "!==", "$", "orientation", "=", "$", "this", "->", "getOrientation", "(", "$", "image", ")", ")", "{", "if", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/AutoRotateFilterLoader.php#L31-L51
liip/LiipImagineBundle
Imagine/Filter/Loader/AutoRotateFilterLoader.php
AutoRotateFilterLoader.getOrientation
private function getOrientation(ImageInterface $image) { foreach ($this->orientationKeys as $orientationKey) { $orientation = $image->metadata()->offsetGet($orientationKey); if ($orientation) { $image->metadata()->offsetSet($orientationKey, '1'); ret...
php
private function getOrientation(ImageInterface $image) { foreach ($this->orientationKeys as $orientationKey) { $orientation = $image->metadata()->offsetGet($orientationKey); if ($orientation) { $image->metadata()->offsetSet($orientationKey, '1'); ret...
[ "private", "function", "getOrientation", "(", "ImageInterface", "$", "image", ")", "{", "foreach", "(", "$", "this", "->", "orientationKeys", "as", "$", "orientationKey", ")", "{", "$", "orientation", "=", "$", "image", "->", "metadata", "(", ")", "->", "o...
@param ImageInterface $image @return int|null
[ "@param", "ImageInterface", "$image" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/AutoRotateFilterLoader.php#L83-L96
liip/LiipImagineBundle
Factory/Config/StackFactory.php
StackFactory.create
public function create(string $name, string $dataLoader = null, int $quality = null, array $filters): StackInterface { return new Stack($name, $dataLoader, $quality, $filters); }
php
public function create(string $name, string $dataLoader = null, int $quality = null, array $filters): StackInterface { return new Stack($name, $dataLoader, $quality, $filters); }
[ "public", "function", "create", "(", "string", "$", "name", ",", "string", "$", "dataLoader", "=", "null", ",", "int", "$", "quality", "=", "null", ",", "array", "$", "filters", ")", ":", "StackInterface", "{", "return", "new", "Stack", "(", "$", "name...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/StackFactory.php#L25-L28
liip/LiipImagineBundle
Factory/Config/Filter/DownscaleFactory.php
DownscaleFactory.create
public function create(array $options): FilterInterface { $max = $this->sizeFactory->createFromOptions($options, 'max'); $by = isset($options['by']) ? (float) $options['by'] : null; return new Downscale($max, $by); }
php
public function create(array $options): FilterInterface { $max = $this->sizeFactory->createFromOptions($options, 'max'); $by = isset($options['by']) ? (float) $options['by'] : null; return new Downscale($max, $by); }
[ "public", "function", "create", "(", "array", "$", "options", ")", ":", "FilterInterface", "{", "$", "max", "=", "$", "this", "->", "sizeFactory", "->", "createFromOptions", "(", "$", "options", ",", "'max'", ")", ";", "$", "by", "=", "isset", "(", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/Filter/DownscaleFactory.php#L46-L52
liip/LiipImagineBundle
Utility/Framework/SymfonyFramework.php
SymfonyFramework.isKernelGreaterThanOrEqualTo
public static function isKernelGreaterThanOrEqualTo(int $major, int $minor = null, int $patch = null): bool { return static::kernelVersionCompare('>=', $major, $minor, $patch); }
php
public static function isKernelGreaterThanOrEqualTo(int $major, int $minor = null, int $patch = null): bool { return static::kernelVersionCompare('>=', $major, $minor, $patch); }
[ "public", "static", "function", "isKernelGreaterThanOrEqualTo", "(", "int", "$", "major", ",", "int", "$", "minor", "=", "null", ",", "int", "$", "patch", "=", "null", ")", ":", "bool", "{", "return", "static", "::", "kernelVersionCompare", "(", "'>='", ",...
@param int $major @param int|null $minor @param int|null $patch @return bool
[ "@param", "int", "$major", "@param", "int|null", "$minor", "@param", "int|null", "$patch" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Utility/Framework/SymfonyFramework.php#L33-L36
liip/LiipImagineBundle
Utility/Framework/SymfonyFramework.php
SymfonyFramework.isKernelLessThan
public static function isKernelLessThan(int $major, int $minor = null, int $patch = null): bool { return static::kernelVersionCompare('<', $major, $minor, $patch); }
php
public static function isKernelLessThan(int $major, int $minor = null, int $patch = null): bool { return static::kernelVersionCompare('<', $major, $minor, $patch); }
[ "public", "static", "function", "isKernelLessThan", "(", "int", "$", "major", ",", "int", "$", "minor", "=", "null", ",", "int", "$", "patch", "=", "null", ")", ":", "bool", "{", "return", "static", "::", "kernelVersionCompare", "(", "'<'", ",", "$", "...
@param int $major @param int|null $minor @param int|null $patch @return bool
[ "@param", "int", "$major", "@param", "int|null", "$minor", "@param", "int|null", "$patch" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Utility/Framework/SymfonyFramework.php#L45-L48
liip/LiipImagineBundle
Utility/Framework/SymfonyFramework.php
SymfonyFramework.kernelVersionCompare
private static function kernelVersionCompare(string $operator, int $major, int $minor = null, int $patch = null): bool { return version_compare(Kernel::VERSION_ID, sprintf("%d%'.02d%'.02d", $major, $minor ?: 0, $patch ?: 0), $operator); }
php
private static function kernelVersionCompare(string $operator, int $major, int $minor = null, int $patch = null): bool { return version_compare(Kernel::VERSION_ID, sprintf("%d%'.02d%'.02d", $major, $minor ?: 0, $patch ?: 0), $operator); }
[ "private", "static", "function", "kernelVersionCompare", "(", "string", "$", "operator", ",", "int", "$", "major", ",", "int", "$", "minor", "=", "null", ",", "int", "$", "patch", "=", "null", ")", ":", "bool", "{", "return", "version_compare", "(", "Ker...
@param string $operator @param int $major @param int|null $minor @param int|null $patch @return bool
[ "@param", "string", "$operator", "@param", "int", "$major", "@param", "int|null", "$minor", "@param", "int|null", "$patch" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Utility/Framework/SymfonyFramework.php#L58-L61
liip/LiipImagineBundle
Imagine/Filter/Loader/ScaleFilterLoader.php
ScaleFilterLoader.load
public function load(ImageInterface $image, array $options = []) { if (!isset($options[$this->dimensionKey]) && !isset($options[$this->ratioKey])) { throw new \InvalidArgumentException("Missing $this->dimensionKey or $this->ratioKey option."); } $size = $image->getSize(); ...
php
public function load(ImageInterface $image, array $options = []) { if (!isset($options[$this->dimensionKey]) && !isset($options[$this->ratioKey])) { throw new \InvalidArgumentException("Missing $this->dimensionKey or $this->ratioKey option."); } $size = $image->getSize(); ...
[ "public", "function", "load", "(", "ImageInterface", "$", "image", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "options", "[", "$", "this", "->", "dimensionKey", "]", ")", "&&", "!", "isset", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/ScaleFilterLoader.php#L50-L85
liip/LiipImagineBundle
Templating/FilterTrait.php
FilterTrait.filter
public function filter($path, $filter, array $config = [], $resolver = null) { return $this->cache->getBrowserPath(parse_url($path, PHP_URL_PATH), $filter, $config, $resolver); }
php
public function filter($path, $filter, array $config = [], $resolver = null) { return $this->cache->getBrowserPath(parse_url($path, PHP_URL_PATH), $filter, $config, $resolver); }
[ "public", "function", "filter", "(", "$", "path", ",", "$", "filter", ",", "array", "$", "config", "=", "[", "]", ",", "$", "resolver", "=", "null", ")", "{", "return", "$", "this", "->", "cache", "->", "getBrowserPath", "(", "parse_url", "(", "$", ...
Gets the browser path for the image and filter to apply. @param string $path @param string $filter @param array $config @param string|null $resolver @return string
[ "Gets", "the", "browser", "path", "for", "the", "image", "and", "filter", "to", "apply", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Templating/FilterTrait.php#L41-L44
liip/LiipImagineBundle
DependencyInjection/Factory/Loader/ChainLoaderFactory.php
ChainLoaderFactory.create
public function create(ContainerBuilder $container, $loaderName, array $config): string { $definition = $this->getChildLoaderDefinition(); $definition->replaceArgument(0, $this->createLoaderReferences($config['loaders'])); return $this->setTaggedLoaderDefinition($loaderName, $definition, $c...
php
public function create(ContainerBuilder $container, $loaderName, array $config): string { $definition = $this->getChildLoaderDefinition(); $definition->replaceArgument(0, $this->createLoaderReferences($config['loaders'])); return $this->setTaggedLoaderDefinition($loaderName, $definition, $c...
[ "public", "function", "create", "(", "ContainerBuilder", "$", "container", ",", "$", "loaderName", ",", "array", "$", "config", ")", ":", "string", "{", "$", "definition", "=", "$", "this", "->", "getChildLoaderDefinition", "(", ")", ";", "$", "definition", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Loader/ChainLoaderFactory.php#L23-L29
liip/LiipImagineBundle
DependencyInjection/Factory/Loader/ChainLoaderFactory.php
ChainLoaderFactory.addConfiguration
public function addConfiguration(ArrayNodeDefinition $builder): void { $builder ->children() ->arrayNode('loaders') ->isRequired() ->prototype('scalar') ->cannotBeEmpty() ->end() -...
php
public function addConfiguration(ArrayNodeDefinition $builder): void { $builder ->children() ->arrayNode('loaders') ->isRequired() ->prototype('scalar') ->cannotBeEmpty() ->end() -...
[ "public", "function", "addConfiguration", "(", "ArrayNodeDefinition", "$", "builder", ")", ":", "void", "{", "$", "builder", "->", "children", "(", ")", "->", "arrayNode", "(", "'loaders'", ")", "->", "isRequired", "(", ")", "->", "prototype", "(", "'scalar'...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Loader/ChainLoaderFactory.php#L42-L53
liip/LiipImagineBundle
DependencyInjection/Factory/Loader/ChainLoaderFactory.php
ChainLoaderFactory.createLoaderReferences
private function createLoaderReferences(array $loaders): array { return array_combine($loaders, array_map(function ($name) { return new Reference(sprintf('liip_imagine.binary.loader.%s', $name)); }, $loaders)); }
php
private function createLoaderReferences(array $loaders): array { return array_combine($loaders, array_map(function ($name) { return new Reference(sprintf('liip_imagine.binary.loader.%s', $name)); }, $loaders)); }
[ "private", "function", "createLoaderReferences", "(", "array", "$", "loaders", ")", ":", "array", "{", "return", "array_combine", "(", "$", "loaders", ",", "array_map", "(", "function", "(", "$", "name", ")", "{", "return", "new", "Reference", "(", "sprintf"...
@param string[] $loaders @return string[]
[ "@param", "string", "[]", "$loaders" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Loader/ChainLoaderFactory.php#L60-L65
liip/LiipImagineBundle
Imagine/Filter/Loader/CropFilterLoader.php
CropFilterLoader.load
public function load(ImageInterface $image, array $options = []) { $x = isset($options['start'][0]) ? $options['start'][0] : null; $y = isset($options['start'][1]) ? $options['start'][1] : null; $width = isset($options['size'][0]) ? $options['size'][0] : null; $height = isset($optio...
php
public function load(ImageInterface $image, array $options = []) { $x = isset($options['start'][0]) ? $options['start'][0] : null; $y = isset($options['start'][1]) ? $options['start'][1] : null; $width = isset($options['size'][0]) ? $options['size'][0] : null; $height = isset($optio...
[ "public", "function", "load", "(", "ImageInterface", "$", "image", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "x", "=", "isset", "(", "$", "options", "[", "'start'", "]", "[", "0", "]", ")", "?", "$", "options", "[", "'start'", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/CropFilterLoader.php#L24-L36
liip/LiipImagineBundle
Factory/Config/Filter/RelativeResizeFactory.php
RelativeResizeFactory.create
public function create(array $options): FilterInterface { $heighten = $options['heighten'] ?? null; $widen = $options['widen'] ?? null; $increase = $options['increase'] ?? null; $scale = $options['scale'] ?? null; return new RelativeResize($heighten, $widen, $increase, $scal...
php
public function create(array $options): FilterInterface { $heighten = $options['heighten'] ?? null; $widen = $options['widen'] ?? null; $increase = $options['increase'] ?? null; $scale = $options['scale'] ?? null; return new RelativeResize($heighten, $widen, $increase, $scal...
[ "public", "function", "create", "(", "array", "$", "options", ")", ":", "FilterInterface", "{", "$", "heighten", "=", "$", "options", "[", "'heighten'", "]", "??", "null", ";", "$", "widen", "=", "$", "options", "[", "'widen'", "]", "??", "null", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/Filter/RelativeResizeFactory.php#L35-L43
liip/LiipImagineBundle
Config/FilterFactoryCollection.php
FilterFactoryCollection.getFilterFactoryByName
public function getFilterFactoryByName(string $name): FilterFactoryInterface { if (!isset($this->filterFactories[$name])) { throw new NotFoundException(sprintf("Filter factory with name '%s' was not found.", $name)); } return $this->filterFactories[$name]; }
php
public function getFilterFactoryByName(string $name): FilterFactoryInterface { if (!isset($this->filterFactories[$name])) { throw new NotFoundException(sprintf("Filter factory with name '%s' was not found.", $name)); } return $this->filterFactories[$name]; }
[ "public", "function", "getFilterFactoryByName", "(", "string", "$", "name", ")", ":", "FilterFactoryInterface", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "filterFactories", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "NotFoundException"...
@param string $name @throws NotFoundException @return FilterFactoryInterface
[ "@param", "string", "$name" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Config/FilterFactoryCollection.php#L41-L48
liip/LiipImagineBundle
Imagine/Filter/PostProcessor/MozJpegPostProcessor.php
MozJpegPostProcessor.process
public function process(BinaryInterface $binary, array $options = []): BinaryInterface { $type = mb_strtolower($binary->getMimeType()); if (!\in_array($type, ['image/jpeg', 'image/jpg'], true)) { return $binary; } $processArguments = [$this->mozjpegBin]; // Plac...
php
public function process(BinaryInterface $binary, array $options = []): BinaryInterface { $type = mb_strtolower($binary->getMimeType()); if (!\in_array($type, ['image/jpeg', 'image/jpg'], true)) { return $binary; } $processArguments = [$this->mozjpegBin]; // Plac...
[ "public", "function", "process", "(", "BinaryInterface", "$", "binary", ",", "array", "$", "options", "=", "[", "]", ")", ":", "BinaryInterface", "{", "$", "type", "=", "mb_strtolower", "(", "$", "binary", "->", "getMimeType", "(", ")", ")", ";", "if", ...
@param BinaryInterface $binary @param array $options @throws ProcessFailedException @return BinaryInterface
[ "@param", "BinaryInterface", "$binary", "@param", "array", "$options" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/PostProcessor/MozJpegPostProcessor.php#L73-L106
liip/LiipImagineBundle
Imagine/Filter/Loader/WatermarkFilterLoader.php
WatermarkFilterLoader.load
public function load(ImageInterface $image, array $options = []) { $options += [ 'size' => null, 'position' => 'center', ]; if ('%' === mb_substr($options['size'], -1)) { $options['size'] = mb_substr($options['size'], 0, -1) / 100; } $wat...
php
public function load(ImageInterface $image, array $options = []) { $options += [ 'size' => null, 'position' => 'center', ]; if ('%' === mb_substr($options['size'], -1)) { $options['size'] = mb_substr($options['size'], 0, -1) / 100; } $wat...
[ "public", "function", "load", "(", "ImageInterface", "$", "image", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "[", "'size'", "=>", "null", ",", "'position'", "=>", "'center'", ",", "]", ";", "if", "(", "'%'", "===", ...
@see \Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface::load() @param ImageInterface $image @param array $options @return ImageInterface|static
[ "@see", "\\", "Liip", "\\", "ImagineBundle", "\\", "Imagine", "\\", "Filter", "\\", "Loader", "\\", "LoaderInterface", "::", "load", "()" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/WatermarkFilterLoader.php#L45-L116
liip/LiipImagineBundle
Imagine/Filter/Loader/ThumbnailFilterLoader.php
ThumbnailFilterLoader.load
public function load(ImageInterface $image, array $options = []) { $mode = ImageInterface::THUMBNAIL_OUTBOUND; if (!empty($options['mode']) && 'inset' === $options['mode']) { $mode = ImageInterface::THUMBNAIL_INSET; } if (!empty($options['filter'])) { $filter...
php
public function load(ImageInterface $image, array $options = []) { $mode = ImageInterface::THUMBNAIL_OUTBOUND; if (!empty($options['mode']) && 'inset' === $options['mode']) { $mode = ImageInterface::THUMBNAIL_INSET; } if (!empty($options['filter'])) { $filter...
[ "public", "function", "load", "(", "ImageInterface", "$", "image", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "mode", "=", "ImageInterface", "::", "THUMBNAIL_OUTBOUND", ";", "if", "(", "!", "empty", "(", "$", "options", "[", "'mode'", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/ThumbnailFilterLoader.php#L23-L60
liip/LiipImagineBundle
Async/CacheResolved.php
CacheResolved.jsonDeserialize
public static function jsonDeserialize(string $json): self { $data = JSON::decode($json); if (empty($data['path'])) { throw new LogicException('The message does not contain "path" but it is required.'); } if (empty($data['uris'])) { throw new LogicException(...
php
public static function jsonDeserialize(string $json): self { $data = JSON::decode($json); if (empty($data['path'])) { throw new LogicException('The message does not contain "path" but it is required.'); } if (empty($data['uris'])) { throw new LogicException(...
[ "public", "static", "function", "jsonDeserialize", "(", "string", "$", "json", ")", ":", "self", "{", "$", "data", "=", "JSON", "::", "decode", "(", "$", "json", ")", ";", "if", "(", "empty", "(", "$", "data", "[", "'path'", "]", ")", ")", "{", "...
@param string $json @return self
[ "@param", "string", "$json" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Async/CacheResolved.php#L68-L81
liip/LiipImagineBundle
Imagine/Cache/CacheManager.php
CacheManager.addResolver
public function addResolver($filter, ResolverInterface $resolver) { $this->resolvers[$filter] = $resolver; if ($resolver instanceof CacheManagerAwareInterface) { $resolver->setCacheManager($this); } }
php
public function addResolver($filter, ResolverInterface $resolver) { $this->resolvers[$filter] = $resolver; if ($resolver instanceof CacheManagerAwareInterface) { $resolver->setCacheManager($this); } }
[ "public", "function", "addResolver", "(", "$", "filter", ",", "ResolverInterface", "$", "resolver", ")", "{", "$", "this", "->", "resolvers", "[", "$", "filter", "]", "=", "$", "resolver", ";", "if", "(", "$", "resolver", "instanceof", "CacheManagerAwareInte...
Adds a resolver to handle cached images for the given filter. @param string $filter @param ResolverInterface $resolver
[ "Adds", "a", "resolver", "to", "handle", "cached", "images", "for", "the", "given", "filter", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/CacheManager.php#L85-L92
liip/LiipImagineBundle
Imagine/Cache/CacheManager.php
CacheManager.getBrowserPath
public function getBrowserPath($path, $filter, array $runtimeConfig = [], $resolver = null) { if (!empty($runtimeConfig)) { $rcPath = $this->getRuntimePath($path, $runtimeConfig); return $this->isStored($rcPath, $filter, $resolver) ? $this->resolve($rcPath, $filter, ...
php
public function getBrowserPath($path, $filter, array $runtimeConfig = [], $resolver = null) { if (!empty($runtimeConfig)) { $rcPath = $this->getRuntimePath($path, $runtimeConfig); return $this->isStored($rcPath, $filter, $resolver) ? $this->resolve($rcPath, $filter, ...
[ "public", "function", "getBrowserPath", "(", "$", "path", ",", "$", "filter", ",", "array", "$", "runtimeConfig", "=", "[", "]", ",", "$", "resolver", "=", "null", ")", "{", "if", "(", "!", "empty", "(", "$", "runtimeConfig", ")", ")", "{", "$", "r...
Gets filtered path for rendering in the browser. It could be the cached one or an url of filter action. @param string $path The path where the resolved file is expected @param string $filter @param array $runtimeConfig @param string $resolver @return string
[ "Gets", "filtered", "path", "for", "rendering", "in", "the", "browser", ".", "It", "could", "be", "the", "cached", "one", "or", "an", "url", "of", "filter", "action", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/CacheManager.php#L105-L118
liip/LiipImagineBundle
Imagine/Cache/CacheManager.php
CacheManager.generateUrl
public function generateUrl($path, $filter, array $runtimeConfig = [], $resolver = null) { $params = [ 'path' => ltrim($path, '/'), 'filter' => $filter, ]; if ($resolver) { $params['resolver'] = $resolver; } if (empty($runtimeConfig)) { ...
php
public function generateUrl($path, $filter, array $runtimeConfig = [], $resolver = null) { $params = [ 'path' => ltrim($path, '/'), 'filter' => $filter, ]; if ($resolver) { $params['resolver'] = $resolver; } if (empty($runtimeConfig)) { ...
[ "public", "function", "generateUrl", "(", "$", "path", ",", "$", "filter", ",", "array", "$", "runtimeConfig", "=", "[", "]", ",", "$", "resolver", "=", "null", ")", "{", "$", "params", "=", "[", "'path'", "=>", "ltrim", "(", "$", "path", ",", "'/'...
Returns a web accessible URL. @param string $path The path where the resolved file is expected @param string $filter The name of the imagine filter in effect @param array $runtimeConfig @param string $resolver @return string
[ "Returns", "a", "web", "accessible", "URL", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/CacheManager.php#L143-L164
liip/LiipImagineBundle
Imagine/Cache/CacheManager.php
CacheManager.isStored
public function isStored($path, $filter, $resolver = null) { return $this->getResolver($filter, $resolver)->isStored($path, $filter); }
php
public function isStored($path, $filter, $resolver = null) { return $this->getResolver($filter, $resolver)->isStored($path, $filter); }
[ "public", "function", "isStored", "(", "$", "path", ",", "$", "filter", ",", "$", "resolver", "=", "null", ")", "{", "return", "$", "this", "->", "getResolver", "(", "$", "filter", ",", "$", "resolver", ")", "->", "isStored", "(", "$", "path", ",", ...
Checks whether the path is already stored within the respective Resolver. @param string $path @param string $filter @param string $resolver @return bool
[ "Checks", "whether", "the", "path", "is", "already", "stored", "within", "the", "respective", "Resolver", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/CacheManager.php#L175-L178
liip/LiipImagineBundle
Imagine/Cache/CacheManager.php
CacheManager.resolve
public function resolve($path, $filter, $resolver = null) { if (false !== mb_strpos($path, '/../') || 0 === mb_strpos($path, '../')) { throw new NotFoundHttpException(sprintf("Source image was searched with '%s' outside of the defined root path", $path)); } $preEvent = new Cache...
php
public function resolve($path, $filter, $resolver = null) { if (false !== mb_strpos($path, '/../') || 0 === mb_strpos($path, '../')) { throw new NotFoundHttpException(sprintf("Source image was searched with '%s' outside of the defined root path", $path)); } $preEvent = new Cache...
[ "public", "function", "resolve", "(", "$", "path", ",", "$", "filter", ",", "$", "resolver", "=", "null", ")", "{", "if", "(", "false", "!==", "mb_strpos", "(", "$", "path", ",", "'/../'", ")", "||", "0", "===", "mb_strpos", "(", "$", "path", ",", ...
Resolves filtered path for rendering in the browser. @param string $path @param string $filter @param string $resolver @throws NotFoundHttpException if the path can not be resolved @return string The url of resolved image
[ "Resolves", "filtered", "path", "for", "rendering", "in", "the", "browser", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/CacheManager.php#L191-L206
liip/LiipImagineBundle
Imagine/Cache/CacheManager.php
CacheManager.store
public function store(BinaryInterface $binary, $path, $filter, $resolver = null) { $this->getResolver($filter, $resolver)->store($binary, $path, $filter); }
php
public function store(BinaryInterface $binary, $path, $filter, $resolver = null) { $this->getResolver($filter, $resolver)->store($binary, $path, $filter); }
[ "public", "function", "store", "(", "BinaryInterface", "$", "binary", ",", "$", "path", ",", "$", "filter", ",", "$", "resolver", "=", "null", ")", "{", "$", "this", "->", "getResolver", "(", "$", "filter", ",", "$", "resolver", ")", "->", "store", "...
@see ResolverInterface::store @param BinaryInterface $binary @param string $path @param string $filter @param string $resolver
[ "@see", "ResolverInterface", "::", "store" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/CacheManager.php#L216-L219
liip/LiipImagineBundle
Imagine/Cache/CacheManager.php
CacheManager.getResolver
protected function getResolver($filter, $resolver) { // BC if (!$resolver) { $config = $this->filterConfig->get($filter); $resolverName = empty($config['cache']) ? $this->defaultResolver : $config['cache']; } else { $resolverName = $resolver; } ...
php
protected function getResolver($filter, $resolver) { // BC if (!$resolver) { $config = $this->filterConfig->get($filter); $resolverName = empty($config['cache']) ? $this->defaultResolver : $config['cache']; } else { $resolverName = $resolver; } ...
[ "protected", "function", "getResolver", "(", "$", "filter", ",", "$", "resolver", ")", "{", "// BC", "if", "(", "!", "$", "resolver", ")", "{", "$", "config", "=", "$", "this", "->", "filterConfig", "->", "get", "(", "$", "filter", ")", ";", "$", "...
Gets a resolver for the given filter. In case there is no specific resolver, but a default resolver has been configured, the default will be returned. @param string $filter @param string $resolver @throws \OutOfBoundsException If neither a specific nor a default resolver is available @return ResolverInterface
[ "Gets", "a", "resolver", "for", "the", "given", "filter", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/CacheManager.php#L267-L287
liip/LiipImagineBundle
Factory/Config/Filter/CropFactory.php
CropFactory.create
public function create(array $options): FilterInterface { return new Crop( $this->pointFactory->createFromOptions($options, 'start'), $this->sizeFactory->createFromOptions($options) ); }
php
public function create(array $options): FilterInterface { return new Crop( $this->pointFactory->createFromOptions($options, 'start'), $this->sizeFactory->createFromOptions($options) ); }
[ "public", "function", "create", "(", "array", "$", "options", ")", ":", "FilterInterface", "{", "return", "new", "Crop", "(", "$", "this", "->", "pointFactory", "->", "createFromOptions", "(", "$", "options", ",", "'start'", ")", ",", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/Filter/CropFactory.php#L53-L59
liip/LiipImagineBundle
DependencyInjection/Factory/Resolver/FlysystemResolverFactory.php
FlysystemResolverFactory.create
public function create(ContainerBuilder $container, $resolverName, array $config) { $resolverDefinition = $this->getChildResolverDefinition(); $resolverDefinition->replaceArgument(0, new Reference($config['filesystem_service'])); $resolverDefinition->replaceArgument(2, $config['root_url']); ...
php
public function create(ContainerBuilder $container, $resolverName, array $config) { $resolverDefinition = $this->getChildResolverDefinition(); $resolverDefinition->replaceArgument(0, new Reference($config['filesystem_service'])); $resolverDefinition->replaceArgument(2, $config['root_url']); ...
[ "public", "function", "create", "(", "ContainerBuilder", "$", "container", ",", "$", "resolverName", ",", "array", "$", "config", ")", "{", "$", "resolverDefinition", "=", "$", "this", "->", "getChildResolverDefinition", "(", ")", ";", "$", "resolverDefinition",...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Resolver/FlysystemResolverFactory.php#L23-L38
liip/LiipImagineBundle
DependencyInjection/Factory/Resolver/FlysystemResolverFactory.php
FlysystemResolverFactory.addConfiguration
public function addConfiguration(ArrayNodeDefinition $builder) { $builder ->children() ->scalarNode('filesystem_service') ->isRequired() ->cannotBeEmpty() ->end() ->scalarNode('cache_prefix') ...
php
public function addConfiguration(ArrayNodeDefinition $builder) { $builder ->children() ->scalarNode('filesystem_service') ->isRequired() ->cannotBeEmpty() ->end() ->scalarNode('cache_prefix') ...
[ "public", "function", "addConfiguration", "(", "ArrayNodeDefinition", "$", "builder", ")", "{", "$", "builder", "->", "children", "(", ")", "->", "scalarNode", "(", "'filesystem_service'", ")", "->", "isRequired", "(", ")", "->", "cannotBeEmpty", "(", ")", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Resolver/FlysystemResolverFactory.php#L51-L71
liip/LiipImagineBundle
Imagine/Cache/Resolver/AwsS3Resolver.php
AwsS3Resolver.store
public function store(BinaryInterface $binary, $path, $filter) { $objectPath = $this->getObjectPath($path, $filter); try { $this->storage->putObject( array_merge( $this->putOptions, [ 'ACL' => $this->acl, ...
php
public function store(BinaryInterface $binary, $path, $filter) { $objectPath = $this->getObjectPath($path, $filter); try { $this->storage->putObject( array_merge( $this->putOptions, [ 'ACL' => $this->acl, ...
[ "public", "function", "store", "(", "BinaryInterface", "$", "binary", ",", "$", "path", ",", "$", "filter", ")", "{", "$", "objectPath", "=", "$", "this", "->", "getObjectPath", "(", "$", "path", ",", "$", "filter", ")", ";", "try", "{", "$", "this",...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AwsS3Resolver.php#L111-L138
liip/LiipImagineBundle
Imagine/Cache/Resolver/AwsS3Resolver.php
AwsS3Resolver.remove
public function remove(array $paths, array $filters) { if (empty($paths) && empty($filters)) { return; } if (empty($paths)) { try { $this->storage->deleteMatchingObjects($this->bucket, null, sprintf( '/%s/i', im...
php
public function remove(array $paths, array $filters) { if (empty($paths) && empty($filters)) { return; } if (empty($paths)) { try { $this->storage->deleteMatchingObjects($this->bucket, null, sprintf( '/%s/i', im...
[ "public", "function", "remove", "(", "array", "$", "paths", ",", "array", "$", "filters", ")", "{", "if", "(", "empty", "(", "$", "paths", ")", "&&", "empty", "(", "$", "filters", ")", ")", "{", "return", ";", "}", "if", "(", "empty", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AwsS3Resolver.php#L143-L188
liip/LiipImagineBundle
Imagine/Cache/Resolver/AwsS3Resolver.php
AwsS3Resolver.getObjectPath
protected function getObjectPath($path, $filter) { $path = $this->cachePrefix ? sprintf('%s/%s/%s', $this->cachePrefix, $filter, $path) : sprintf('%s/%s', $filter, $path); return str_replace('//', '/', $path); }
php
protected function getObjectPath($path, $filter) { $path = $this->cachePrefix ? sprintf('%s/%s/%s', $this->cachePrefix, $filter, $path) : sprintf('%s/%s', $filter, $path); return str_replace('//', '/', $path); }
[ "protected", "function", "getObjectPath", "(", "$", "path", ",", "$", "filter", ")", "{", "$", "path", "=", "$", "this", "->", "cachePrefix", "?", "sprintf", "(", "'%s/%s/%s'", ",", "$", "this", "->", "cachePrefix", ",", "$", "filter", ",", "$", "path"...
Returns the object path within the bucket. @param string $path The base path of the resource @param string $filter The name of the imagine filter in effect @return string The path of the object on S3
[ "Returns", "the", "object", "path", "within", "the", "bucket", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AwsS3Resolver.php#L236-L243
liip/LiipImagineBundle
Imagine/Cache/Resolver/AwsS3Resolver.php
AwsS3Resolver.getObjectUrl
protected function getObjectUrl($path) { return $this->storage->getObjectUrl($this->bucket, $path, 0, $this->getOptions); }
php
protected function getObjectUrl($path) { return $this->storage->getObjectUrl($this->bucket, $path, 0, $this->getOptions); }
[ "protected", "function", "getObjectUrl", "(", "$", "path", ")", "{", "return", "$", "this", "->", "storage", "->", "getObjectUrl", "(", "$", "this", "->", "bucket", ",", "$", "path", ",", "0", ",", "$", "this", "->", "getOptions", ")", ";", "}" ]
Returns the URL for an object saved on Amazon S3. @param string $path @return string
[ "Returns", "the", "URL", "for", "an", "object", "saved", "on", "Amazon", "S3", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AwsS3Resolver.php#L252-L255
liip/LiipImagineBundle
DependencyInjection/Compiler/DriverCompilerPass.php
DriverCompilerPass.process
public function process(ContainerBuilder $container) { $liipImagineDriver = $container->getParameter('liip_imagine.driver_service'); if (!$container->hasDefinition($liipImagineDriver)) { throw new InvalidConfigurationException(sprintf( "Specified driver '%s' is not defin...
php
public function process(ContainerBuilder $container) { $liipImagineDriver = $container->getParameter('liip_imagine.driver_service'); if (!$container->hasDefinition($liipImagineDriver)) { throw new InvalidConfigurationException(sprintf( "Specified driver '%s' is not defin...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "liipImagineDriver", "=", "$", "container", "->", "getParameter", "(", "'liip_imagine.driver_service'", ")", ";", "if", "(", "!", "$", "container", "->", "hasDefinition", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Compiler/DriverCompilerPass.php#L27-L36
liip/LiipImagineBundle
Factory/Config/Filter/WatermarkFactory.php
WatermarkFactory.create
public function create(array $options): FilterInterface { $size = $options['size'] ?? null; if (null !== $size) { $size = (float) $size; } $position = isset($options['position']) ? $options['position'] : 'center'; return new Watermark($options['image'], $positio...
php
public function create(array $options): FilterInterface { $size = $options['size'] ?? null; if (null !== $size) { $size = (float) $size; } $position = isset($options['position']) ? $options['position'] : 'center'; return new Watermark($options['image'], $positio...
[ "public", "function", "create", "(", "array", "$", "options", ")", ":", "FilterInterface", "{", "$", "size", "=", "$", "options", "[", "'size'", "]", "??", "null", ";", "if", "(", "null", "!==", "$", "size", ")", "{", "$", "size", "=", "(", "float"...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/Filter/WatermarkFactory.php#L35-L45
liip/LiipImagineBundle
Imagine/Filter/Loader/FlipFilterLoader.php
FlipFilterLoader.load
public function load(ImageInterface $image, array $options = []) { $options = $this->sanitizeOptions($options); return 'x' === $options['axis'] ? $image->flipHorizontally() : $image->flipVertically(); }
php
public function load(ImageInterface $image, array $options = []) { $options = $this->sanitizeOptions($options); return 'x' === $options['axis'] ? $image->flipHorizontally() : $image->flipVertically(); }
[ "public", "function", "load", "(", "ImageInterface", "$", "image", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "=", "$", "this", "->", "sanitizeOptions", "(", "$", "options", ")", ";", "return", "'x'", "===", "$", "options", ...
@param ImageInterface $image @param array $options @return ImageInterface
[ "@param", "ImageInterface", "$image", "@param", "array", "$options" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/FlipFilterLoader.php#L28-L33
liip/LiipImagineBundle
Imagine/Filter/Loader/FlipFilterLoader.php
FlipFilterLoader.sanitizeOptions
private function sanitizeOptions(array $options) { $resolver = new OptionsResolver(); $resolver->setDefault('axis', 'x'); $resolver->setAllowedValues('axis', ['x', 'horizontal', 'y', 'vertical']); $resolver->setNormalizer('axis', function (Options $options, $value) { retu...
php
private function sanitizeOptions(array $options) { $resolver = new OptionsResolver(); $resolver->setDefault('axis', 'x'); $resolver->setAllowedValues('axis', ['x', 'horizontal', 'y', 'vertical']); $resolver->setNormalizer('axis', function (Options $options, $value) { retu...
[ "private", "function", "sanitizeOptions", "(", "array", "$", "options", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefault", "(", "'axis'", ",", "'x'", ")", ";", "$", "resolver", "->", "setAllowedVal...
@param array $options @return array
[ "@param", "array", "$options" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/FlipFilterLoader.php#L40-L54
liip/LiipImagineBundle
Imagine/Cache/Resolver/FlysystemResolver.php
FlysystemResolver.isStored
public function isStored($path, $filter) { return $this->flysystem->has($this->getFilePath($path, $filter)); }
php
public function isStored($path, $filter) { return $this->flysystem->has($this->getFilePath($path, $filter)); }
[ "public", "function", "isStored", "(", "$", "path", ",", "$", "filter", ")", "{", "return", "$", "this", "->", "flysystem", "->", "has", "(", "$", "this", "->", "getFilePath", "(", "$", "path", ",", "$", "filter", ")", ")", ";", "}" ]
Checks whether the given path is stored within this Resolver. @param string $path @param string $filter @return bool
[ "Checks", "whether", "the", "given", "path", "is", "stored", "within", "this", "Resolver", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/FlysystemResolver.php#L89-L92
liip/LiipImagineBundle
Imagine/Cache/Resolver/FlysystemResolver.php
FlysystemResolver.resolve
public function resolve($path, $filter) { return sprintf( '%s/%s', $this->webRoot, $this->getFileUrl($path, $filter) ); }
php
public function resolve($path, $filter) { return sprintf( '%s/%s', $this->webRoot, $this->getFileUrl($path, $filter) ); }
[ "public", "function", "resolve", "(", "$", "path", ",", "$", "filter", ")", "{", "return", "sprintf", "(", "'%s/%s'", ",", "$", "this", "->", "webRoot", ",", "$", "this", "->", "getFileUrl", "(", "$", "path", ",", "$", "filter", ")", ")", ";", "}" ...
Resolves filtered path for rendering in the browser. @param string $path The path where the original file is expected to be @param string $filter The name of the imagine filter in effect @throws NotResolvableException @return string The absolute URL of the cached image
[ "Resolves", "filtered", "path", "for", "rendering", "in", "the", "browser", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/FlysystemResolver.php#L104-L111
liip/LiipImagineBundle
Imagine/Cache/Resolver/FlysystemResolver.php
FlysystemResolver.store
public function store(BinaryInterface $binary, $path, $filter) { $this->flysystem->put( $this->getFilePath($path, $filter), $binary->getContent(), ['visibility' => $this->visibility] ); }
php
public function store(BinaryInterface $binary, $path, $filter) { $this->flysystem->put( $this->getFilePath($path, $filter), $binary->getContent(), ['visibility' => $this->visibility] ); }
[ "public", "function", "store", "(", "BinaryInterface", "$", "binary", ",", "$", "path", ",", "$", "filter", ")", "{", "$", "this", "->", "flysystem", "->", "put", "(", "$", "this", "->", "getFilePath", "(", "$", "path", ",", "$", "filter", ")", ",", ...
Stores the content of the given binary. @param BinaryInterface $binary The image binary to store @param string $path The path where the original file is expected to be @param string $filter The name of the imagine filter in effect
[ "Stores", "the", "content", "of", "the", "given", "binary", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/FlysystemResolver.php#L120-L127
liip/LiipImagineBundle
Imagine/Cache/Resolver/FlysystemResolver.php
FlysystemResolver.getFileUrl
protected function getFileUrl($path, $filter) { // crude way of sanitizing URL scheme ("protocol") part $path = str_replace('://', '---', $path); return $this->cachePrefix.'/'.$filter.'/'.ltrim($path, '/'); }
php
protected function getFileUrl($path, $filter) { // crude way of sanitizing URL scheme ("protocol") part $path = str_replace('://', '---', $path); return $this->cachePrefix.'/'.$filter.'/'.ltrim($path, '/'); }
[ "protected", "function", "getFileUrl", "(", "$", "path", ",", "$", "filter", ")", "{", "// crude way of sanitizing URL scheme (\"protocol\") part", "$", "path", "=", "str_replace", "(", "'://'", ",", "'---'", ",", "$", "path", ")", ";", "return", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/FlysystemResolver.php#L168-L174
liip/LiipImagineBundle
Factory/Config/Filter/BackgroundFactory.php
BackgroundFactory.create
public function create(array $options): FilterInterface { $color = $options['color'] ?? null; $transparency = $options['transparency'] ?? null; $position = $options['position'] ?? null; $size = $this->sizeFactory->createFromOptions($options); return new Background($color, $t...
php
public function create(array $options): FilterInterface { $color = $options['color'] ?? null; $transparency = $options['transparency'] ?? null; $position = $options['position'] ?? null; $size = $this->sizeFactory->createFromOptions($options); return new Background($color, $t...
[ "public", "function", "create", "(", "array", "$", "options", ")", ":", "FilterInterface", "{", "$", "color", "=", "$", "options", "[", "'color'", "]", "??", "null", ";", "$", "transparency", "=", "$", "options", "[", "'transparency'", "]", "??", "null",...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/Filter/BackgroundFactory.php#L46-L54
liip/LiipImagineBundle
Binary/Loader/FileSystemLoader.php
FileSystemLoader.find
public function find($path) { $path = $this->locator->locate($path); $mime = $this->mimeTypeGuesser->guess($path); return new FileBinary($path, $mime, $this->extensionGuesser->guess($mime)); }
php
public function find($path) { $path = $this->locator->locate($path); $mime = $this->mimeTypeGuesser->guess($path); return new FileBinary($path, $mime, $this->extensionGuesser->guess($mime)); }
[ "public", "function", "find", "(", "$", "path", ")", "{", "$", "path", "=", "$", "this", "->", "locator", "->", "locate", "(", "$", "path", ")", ";", "$", "mime", "=", "$", "this", "->", "mimeTypeGuesser", "->", "guess", "(", "$", "path", ")", ";...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Loader/FileSystemLoader.php#L54-L60
liip/LiipImagineBundle
Imagine/Filter/Loader/PasteFilterLoader.php
PasteFilterLoader.load
public function load(ImageInterface $image, array $options = []) { $x = isset($options['start'][0]) ? $options['start'][0] : null; $y = isset($options['start'][1]) ? $options['start'][1] : null; $destImage = $this->imagine->open($this->rootPath.'/'.$options['image']); return $image...
php
public function load(ImageInterface $image, array $options = []) { $x = isset($options['start'][0]) ? $options['start'][0] : null; $y = isset($options['start'][1]) ? $options['start'][1] : null; $destImage = $this->imagine->open($this->rootPath.'/'.$options['image']); return $image...
[ "public", "function", "load", "(", "ImageInterface", "$", "image", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "x", "=", "isset", "(", "$", "options", "[", "'start'", "]", "[", "0", "]", ")", "?", "$", "options", "[", "'start'", "...
@see \Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface::load() @param ImageInterface $image @param array $options @return ImageInterface|static
[ "@see", "\\", "Liip", "\\", "ImagineBundle", "\\", "Imagine", "\\", "Filter", "\\", "Loader", "\\", "LoaderInterface", "::", "load", "()" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/PasteFilterLoader.php#L44-L52
liip/LiipImagineBundle
Service/FilterService.php
FilterService.getUrlOfFilteredImage
public function getUrlOfFilteredImage($path, $filter, $resolver = null) { if ($this->cacheManager->isStored($path, $filter, $resolver)) { return $this->cacheManager->resolve($path, $filter, $resolver); } $filteredBinary = $this->createFilteredBinary( $path, ...
php
public function getUrlOfFilteredImage($path, $filter, $resolver = null) { if ($this->cacheManager->isStored($path, $filter, $resolver)) { return $this->cacheManager->resolve($path, $filter, $resolver); } $filteredBinary = $this->createFilteredBinary( $path, ...
[ "public", "function", "getUrlOfFilteredImage", "(", "$", "path", ",", "$", "filter", ",", "$", "resolver", "=", "null", ")", "{", "if", "(", "$", "this", "->", "cacheManager", "->", "isStored", "(", "$", "path", ",", "$", "filter", ",", "$", "resolver"...
@param string $path @param string $filter @param string $resolver @return string
[ "@param", "string", "$path", "@param", "string", "$filter", "@param", "string", "$resolver" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Service/FilterService.php#L82-L101
liip/LiipImagineBundle
Service/FilterService.php
FilterService.getUrlOfFilteredImageWithRuntimeFilters
public function getUrlOfFilteredImageWithRuntimeFilters($path, $filter, array $runtimeFilters = [], $resolver = null) { $runtimePath = $this->cacheManager->getRuntimePath($path, $runtimeFilters); if ($this->cacheManager->isStored($runtimePath, $filter, $resolver)) { return $this->cacheMa...
php
public function getUrlOfFilteredImageWithRuntimeFilters($path, $filter, array $runtimeFilters = [], $resolver = null) { $runtimePath = $this->cacheManager->getRuntimePath($path, $runtimeFilters); if ($this->cacheManager->isStored($runtimePath, $filter, $resolver)) { return $this->cacheMa...
[ "public", "function", "getUrlOfFilteredImageWithRuntimeFilters", "(", "$", "path", ",", "$", "filter", ",", "array", "$", "runtimeFilters", "=", "[", "]", ",", "$", "resolver", "=", "null", ")", "{", "$", "runtimePath", "=", "$", "this", "->", "cacheManager"...
@param string $path @param string $filter @param array $runtimeFilters @param string|null $resolver @return string
[ "@param", "string", "$path", "@param", "string", "$filter", "@param", "array", "$runtimeFilters", "@param", "string|null", "$resolver" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Service/FilterService.php#L111-L132
liip/LiipImagineBundle
Service/FilterService.php
FilterService.createFilteredBinary
private function createFilteredBinary($path, $filter, array $runtimeFilters = []) { $binary = $this->dataManager->find($filter, $path); try { return $this->filterManager->applyFilter($binary, $filter, [ 'filters' => $runtimeFilters, ]); } catch (NonEx...
php
private function createFilteredBinary($path, $filter, array $runtimeFilters = []) { $binary = $this->dataManager->find($filter, $path); try { return $this->filterManager->applyFilter($binary, $filter, [ 'filters' => $runtimeFilters, ]); } catch (NonEx...
[ "private", "function", "createFilteredBinary", "(", "$", "path", ",", "$", "filter", ",", "array", "$", "runtimeFilters", "=", "[", "]", ")", "{", "$", "binary", "=", "$", "this", "->", "dataManager", "->", "find", "(", "$", "filter", ",", "$", "path",...
@param string $path @param string $filter @param array $runtimeFilters @throws NonExistingFilterException @return BinaryInterface
[ "@param", "string", "$path", "@param", "string", "$filter", "@param", "array", "$runtimeFilters" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Service/FilterService.php#L143-L158
liip/LiipImagineBundle
Binary/Locator/FileSystemInsecureLocator.php
FileSystemInsecureLocator.generateAbsolutePath
protected function generateAbsolutePath(string $root, string $path): ?string { if (false === mb_strpos($path, '..'.DIRECTORY_SEPARATOR) && false === mb_strpos($path, DIRECTORY_SEPARATOR.'..') && false !== file_exists($absolute = $root.DIRECTORY_SEPARATOR.$path) ) { ...
php
protected function generateAbsolutePath(string $root, string $path): ?string { if (false === mb_strpos($path, '..'.DIRECTORY_SEPARATOR) && false === mb_strpos($path, DIRECTORY_SEPARATOR.'..') && false !== file_exists($absolute = $root.DIRECTORY_SEPARATOR.$path) ) { ...
[ "protected", "function", "generateAbsolutePath", "(", "string", "$", "root", ",", "string", "$", "path", ")", ":", "?", "string", "{", "if", "(", "false", "===", "mb_strpos", "(", "$", "path", ",", "'..'", ".", "DIRECTORY_SEPARATOR", ")", "&&", "false", ...
@param string $root @param string $path @return string|null
[ "@param", "string", "$root", "@param", "string", "$path" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Locator/FileSystemInsecureLocator.php#L22-L32
liip/LiipImagineBundle
Imagine/Data/DataManager.php
DataManager.getLoader
public function getLoader($filter) { $config = $this->filterConfig->get($filter); $loaderName = empty($config['data_loader']) ? $this->defaultLoader : $config['data_loader']; if (!isset($this->loaders[$loaderName])) { throw new \InvalidArgumentException(sprintf( ...
php
public function getLoader($filter) { $config = $this->filterConfig->get($filter); $loaderName = empty($config['data_loader']) ? $this->defaultLoader : $config['data_loader']; if (!isset($this->loaders[$loaderName])) { throw new \InvalidArgumentException(sprintf( ...
[ "public", "function", "getLoader", "(", "$", "filter", ")", "{", "$", "config", "=", "$", "this", "->", "filterConfig", "->", "get", "(", "$", "filter", ")", ";", "$", "loaderName", "=", "empty", "(", "$", "config", "[", "'data_loader'", "]", ")", "?...
Returns a loader previously attached to the given filter. @param string $filter @throws \InvalidArgumentException @return LoaderInterface
[ "Returns", "a", "loader", "previously", "attached", "to", "the", "given", "filter", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Data/DataManager.php#L94-L109
liip/LiipImagineBundle
Imagine/Data/DataManager.php
DataManager.find
public function find($filter, $path) { $loader = $this->getLoader($filter); $binary = $loader->find($path); if (!$binary instanceof BinaryInterface) { $mimeType = $this->mimeTypeGuesser->guess($binary); $binary = new Binary( $binary, ...
php
public function find($filter, $path) { $loader = $this->getLoader($filter); $binary = $loader->find($path); if (!$binary instanceof BinaryInterface) { $mimeType = $this->mimeTypeGuesser->guess($binary); $binary = new Binary( $binary, ...
[ "public", "function", "find", "(", "$", "filter", ",", "$", "path", ")", "{", "$", "loader", "=", "$", "this", "->", "getLoader", "(", "$", "filter", ")", ";", "$", "binary", "=", "$", "loader", "->", "find", "(", "$", "path", ")", ";", "if", "...
Retrieves an image with the given filter applied. @param string $filter @param string $path @throws \LogicException @return BinaryInterface
[ "Retrieves", "an", "image", "with", "the", "given", "filter", "applied", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Data/DataManager.php#L121-L145
liip/LiipImagineBundle
Imagine/Data/DataManager.php
DataManager.getDefaultImageUrl
public function getDefaultImageUrl($filter) { $config = $this->filterConfig->get($filter); $defaultImage = null; if (false === empty($config['default_image'])) { $defaultImage = $config['default_image']; } elseif (!empty($this->globalDefaultImage)) { $default...
php
public function getDefaultImageUrl($filter) { $config = $this->filterConfig->get($filter); $defaultImage = null; if (false === empty($config['default_image'])) { $defaultImage = $config['default_image']; } elseif (!empty($this->globalDefaultImage)) { $default...
[ "public", "function", "getDefaultImageUrl", "(", "$", "filter", ")", "{", "$", "config", "=", "$", "this", "->", "filterConfig", "->", "get", "(", "$", "filter", ")", ";", "$", "defaultImage", "=", "null", ";", "if", "(", "false", "===", "empty", "(", ...
Get default image url with the given filter applied. @param string $filter @return string|null
[ "Get", "default", "image", "url", "with", "the", "given", "filter", "applied", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Data/DataManager.php#L154-L166
liip/LiipImagineBundle
Factory/Config/Filter/RotateFactory.php
RotateFactory.create
public function create(array $options): FilterInterface { $angle = isset($options['angle']) ? (int) $options['angle'] : 0; return new Rotate($angle); }
php
public function create(array $options): FilterInterface { $angle = isset($options['angle']) ? (int) $options['angle'] : 0; return new Rotate($angle); }
[ "public", "function", "create", "(", "array", "$", "options", ")", ":", "FilterInterface", "{", "$", "angle", "=", "isset", "(", "$", "options", "[", "'angle'", "]", ")", "?", "(", "int", ")", "$", "options", "[", "'angle'", "]", ":", "0", ";", "re...
{@inheritdoc}
[ "{" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/Filter/RotateFactory.php#L35-L40
liip/LiipImagineBundle
Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php
JpegOptimPostProcessor.process
public function process(BinaryInterface $binary, array $options = []): BinaryInterface { $type = mb_strtolower($binary->getMimeType()); if (!\in_array($type, ['image/jpeg', 'image/jpg'], true)) { return $binary; } $tempDir = \array_key_exists('temp_dir', $options) ? $opt...
php
public function process(BinaryInterface $binary, array $options = []): BinaryInterface { $type = mb_strtolower($binary->getMimeType()); if (!\in_array($type, ['image/jpeg', 'image/jpg'], true)) { return $binary; } $tempDir = \array_key_exists('temp_dir', $options) ? $opt...
[ "public", "function", "process", "(", "BinaryInterface", "$", "binary", ",", "array", "$", "options", "=", "[", "]", ")", ":", "BinaryInterface", "{", "$", "type", "=", "mb_strtolower", "(", "$", "binary", "->", "getMimeType", "(", ")", ")", ";", "if", ...
@param BinaryInterface $binary @param array $options @throws ProcessFailedException @return BinaryInterface
[ "@param", "BinaryInterface", "$binary", "@param", "array", "$options" ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php#L122-L173
liip/LiipImagineBundle
Imagine/Filter/FilterConfiguration.php
FilterConfiguration.get
public function get($filter) { if (false === \array_key_exists($filter, $this->filters)) { throw new NonExistingFilterException(sprintf('Could not find configuration for a filter: %s', $filter)); } return $this->filters[$filter]; }
php
public function get($filter) { if (false === \array_key_exists($filter, $this->filters)) { throw new NonExistingFilterException(sprintf('Could not find configuration for a filter: %s', $filter)); } return $this->filters[$filter]; }
[ "public", "function", "get", "(", "$", "filter", ")", "{", "if", "(", "false", "===", "\\", "array_key_exists", "(", "$", "filter", ",", "$", "this", "->", "filters", ")", ")", "{", "throw", "new", "NonExistingFilterException", "(", "sprintf", "(", "'Cou...
Gets a previously configured filter. @param string $filter @throws NonExistingFilterException @return array
[ "Gets", "a", "previously", "configured", "filter", "." ]
train
https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterConfiguration.php#L40-L47