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
terion-name/package-installer
src/Terion/PackageInstaller/PackageInstallCommand.php
PackageInstallCommand.requirePackage
protected function requirePackage(Package $package) { $version = $this->chooseVersion($package); passthru(sprintf( 'composer require %s:%s', $package->getName(), $version )); $this->comment('Package ' . $package->getName() . ' installed'); $versions = $package->getVersions(); $v = array_get($versions, $version); // Run post-process in separate command to load it with new autoloader passthru(sprintf( 'php artisan package:process %s %s', $package->getName(), base64_encode(serialize($v)) )); }
php
protected function requirePackage(Package $package) { $version = $this->chooseVersion($package); passthru(sprintf( 'composer require %s:%s', $package->getName(), $version )); $this->comment('Package ' . $package->getName() . ' installed'); $versions = $package->getVersions(); $v = array_get($versions, $version); // Run post-process in separate command to load it with new autoloader passthru(sprintf( 'php artisan package:process %s %s', $package->getName(), base64_encode(serialize($v)) )); }
[ "protected", "function", "requirePackage", "(", "Package", "$", "package", ")", "{", "$", "version", "=", "$", "this", "->", "chooseVersion", "(", "$", "package", ")", ";", "passthru", "(", "sprintf", "(", "'composer require %s:%s'", ",", "$", "package", "->", "getName", "(", ")", ",", "$", "version", ")", ")", ";", "$", "this", "->", "comment", "(", "'Package '", ".", "$", "package", "->", "getName", "(", ")", ".", "' installed'", ")", ";", "$", "versions", "=", "$", "package", "->", "getVersions", "(", ")", ";", "$", "v", "=", "array_get", "(", "$", "versions", ",", "$", "version", ")", ";", "// Run post-process in separate command to load it with new autoloader", "passthru", "(", "sprintf", "(", "'php artisan package:process %s %s'", ",", "$", "package", "->", "getName", "(", ")", ",", "base64_encode", "(", "serialize", "(", "$", "v", ")", ")", ")", ")", ";", "}" ]
Installs package. @param Package $package
[ "Installs", "package", "." ]
train
https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallCommand.php#L109-L127
terion-name/package-installer
src/Terion/PackageInstaller/PackageInstallCommand.php
PackageInstallCommand.chooseVersion
protected function chooseVersion(Package $package) { $versions = $package->getVersions(); if (count($versions) === 1) { $v = current($versions)->getVersion(); $this->comment('Version to install: ' . $v); return $v; } $default = 1; $latest = $this->getLatestStable($package); $i = 1; $this->comment('Available versions:'); foreach ($versions as $version) { $v = $version->getVersion(); $versionsAvailable[$i] = $v; if ($v === $latest) { $default = $i; } $this->getOutput()->writeln(sprintf( '[%d] <info>%s</info> (%s)', $i, $v, Carbon::parse($version->getTime())->format('Y-m-d H:i:s') )); ++$i; } $choose = $this->ask('Select version by number [' . $default . ']:', $default); if (!is_numeric($choose) || !isset($versionsAvailable[$choose])) { $this->error('Incorrect value given!'); return $this->chooseVersion($package); } else { $this->comment('Your choice: ' . $versionsAvailable[$choose]); return $versionsAvailable[$choose]; } }
php
protected function chooseVersion(Package $package) { $versions = $package->getVersions(); if (count($versions) === 1) { $v = current($versions)->getVersion(); $this->comment('Version to install: ' . $v); return $v; } $default = 1; $latest = $this->getLatestStable($package); $i = 1; $this->comment('Available versions:'); foreach ($versions as $version) { $v = $version->getVersion(); $versionsAvailable[$i] = $v; if ($v === $latest) { $default = $i; } $this->getOutput()->writeln(sprintf( '[%d] <info>%s</info> (%s)', $i, $v, Carbon::parse($version->getTime())->format('Y-m-d H:i:s') )); ++$i; } $choose = $this->ask('Select version by number [' . $default . ']:', $default); if (!is_numeric($choose) || !isset($versionsAvailable[$choose])) { $this->error('Incorrect value given!'); return $this->chooseVersion($package); } else { $this->comment('Your choice: ' . $versionsAvailable[$choose]); return $versionsAvailable[$choose]; } }
[ "protected", "function", "chooseVersion", "(", "Package", "$", "package", ")", "{", "$", "versions", "=", "$", "package", "->", "getVersions", "(", ")", ";", "if", "(", "count", "(", "$", "versions", ")", "===", "1", ")", "{", "$", "v", "=", "current", "(", "$", "versions", ")", "->", "getVersion", "(", ")", ";", "$", "this", "->", "comment", "(", "'Version to install: '", ".", "$", "v", ")", ";", "return", "$", "v", ";", "}", "$", "default", "=", "1", ";", "$", "latest", "=", "$", "this", "->", "getLatestStable", "(", "$", "package", ")", ";", "$", "i", "=", "1", ";", "$", "this", "->", "comment", "(", "'Available versions:'", ")", ";", "foreach", "(", "$", "versions", "as", "$", "version", ")", "{", "$", "v", "=", "$", "version", "->", "getVersion", "(", ")", ";", "$", "versionsAvailable", "[", "$", "i", "]", "=", "$", "v", ";", "if", "(", "$", "v", "===", "$", "latest", ")", "{", "$", "default", "=", "$", "i", ";", "}", "$", "this", "->", "getOutput", "(", ")", "->", "writeln", "(", "sprintf", "(", "'[%d] <info>%s</info> (%s)'", ",", "$", "i", ",", "$", "v", ",", "Carbon", "::", "parse", "(", "$", "version", "->", "getTime", "(", ")", ")", "->", "format", "(", "'Y-m-d H:i:s'", ")", ")", ")", ";", "++", "$", "i", ";", "}", "$", "choose", "=", "$", "this", "->", "ask", "(", "'Select version by number ['", ".", "$", "default", ".", "']:'", ",", "$", "default", ")", ";", "if", "(", "!", "is_numeric", "(", "$", "choose", ")", "||", "!", "isset", "(", "$", "versionsAvailable", "[", "$", "choose", "]", ")", ")", "{", "$", "this", "->", "error", "(", "'Incorrect value given!'", ")", ";", "return", "$", "this", "->", "chooseVersion", "(", "$", "package", ")", ";", "}", "else", "{", "$", "this", "->", "comment", "(", "'Your choice: '", ".", "$", "versionsAvailable", "[", "$", "choose", "]", ")", ";", "return", "$", "versionsAvailable", "[", "$", "choose", "]", ";", "}", "}" ]
Ask for package version to install (select from list). @param Package $package @return mixed
[ "Ask", "for", "package", "version", "to", "install", "(", "select", "from", "list", ")", "." ]
train
https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallCommand.php#L136-L177
terion-name/package-installer
src/Terion/PackageInstaller/PackageInstallCommand.php
PackageInstallCommand.searchPackage
protected function searchPackage($packageName) { $this->comment('Searching for package...'); $packages = $this->packagist->search($packageName); $total = count($packages); if ($total === 0) { $this->comment('No packages found'); exit; } $this->comment('Found ' . $total . ' packages:'); foreach ($packages as $i => $package) { $this->getOutput()->writeln(sprintf( '[%d] <info>%s</info> (%s)', $i + 1, $package->getName(), $package->getDescription() )); } $this->choosePackage($packages); }
php
protected function searchPackage($packageName) { $this->comment('Searching for package...'); $packages = $this->packagist->search($packageName); $total = count($packages); if ($total === 0) { $this->comment('No packages found'); exit; } $this->comment('Found ' . $total . ' packages:'); foreach ($packages as $i => $package) { $this->getOutput()->writeln(sprintf( '[%d] <info>%s</info> (%s)', $i + 1, $package->getName(), $package->getDescription() )); } $this->choosePackage($packages); }
[ "protected", "function", "searchPackage", "(", "$", "packageName", ")", "{", "$", "this", "->", "comment", "(", "'Searching for package...'", ")", ";", "$", "packages", "=", "$", "this", "->", "packagist", "->", "search", "(", "$", "packageName", ")", ";", "$", "total", "=", "count", "(", "$", "packages", ")", ";", "if", "(", "$", "total", "===", "0", ")", "{", "$", "this", "->", "comment", "(", "'No packages found'", ")", ";", "exit", ";", "}", "$", "this", "->", "comment", "(", "'Found '", ".", "$", "total", ".", "' packages:'", ")", ";", "foreach", "(", "$", "packages", "as", "$", "i", "=>", "$", "package", ")", "{", "$", "this", "->", "getOutput", "(", ")", "->", "writeln", "(", "sprintf", "(", "'[%d] <info>%s</info> (%s)'", ",", "$", "i", "+", "1", ",", "$", "package", "->", "getName", "(", ")", ",", "$", "package", "->", "getDescription", "(", ")", ")", ")", ";", "}", "$", "this", "->", "choosePackage", "(", "$", "packages", ")", ";", "}" ]
Perform search on packagist and ask package select. @param $packageName
[ "Perform", "search", "on", "packagist", "and", "ask", "package", "select", "." ]
train
https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallCommand.php#L210-L232
terion-name/package-installer
src/Terion/PackageInstaller/PackageInstallCommand.php
PackageInstallCommand.choosePackage
protected function choosePackage($packages) { $choose = $this->ask('Select package by number [1]:', '1'); if (!is_numeric($choose) or !isset($packages[$choose - 1])) { $this->error('Incorrect value given!'); $this->choosePackage($packages); } else { $index = $choose - 1; $result = $packages[$index]; $this->comment('Your choice: ' . $result->getName()); $package = $this->getPackage($result->getName()); } }
php
protected function choosePackage($packages) { $choose = $this->ask('Select package by number [1]:', '1'); if (!is_numeric($choose) or !isset($packages[$choose - 1])) { $this->error('Incorrect value given!'); $this->choosePackage($packages); } else { $index = $choose - 1; $result = $packages[$index]; $this->comment('Your choice: ' . $result->getName()); $package = $this->getPackage($result->getName()); } }
[ "protected", "function", "choosePackage", "(", "$", "packages", ")", "{", "$", "choose", "=", "$", "this", "->", "ask", "(", "'Select package by number [1]:'", ",", "'1'", ")", ";", "if", "(", "!", "is_numeric", "(", "$", "choose", ")", "or", "!", "isset", "(", "$", "packages", "[", "$", "choose", "-", "1", "]", ")", ")", "{", "$", "this", "->", "error", "(", "'Incorrect value given!'", ")", ";", "$", "this", "->", "choosePackage", "(", "$", "packages", ")", ";", "}", "else", "{", "$", "index", "=", "$", "choose", "-", "1", ";", "$", "result", "=", "$", "packages", "[", "$", "index", "]", ";", "$", "this", "->", "comment", "(", "'Your choice: '", ".", "$", "result", "->", "getName", "(", ")", ")", ";", "$", "package", "=", "$", "this", "->", "getPackage", "(", "$", "result", "->", "getName", "(", ")", ")", ";", "}", "}" ]
Ask package select from a list. @param $packages
[ "Ask", "package", "select", "from", "a", "list", "." ]
train
https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallCommand.php#L239-L251
SignpostMarv/daft-object
src/JsonTypeUtilities.php
JsonTypeUtilities.ThrowIfNotDaftJson
public static function ThrowIfNotDaftJson(string $class) : string { if ( ! is_a($class, DaftJson::class, self::IS_A_STRINGS)) { throw Exceptions\Factory::DaftObjectNotDaftJsonBadMethodCallException($class); } return $class; }
php
public static function ThrowIfNotDaftJson(string $class) : string { if ( ! is_a($class, DaftJson::class, self::IS_A_STRINGS)) { throw Exceptions\Factory::DaftObjectNotDaftJsonBadMethodCallException($class); } return $class; }
[ "public", "static", "function", "ThrowIfNotDaftJson", "(", "string", "$", "class", ")", ":", "string", "{", "if", "(", "!", "is_a", "(", "$", "class", ",", "DaftJson", "::", "class", ",", "self", "::", "IS_A_STRINGS", ")", ")", "{", "throw", "Exceptions", "\\", "Factory", "::", "DaftObjectNotDaftJsonBadMethodCallException", "(", "$", "class", ")", ";", "}", "return", "$", "class", ";", "}" ]
@psalm-param class-string<DaftObject> $class @psalm-return class-string<DaftJson>
[ "@psalm", "-", "param", "class", "-", "string<DaftObject", ">", "$class" ]
train
https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/JsonTypeUtilities.php#L22-L29
SignpostMarv/daft-object
src/JsonTypeUtilities.php
JsonTypeUtilities.DaftJsonFromJsonType
final public static function DaftJsonFromJsonType( string $jsonType, array $propVal, bool $writeAll ) { return JsonTypeUtilities::ArrayToJsonType($jsonType, $propVal, $writeAll); }
php
final public static function DaftJsonFromJsonType( string $jsonType, array $propVal, bool $writeAll ) { return JsonTypeUtilities::ArrayToJsonType($jsonType, $propVal, $writeAll); }
[ "final", "public", "static", "function", "DaftJsonFromJsonType", "(", "string", "$", "jsonType", ",", "array", "$", "propVal", ",", "bool", "$", "writeAll", ")", "{", "return", "JsonTypeUtilities", "::", "ArrayToJsonType", "(", "$", "jsonType", ",", "$", "propVal", ",", "$", "writeAll", ")", ";", "}" ]
@template T as DaftJson @psalm-param class-string<T> $jsonType @param array<int|string, scalar|(scalar|array|object|null)[]|object|null> $propVal @return array<int, DaftJson>|DaftJson @psalm-return array<int, T>|T
[ "@template", "T", "as", "DaftJson" ]
train
https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/JsonTypeUtilities.php#L42-L48
SignpostMarv/daft-object
src/JsonTypeUtilities.php
JsonTypeUtilities.ThrowIfJsonDefNotValid
public static function ThrowIfJsonDefNotValid(string $type, array $array) : array { $jsonProps = $type::DaftObjectJsonPropertyNames(); $array = JsonTypeUtilities::FilterThrowIfJsonDefNotValid($type, $jsonProps, $array); $jsonDef = $type::DaftObjectJsonProperties(); $keys = array_keys($array); /** * @var array<int|string, scalar|(scalar|array|object|null)[]|object|null> */ $out = array_combine($keys, array_map( JsonTypeUtilities::MakeMapperThrowIfJsonDefNotValid($type, $jsonDef, $array), $keys )); return $out; }
php
public static function ThrowIfJsonDefNotValid(string $type, array $array) : array { $jsonProps = $type::DaftObjectJsonPropertyNames(); $array = JsonTypeUtilities::FilterThrowIfJsonDefNotValid($type, $jsonProps, $array); $jsonDef = $type::DaftObjectJsonProperties(); $keys = array_keys($array); /** * @var array<int|string, scalar|(scalar|array|object|null)[]|object|null> */ $out = array_combine($keys, array_map( JsonTypeUtilities::MakeMapperThrowIfJsonDefNotValid($type, $jsonDef, $array), $keys )); return $out; }
[ "public", "static", "function", "ThrowIfJsonDefNotValid", "(", "string", "$", "type", ",", "array", "$", "array", ")", ":", "array", "{", "$", "jsonProps", "=", "$", "type", "::", "DaftObjectJsonPropertyNames", "(", ")", ";", "$", "array", "=", "JsonTypeUtilities", "::", "FilterThrowIfJsonDefNotValid", "(", "$", "type", ",", "$", "jsonProps", ",", "$", "array", ")", ";", "$", "jsonDef", "=", "$", "type", "::", "DaftObjectJsonProperties", "(", ")", ";", "$", "keys", "=", "array_keys", "(", "$", "array", ")", ";", "/**\n * @var array<int|string, scalar|(scalar|array|object|null)[]|object|null>\n */", "$", "out", "=", "array_combine", "(", "$", "keys", ",", "array_map", "(", "JsonTypeUtilities", "::", "MakeMapperThrowIfJsonDefNotValid", "(", "$", "type", ",", "$", "jsonDef", ",", "$", "array", ")", ",", "$", "keys", ")", ")", ";", "return", "$", "out", ";", "}" ]
@param array<int|string, scalar|(scalar|array|object|null)[]|object|null> $array @psalm-param class-string<DaftJson> $type @return array<int|string, scalar|(scalar|array|object|null)[]|object|null>
[ "@param", "array<int|string", "scalar|", "(", "scalar|array|object|null", ")", "[]", "|object|null", ">", "$array" ]
train
https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/JsonTypeUtilities.php#L57-L74
SignpostMarv/daft-object
src/JsonTypeUtilities.php
JsonTypeUtilities.ThrowIfNotJsonType
public static function ThrowIfNotJsonType(string $jsonType) : string { if ( ! is_a($jsonType, DaftJson::class, DefinitionAssistant::IS_A_STRINGS)) { throw Exceptions\Factory::ClassDoesNotImplementClassException($jsonType, DaftJson::class); } return $jsonType; }
php
public static function ThrowIfNotJsonType(string $jsonType) : string { if ( ! is_a($jsonType, DaftJson::class, DefinitionAssistant::IS_A_STRINGS)) { throw Exceptions\Factory::ClassDoesNotImplementClassException($jsonType, DaftJson::class); } return $jsonType; }
[ "public", "static", "function", "ThrowIfNotJsonType", "(", "string", "$", "jsonType", ")", ":", "string", "{", "if", "(", "!", "is_a", "(", "$", "jsonType", ",", "DaftJson", "::", "class", ",", "DefinitionAssistant", "::", "IS_A_STRINGS", ")", ")", "{", "throw", "Exceptions", "\\", "Factory", "::", "ClassDoesNotImplementClassException", "(", "$", "jsonType", ",", "DaftJson", "::", "class", ")", ";", "}", "return", "$", "jsonType", ";", "}" ]
@template T as DaftJson @psalm-param class-string<DaftObject> $jsonType @psalm-return class-string<T>
[ "@template", "T", "as", "DaftJson" ]
train
https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/JsonTypeUtilities.php#L83-L90
SignpostMarv/daft-object
src/JsonTypeUtilities.php
JsonTypeUtilities.DaftObjectFromJsonTypeArray
public static function DaftObjectFromJsonTypeArray( string $jsonType, string $prop, array $propVal, bool $writeAll ) : array { return array_map( /** * @param scalar|(scalar|(scalar|array|object|null)[]|object|null)[]|object|null $val * * @psalm-return T * * @throws Exceptions\PropertyNotJsonDecodableShouldBeArrayException if $val is not an array */ function ($val) use ($jsonType, $writeAll, $prop) : DaftJson { if ( ! is_array($val)) { throw Exceptions\Factory::PropertyNotJsonDecodableShouldBeArrayException($jsonType, $prop); } return JsonTypeUtilities::ArrayToJsonType($jsonType, $val, $writeAll); }, array_values($propVal) ); }
php
public static function DaftObjectFromJsonTypeArray( string $jsonType, string $prop, array $propVal, bool $writeAll ) : array { return array_map( /** * @param scalar|(scalar|(scalar|array|object|null)[]|object|null)[]|object|null $val * * @psalm-return T * * @throws Exceptions\PropertyNotJsonDecodableShouldBeArrayException if $val is not an array */ function ($val) use ($jsonType, $writeAll, $prop) : DaftJson { if ( ! is_array($val)) { throw Exceptions\Factory::PropertyNotJsonDecodableShouldBeArrayException($jsonType, $prop); } return JsonTypeUtilities::ArrayToJsonType($jsonType, $val, $writeAll); }, array_values($propVal) ); }
[ "public", "static", "function", "DaftObjectFromJsonTypeArray", "(", "string", "$", "jsonType", ",", "string", "$", "prop", ",", "array", "$", "propVal", ",", "bool", "$", "writeAll", ")", ":", "array", "{", "return", "array_map", "(", "/**\n * @param scalar|(scalar|(scalar|array|object|null)[]|object|null)[]|object|null $val\n *\n * @psalm-return T\n *\n * @throws Exceptions\\PropertyNotJsonDecodableShouldBeArrayException if $val is not an array\n */", "function", "(", "$", "val", ")", "use", "(", "$", "jsonType", ",", "$", "writeAll", ",", "$", "prop", ")", ":", "DaftJson", "{", "if", "(", "!", "is_array", "(", "$", "val", ")", ")", "{", "throw", "Exceptions", "\\", "Factory", "::", "PropertyNotJsonDecodableShouldBeArrayException", "(", "$", "jsonType", ",", "$", "prop", ")", ";", "}", "return", "JsonTypeUtilities", "::", "ArrayToJsonType", "(", "$", "jsonType", ",", "$", "val", ",", "$", "writeAll", ")", ";", "}", ",", "array_values", "(", "$", "propVal", ")", ")", ";", "}" ]
@template T as DaftJson @psalm-param class-string<T> $jsonType @param array<int|string, scalar|(scalar|(scalar|array|object|null)[]|object|null)[]|object|null> $propVal @return array<int, DaftJson> @psalm-return array<int, T>
[ "@template", "T", "as", "DaftJson" ]
train
https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/JsonTypeUtilities.php#L103-L126
SignpostMarv/daft-object
src/JsonTypeUtilities.php
JsonTypeUtilities.DaftJsonClosure
public static function DaftJsonClosure( array $array, bool $writeAll, string $class_name ) : Closure { $jsonDef = $class_name::DaftObjectJsonProperties(); return /** * @return scalar|array|object|null */ function (string $prop) use ($array, $jsonDef, $writeAll) { /** * @var string|null */ $jsonType = $jsonDef[$prop] ?? null; if ( ! is_string($jsonType)) { return $array[$prop]; } /** * @var array<int|string, scalar|(scalar|(scalar|array|object|null)[]|object|null)[]|object|null> */ $propVal = (is_array($array[$prop]) ? $array[$prop] : [$array[$prop]]); if ('[]' === mb_substr($jsonType, -2)) { /** * @psalm-var class-string<DaftObject> */ $jsonType = mb_substr($jsonType, 0, -2); $jsonType = JsonTypeUtilities::ThrowIfNotJsonType($jsonType); return JsonTypeUtilities::DaftObjectFromJsonTypeArray( $jsonType, $prop, $propVal, $writeAll ); } /** * @psalm-var class-string<DaftObject> */ $jsonType = $jsonType; $jsonType = JsonTypeUtilities::ThrowIfNotJsonType($jsonType); return JsonTypeUtilities::DaftJsonFromJsonType($jsonType, $propVal, $writeAll); }; }
php
public static function DaftJsonClosure( array $array, bool $writeAll, string $class_name ) : Closure { $jsonDef = $class_name::DaftObjectJsonProperties(); return /** * @return scalar|array|object|null */ function (string $prop) use ($array, $jsonDef, $writeAll) { /** * @var string|null */ $jsonType = $jsonDef[$prop] ?? null; if ( ! is_string($jsonType)) { return $array[$prop]; } /** * @var array<int|string, scalar|(scalar|(scalar|array|object|null)[]|object|null)[]|object|null> */ $propVal = (is_array($array[$prop]) ? $array[$prop] : [$array[$prop]]); if ('[]' === mb_substr($jsonType, -2)) { /** * @psalm-var class-string<DaftObject> */ $jsonType = mb_substr($jsonType, 0, -2); $jsonType = JsonTypeUtilities::ThrowIfNotJsonType($jsonType); return JsonTypeUtilities::DaftObjectFromJsonTypeArray( $jsonType, $prop, $propVal, $writeAll ); } /** * @psalm-var class-string<DaftObject> */ $jsonType = $jsonType; $jsonType = JsonTypeUtilities::ThrowIfNotJsonType($jsonType); return JsonTypeUtilities::DaftJsonFromJsonType($jsonType, $propVal, $writeAll); }; }
[ "public", "static", "function", "DaftJsonClosure", "(", "array", "$", "array", ",", "bool", "$", "writeAll", ",", "string", "$", "class_name", ")", ":", "Closure", "{", "$", "jsonDef", "=", "$", "class_name", "::", "DaftObjectJsonProperties", "(", ")", ";", "return", "/**\n * @return scalar|array|object|null\n */", "function", "(", "string", "$", "prop", ")", "use", "(", "$", "array", ",", "$", "jsonDef", ",", "$", "writeAll", ")", "{", "/**\n * @var string|null\n */", "$", "jsonType", "=", "$", "jsonDef", "[", "$", "prop", "]", "??", "null", ";", "if", "(", "!", "is_string", "(", "$", "jsonType", ")", ")", "{", "return", "$", "array", "[", "$", "prop", "]", ";", "}", "/**\n * @var array<int|string, scalar|(scalar|(scalar|array|object|null)[]|object|null)[]|object|null>\n */", "$", "propVal", "=", "(", "is_array", "(", "$", "array", "[", "$", "prop", "]", ")", "?", "$", "array", "[", "$", "prop", "]", ":", "[", "$", "array", "[", "$", "prop", "]", "]", ")", ";", "if", "(", "'[]'", "===", "mb_substr", "(", "$", "jsonType", ",", "-", "2", ")", ")", "{", "/**\n * @psalm-var class-string<DaftObject>\n */", "$", "jsonType", "=", "mb_substr", "(", "$", "jsonType", ",", "0", ",", "-", "2", ")", ";", "$", "jsonType", "=", "JsonTypeUtilities", "::", "ThrowIfNotJsonType", "(", "$", "jsonType", ")", ";", "return", "JsonTypeUtilities", "::", "DaftObjectFromJsonTypeArray", "(", "$", "jsonType", ",", "$", "prop", ",", "$", "propVal", ",", "$", "writeAll", ")", ";", "}", "/**\n * @psalm-var class-string<DaftObject>\n */", "$", "jsonType", "=", "$", "jsonType", ";", "$", "jsonType", "=", "JsonTypeUtilities", "::", "ThrowIfNotJsonType", "(", "$", "jsonType", ")", ";", "return", "JsonTypeUtilities", "::", "DaftJsonFromJsonType", "(", "$", "jsonType", ",", "$", "propVal", ",", "$", "writeAll", ")", ";", "}", ";", "}" ]
@param array<int|string, scalar|array|object|null> $array @psalm-param class-string<DaftJson> $class_name
[ "@param", "array<int|string", "scalar|array|object|null", ">", "$array" ]
train
https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/JsonTypeUtilities.php#L133-L184
SignpostMarv/daft-object
src/JsonTypeUtilities.php
JsonTypeUtilities.MakeMapperThrowIfJsonDefNotValid
private static function MakeMapperThrowIfJsonDefNotValid( string $class, array $jsonDef, array $array ) : Closure { $mapper = /** * @return scalar|array|object|null */ function (string $prop) use ($jsonDef, $array, $class) { if (isset($jsonDef[$prop]) && false === is_array($array[$prop])) { static::ThrowBecauseArrayJsonTypeNotValid( $class, $jsonDef[$prop], $prop ); } return $array[$prop]; }; return $mapper; }
php
private static function MakeMapperThrowIfJsonDefNotValid( string $class, array $jsonDef, array $array ) : Closure { $mapper = /** * @return scalar|array|object|null */ function (string $prop) use ($jsonDef, $array, $class) { if (isset($jsonDef[$prop]) && false === is_array($array[$prop])) { static::ThrowBecauseArrayJsonTypeNotValid( $class, $jsonDef[$prop], $prop ); } return $array[$prop]; }; return $mapper; }
[ "private", "static", "function", "MakeMapperThrowIfJsonDefNotValid", "(", "string", "$", "class", ",", "array", "$", "jsonDef", ",", "array", "$", "array", ")", ":", "Closure", "{", "$", "mapper", "=", "/**\n * @return scalar|array|object|null\n */", "function", "(", "string", "$", "prop", ")", "use", "(", "$", "jsonDef", ",", "$", "array", ",", "$", "class", ")", "{", "if", "(", "isset", "(", "$", "jsonDef", "[", "$", "prop", "]", ")", "&&", "false", "===", "is_array", "(", "$", "array", "[", "$", "prop", "]", ")", ")", "{", "static", "::", "ThrowBecauseArrayJsonTypeNotValid", "(", "$", "class", ",", "$", "jsonDef", "[", "$", "prop", "]", ",", "$", "prop", ")", ";", "}", "return", "$", "array", "[", "$", "prop", "]", ";", "}", ";", "return", "$", "mapper", ";", "}" ]
@param array<string|int, string> $jsonDef @param (scalar|array|object|null)[] $array @psalm-param class-string $class
[ "@param", "array<string|int", "string", ">", "$jsonDef", "@param", "(", "scalar|array|object|null", ")", "[]", "$array" ]
train
https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/JsonTypeUtilities.php#L192-L214
SignpostMarv/daft-object
src/JsonTypeUtilities.php
JsonTypeUtilities.FilterThrowIfJsonDefNotValid
private static function FilterThrowIfJsonDefNotValid( string $class, array $jsonProps, array $array ) : array { $filter = function (string $prop) use ($jsonProps, $array, $class) : bool { if ( ! in_array($prop, $jsonProps, DefinitionAssistant::IN_ARRAY_STRICT_MODE)) { throw Exceptions\Factory::PropertyNotJsonDecodableException($class, $prop); } return false === is_null($array[$prop]); }; return array_filter($array, $filter, ARRAY_FILTER_USE_KEY); }
php
private static function FilterThrowIfJsonDefNotValid( string $class, array $jsonProps, array $array ) : array { $filter = function (string $prop) use ($jsonProps, $array, $class) : bool { if ( ! in_array($prop, $jsonProps, DefinitionAssistant::IN_ARRAY_STRICT_MODE)) { throw Exceptions\Factory::PropertyNotJsonDecodableException($class, $prop); } return false === is_null($array[$prop]); }; return array_filter($array, $filter, ARRAY_FILTER_USE_KEY); }
[ "private", "static", "function", "FilterThrowIfJsonDefNotValid", "(", "string", "$", "class", ",", "array", "$", "jsonProps", ",", "array", "$", "array", ")", ":", "array", "{", "$", "filter", "=", "function", "(", "string", "$", "prop", ")", "use", "(", "$", "jsonProps", ",", "$", "array", ",", "$", "class", ")", ":", "bool", "{", "if", "(", "!", "in_array", "(", "$", "prop", ",", "$", "jsonProps", ",", "DefinitionAssistant", "::", "IN_ARRAY_STRICT_MODE", ")", ")", "{", "throw", "Exceptions", "\\", "Factory", "::", "PropertyNotJsonDecodableException", "(", "$", "class", ",", "$", "prop", ")", ";", "}", "return", "false", "===", "is_null", "(", "$", "array", "[", "$", "prop", "]", ")", ";", "}", ";", "return", "array_filter", "(", "$", "array", ",", "$", "filter", ",", "ARRAY_FILTER_USE_KEY", ")", ";", "}" ]
@psalm-param class-string<DaftJson> $class @param (scalar|array|object|null)[] $array @return (scalar|array|object|null)[]
[ "@psalm", "-", "param", "class", "-", "string<DaftJson", ">", "$class" ]
train
https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/JsonTypeUtilities.php#L223-L237
SignpostMarv/daft-object
src/JsonTypeUtilities.php
JsonTypeUtilities.ArrayToJsonType
private static function ArrayToJsonType(string $type, array $value, bool $writeAll) : DaftJson { return $type::DaftObjectFromJsonArray($value, $writeAll); }
php
private static function ArrayToJsonType(string $type, array $value, bool $writeAll) : DaftJson { return $type::DaftObjectFromJsonArray($value, $writeAll); }
[ "private", "static", "function", "ArrayToJsonType", "(", "string", "$", "type", ",", "array", "$", "value", ",", "bool", "$", "writeAll", ")", ":", "DaftJson", "{", "return", "$", "type", "::", "DaftObjectFromJsonArray", "(", "$", "value", ",", "$", "writeAll", ")", ";", "}" ]
@template T as DaftJson @psalm-param class-string<T> $type @param array<int|string, scalar|(scalar|array|object|null)[]|object|null> $value @psalm-return T
[ "@template", "T", "as", "DaftJson" ]
train
https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/JsonTypeUtilities.php#L248-L251
slashworks/control-bundle
src/Slashworks/AppBundle/Command/SlashworksCommand.php
SlashworksCommand._printLogo
protected function _printLogo(&$output) { $output->writeLn(''); $output->writeLn(''); $output->writeLn(''); $output->writeLn('<sw> _ _ _ </sw>'); $output->writeLn('<sw> | | | | | | </sw>'); $output->writeLn('<sw> ___| | __ _ ___| |____ _____ _ __| | _____ </sw>'); $output->writeLn('<sw> / __| |/ _` / __| \'_ \ \ /\ / / _ \| \'__| |/ / __| </sw>'); $output->writeLn('<sw> \__ \ | (_| \__ \ | | \ V V / (_) | | | <\__ \ </sw>'); $output->writeLn('<sw> |___/_|\__,_|___/_| |_|\_/\_/ \___/|_| |_|\_\___/ </sw>'); $output->writeLn('<fg=white> web development </fg=white>'); $output->writeLn(''); $output->writeLn(''); $output->writeLn(' [ <info>Cronjob Manager</info> ]'); $output->writeLn(''); $output->writeLn(''); }
php
protected function _printLogo(&$output) { $output->writeLn(''); $output->writeLn(''); $output->writeLn(''); $output->writeLn('<sw> _ _ _ </sw>'); $output->writeLn('<sw> | | | | | | </sw>'); $output->writeLn('<sw> ___| | __ _ ___| |____ _____ _ __| | _____ </sw>'); $output->writeLn('<sw> / __| |/ _` / __| \'_ \ \ /\ / / _ \| \'__| |/ / __| </sw>'); $output->writeLn('<sw> \__ \ | (_| \__ \ | | \ V V / (_) | | | <\__ \ </sw>'); $output->writeLn('<sw> |___/_|\__,_|___/_| |_|\_/\_/ \___/|_| |_|\_\___/ </sw>'); $output->writeLn('<fg=white> web development </fg=white>'); $output->writeLn(''); $output->writeLn(''); $output->writeLn(' [ <info>Cronjob Manager</info> ]'); $output->writeLn(''); $output->writeLn(''); }
[ "protected", "function", "_printLogo", "(", "&", "$", "output", ")", "{", "$", "output", "->", "writeLn", "(", "''", ")", ";", "$", "output", "->", "writeLn", "(", "''", ")", ";", "$", "output", "->", "writeLn", "(", "''", ")", ";", "$", "output", "->", "writeLn", "(", "'<sw> _ _ _ </sw>'", ")", ";", "$", "output", "->", "writeLn", "(", "'<sw> | | | | | | </sw>'", ")", ";", "$", "output", "->", "writeLn", "(", "'<sw> ___| | __ _ ___| |____ _____ _ __| | _____ </sw>'", ")", ";", "$", "output", "->", "writeLn", "(", "'<sw> / __| |/ _` / __| \\'_ \\ \\ /\\ / / _ \\| \\'__| |/ / __| </sw>'", ")", ";", "$", "output", "->", "writeLn", "(", "'<sw> \\__ \\ | (_| \\__ \\ | | \\ V V / (_) | | | <\\__ \\ </sw>'", ")", ";", "$", "output", "->", "writeLn", "(", "'<sw> |___/_|\\__,_|___/_| |_|\\_/\\_/ \\___/|_| |_|\\_\\___/ </sw>'", ")", ";", "$", "output", "->", "writeLn", "(", "'<fg=white> web development </fg=white>'", ")", ";", "$", "output", "->", "writeLn", "(", "''", ")", ";", "$", "output", "->", "writeLn", "(", "''", ")", ";", "$", "output", "->", "writeLn", "(", "' [ <info>Cronjob Manager</info> ]'", ")", ";", "$", "output", "->", "writeLn", "(", "''", ")", ";", "$", "output", "->", "writeLn", "(", "''", ")", ";", "}" ]
Slashwors Logo in colored ASCII-Art :) @param $output
[ "Slashwors", "Logo", "in", "colored", "ASCII", "-", "Art", ":", ")" ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Command/SlashworksCommand.php#L62-L82
slashworks/control-bundle
src/Slashworks/AppBundle/Command/RemoteAppCommand.php
RemoteAppCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $aData = array(); // set colors and formats $oErrStyle = new OutputFormatterStyle('red', null, array('bold')); $oOkStyle = new OutputFormatterStyle('green', null, array('bold')); $oLogoStyle = new OutputFormatterStyle('cyan', null); $output->getFormatter()->setStyle('err', $oErrStyle); $output->getFormatter()->setStyle('ok', $oOkStyle); $output->getFormatter()->setStyle('sw', $oLogoStyle); // print logo $this->_printLogo($output); // Get active remote apps $aRemoteApps = RemoteAppQuery::create()->findByActivated(true); /** @var RemoteApp $oRemoteApp */ $iCnt = 0; foreach ($aRemoteApps as $oRemoteApp) { // get cron string $aData[] = array( $oRemoteApp->getId(), $oRemoteApp->getName(), $oRemoteApp->getLastRun()->format("d.m.Y H:i:s"), ); $iCnt++; } // get tablehelper for cli $oTable = $this->getHelper('table'); $oTable ->setHeaders(array('ID', 'Title', 'Lastrun')) ->setRows($aData) ; $oTable->render($output); // green text $output->writeln("\n<fg=white;options=bold> " . $iCnt . " Job(s) found</fg=white;options=bold>\n"); }
php
protected function execute(InputInterface $input, OutputInterface $output) { $aData = array(); // set colors and formats $oErrStyle = new OutputFormatterStyle('red', null, array('bold')); $oOkStyle = new OutputFormatterStyle('green', null, array('bold')); $oLogoStyle = new OutputFormatterStyle('cyan', null); $output->getFormatter()->setStyle('err', $oErrStyle); $output->getFormatter()->setStyle('ok', $oOkStyle); $output->getFormatter()->setStyle('sw', $oLogoStyle); // print logo $this->_printLogo($output); // Get active remote apps $aRemoteApps = RemoteAppQuery::create()->findByActivated(true); /** @var RemoteApp $oRemoteApp */ $iCnt = 0; foreach ($aRemoteApps as $oRemoteApp) { // get cron string $aData[] = array( $oRemoteApp->getId(), $oRemoteApp->getName(), $oRemoteApp->getLastRun()->format("d.m.Y H:i:s"), ); $iCnt++; } // get tablehelper for cli $oTable = $this->getHelper('table'); $oTable ->setHeaders(array('ID', 'Title', 'Lastrun')) ->setRows($aData) ; $oTable->render($output); // green text $output->writeln("\n<fg=white;options=bold> " . $iCnt . " Job(s) found</fg=white;options=bold>\n"); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "aData", "=", "array", "(", ")", ";", "// set colors and formats", "$", "oErrStyle", "=", "new", "OutputFormatterStyle", "(", "'red'", ",", "null", ",", "array", "(", "'bold'", ")", ")", ";", "$", "oOkStyle", "=", "new", "OutputFormatterStyle", "(", "'green'", ",", "null", ",", "array", "(", "'bold'", ")", ")", ";", "$", "oLogoStyle", "=", "new", "OutputFormatterStyle", "(", "'cyan'", ",", "null", ")", ";", "$", "output", "->", "getFormatter", "(", ")", "->", "setStyle", "(", "'err'", ",", "$", "oErrStyle", ")", ";", "$", "output", "->", "getFormatter", "(", ")", "->", "setStyle", "(", "'ok'", ",", "$", "oOkStyle", ")", ";", "$", "output", "->", "getFormatter", "(", ")", "->", "setStyle", "(", "'sw'", ",", "$", "oLogoStyle", ")", ";", "// print logo", "$", "this", "->", "_printLogo", "(", "$", "output", ")", ";", "// Get active remote apps", "$", "aRemoteApps", "=", "RemoteAppQuery", "::", "create", "(", ")", "->", "findByActivated", "(", "true", ")", ";", "/** @var RemoteApp $oRemoteApp */", "$", "iCnt", "=", "0", ";", "foreach", "(", "$", "aRemoteApps", "as", "$", "oRemoteApp", ")", "{", "// get cron string", "$", "aData", "[", "]", "=", "array", "(", "$", "oRemoteApp", "->", "getId", "(", ")", ",", "$", "oRemoteApp", "->", "getName", "(", ")", ",", "$", "oRemoteApp", "->", "getLastRun", "(", ")", "->", "format", "(", "\"d.m.Y H:i:s\"", ")", ",", ")", ";", "$", "iCnt", "++", ";", "}", "// get tablehelper for cli", "$", "oTable", "=", "$", "this", "->", "getHelper", "(", "'table'", ")", ";", "$", "oTable", "->", "setHeaders", "(", "array", "(", "'ID'", ",", "'Title'", ",", "'Lastrun'", ")", ")", "->", "setRows", "(", "$", "aData", ")", ";", "$", "oTable", "->", "render", "(", "$", "output", ")", ";", "// green text", "$", "output", "->", "writeln", "(", "\"\\n<fg=white;options=bold> \"", ".", "$", "iCnt", ".", "\" Job(s) found</fg=white;options=bold>\\n\"", ")", ";", "}" ]
execute api command @param \Symfony\Component\Console\Input\InputInterface $input @param \Symfony\Component\Console\Output\OutputInterface $output @return void
[ "execute", "api", "command" ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Command/RemoteAppCommand.php#L64-L104
fsi-open/data-indexer
lib/FSi/Component/DataIndexer/DoctrineDataIndexer.php
DoctrineDataIndexer.getIndex
public function getIndex($data) { $this->validateData($data); return $this->joinIndexParts($this->getIndexParts($data)); }
php
public function getIndex($data) { $this->validateData($data); return $this->joinIndexParts($this->getIndexParts($data)); }
[ "public", "function", "getIndex", "(", "$", "data", ")", "{", "$", "this", "->", "validateData", "(", "$", "data", ")", ";", "return", "$", "this", "->", "joinIndexParts", "(", "$", "this", "->", "getIndexParts", "(", "$", "data", ")", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/fsi-open/data-indexer/blob/cec877f46e04d650d9f01e5fcc4019d4f73fdc1d/lib/FSi/Component/DataIndexer/DoctrineDataIndexer.php#L51-L56
fsi-open/data-indexer
lib/FSi/Component/DataIndexer/DoctrineDataIndexer.php
DoctrineDataIndexer.getDataSlice
public function getDataSlice($indexes) { $this->validateIndexes($indexes); return $this->getRepository() ->findBy($this->buildMultipleSearchCriteria($indexes)); }
php
public function getDataSlice($indexes) { $this->validateIndexes($indexes); return $this->getRepository() ->findBy($this->buildMultipleSearchCriteria($indexes)); }
[ "public", "function", "getDataSlice", "(", "$", "indexes", ")", "{", "$", "this", "->", "validateIndexes", "(", "$", "indexes", ")", ";", "return", "$", "this", "->", "getRepository", "(", ")", "->", "findBy", "(", "$", "this", "->", "buildMultipleSearchCriteria", "(", "$", "indexes", ")", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/fsi-open/data-indexer/blob/cec877f46e04d650d9f01e5fcc4019d4f73fdc1d/lib/FSi/Component/DataIndexer/DoctrineDataIndexer.php#L69-L75
fsi-open/data-indexer
lib/FSi/Component/DataIndexer/DoctrineDataIndexer.php
DoctrineDataIndexer.validateData
public function validateData($data) { if (!is_object($data)) { throw new InvalidArgumentException("DoctrineDataIndexer can index only objects."); } if (!is_a($data, $this->class)) { throw new InvalidArgumentException(sprintf( 'DoctrineDataIndexer expects data as instance of "%s" instead of "%s".', $this->class, get_class($data) )); } }
php
public function validateData($data) { if (!is_object($data)) { throw new InvalidArgumentException("DoctrineDataIndexer can index only objects."); } if (!is_a($data, $this->class)) { throw new InvalidArgumentException(sprintf( 'DoctrineDataIndexer expects data as instance of "%s" instead of "%s".', $this->class, get_class($data) )); } }
[ "public", "function", "validateData", "(", "$", "data", ")", "{", "if", "(", "!", "is_object", "(", "$", "data", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"DoctrineDataIndexer can index only objects.\"", ")", ";", "}", "if", "(", "!", "is_a", "(", "$", "data", ",", "$", "this", "->", "class", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'DoctrineDataIndexer expects data as instance of \"%s\" instead of \"%s\".'", ",", "$", "this", "->", "class", ",", "get_class", "(", "$", "data", ")", ")", ")", ";", "}", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/fsi-open/data-indexer/blob/cec877f46e04d650d9f01e5fcc4019d4f73fdc1d/lib/FSi/Component/DataIndexer/DoctrineDataIndexer.php#L80-L93
Ocramius/OcraDiCompiler
src/OcraDiCompiler/Generator/DiInstantiatorCompiler.php
DiInstantiatorCompiler.compile
public function compile() { $indent = ' '; $getters = array(); $instances = $this->dumper->getAllInjectedDefinitions(); /* @var $instance GeneratorInstance */ foreach ($instances as $name => $instance) { $constructor = $instance->getConstructor(); $instantiatorParams = $this->buildParams($instance->getParams()); if ('__construct' !== $constructor) { // Constructor callback if (is_callable($constructor)) { $callback = $constructor; if (is_array($callback)) { $class = (is_object($callback[0])) ? get_class($callback[0]) : $callback[0]; $method = $callback[1]; } elseif (is_string($callback) && strpos($callback, '::') !== false) { list($class, $method) = explode('::', $callback, 2); } $callback = var_export(array($class, $method), true); if (count($instantiatorParams)) { $creation = sprintf('$object = call_user_func(%s, %s);', $callback, implode(', ', $instantiatorParams)); } else { $creation = sprintf('$object = call_user_func(%s);', $callback); } } else if (is_string($constructor) && strpos($constructor, '->') !== false) { list($class, $method) = explode('->', $constructor, 2); if (!class_exists($class)) { throw new InvalidArgumentException('No class found: ' . $class); } if (count($instantiatorParams)) { $creation = sprintf( '$object = $di->get(%s)->%s(%s);', var_export($class, true), $method, implode(', ', $instantiatorParams) ); } else { $creation = sprintf('$object = $di->get(%s)->%s();', var_export($class, true), $method); } } else { throw new InvalidArgumentException('Invalid instantiator supplied for class: ' . $name); } } else { $className = '\\' . trim($this->reduceAlias($name), '\\'); if (count($instantiatorParams)) { $creation = sprintf('$object = new %s(%s);', $className, implode(', ', $instantiatorParams)); } else { $creation = sprintf('$object = new %s();', $className); } } // Create method call code if ($instance->isShared()) { $creation .= "\n\nif (\$isShared) {\n" . $indent . '$di->instanceManager()->addSharedInstance($object, \'' . $instance->getName() . '\');' . "\n}\n"; } $methods = ''; foreach ($instance->getMethods() as $methodData) { $methodName = $methodData['method']; $methodParams = $methodData['params']; // Create method parameter representation $params = $this->buildParams($methodParams); if (count($params)) { $methods .= sprintf("\$object->%s(%s);\n", $methodName, implode(', ', $params)); } } // Start creating getter $getterBody = "function (\\Zend\\Di\\Di \$di, \$isShared) {\n"; // Creation and method calls $getterBody .= $indent . str_replace("\n", "\n" . $indent, $creation) . "\n"; $getterBody .= $indent . str_replace("\n", "\n" . $indent, $methods); // End getter body $getterBody .= "\n" . $indent . "return \$object;\n}"; $getters[$name] = $getterBody; } $fileBody = "return array(\n"; foreach ($getters as $name => $getterBody) { $fileBody .= $indent . var_export($name, true); $fileBody .= ' => ' . str_replace("\n", "\n" . $indent, $getterBody) . ",\n\n"; } $fileBody .= ");\n"; // Create PHP file code generation object $generator = $this->getFileGenerator(); $generator->setBody($fileBody); return $generator; }
php
public function compile() { $indent = ' '; $getters = array(); $instances = $this->dumper->getAllInjectedDefinitions(); /* @var $instance GeneratorInstance */ foreach ($instances as $name => $instance) { $constructor = $instance->getConstructor(); $instantiatorParams = $this->buildParams($instance->getParams()); if ('__construct' !== $constructor) { // Constructor callback if (is_callable($constructor)) { $callback = $constructor; if (is_array($callback)) { $class = (is_object($callback[0])) ? get_class($callback[0]) : $callback[0]; $method = $callback[1]; } elseif (is_string($callback) && strpos($callback, '::') !== false) { list($class, $method) = explode('::', $callback, 2); } $callback = var_export(array($class, $method), true); if (count($instantiatorParams)) { $creation = sprintf('$object = call_user_func(%s, %s);', $callback, implode(', ', $instantiatorParams)); } else { $creation = sprintf('$object = call_user_func(%s);', $callback); } } else if (is_string($constructor) && strpos($constructor, '->') !== false) { list($class, $method) = explode('->', $constructor, 2); if (!class_exists($class)) { throw new InvalidArgumentException('No class found: ' . $class); } if (count($instantiatorParams)) { $creation = sprintf( '$object = $di->get(%s)->%s(%s);', var_export($class, true), $method, implode(', ', $instantiatorParams) ); } else { $creation = sprintf('$object = $di->get(%s)->%s();', var_export($class, true), $method); } } else { throw new InvalidArgumentException('Invalid instantiator supplied for class: ' . $name); } } else { $className = '\\' . trim($this->reduceAlias($name), '\\'); if (count($instantiatorParams)) { $creation = sprintf('$object = new %s(%s);', $className, implode(', ', $instantiatorParams)); } else { $creation = sprintf('$object = new %s();', $className); } } // Create method call code if ($instance->isShared()) { $creation .= "\n\nif (\$isShared) {\n" . $indent . '$di->instanceManager()->addSharedInstance($object, \'' . $instance->getName() . '\');' . "\n}\n"; } $methods = ''; foreach ($instance->getMethods() as $methodData) { $methodName = $methodData['method']; $methodParams = $methodData['params']; // Create method parameter representation $params = $this->buildParams($methodParams); if (count($params)) { $methods .= sprintf("\$object->%s(%s);\n", $methodName, implode(', ', $params)); } } // Start creating getter $getterBody = "function (\\Zend\\Di\\Di \$di, \$isShared) {\n"; // Creation and method calls $getterBody .= $indent . str_replace("\n", "\n" . $indent, $creation) . "\n"; $getterBody .= $indent . str_replace("\n", "\n" . $indent, $methods); // End getter body $getterBody .= "\n" . $indent . "return \$object;\n}"; $getters[$name] = $getterBody; } $fileBody = "return array(\n"; foreach ($getters as $name => $getterBody) { $fileBody .= $indent . var_export($name, true); $fileBody .= ' => ' . str_replace("\n", "\n" . $indent, $getterBody) . ",\n\n"; } $fileBody .= ");\n"; // Create PHP file code generation object $generator = $this->getFileGenerator(); $generator->setBody($fileBody); return $generator; }
[ "public", "function", "compile", "(", ")", "{", "$", "indent", "=", "' '", ";", "$", "getters", "=", "array", "(", ")", ";", "$", "instances", "=", "$", "this", "->", "dumper", "->", "getAllInjectedDefinitions", "(", ")", ";", "/* @var $instance GeneratorInstance */", "foreach", "(", "$", "instances", "as", "$", "name", "=>", "$", "instance", ")", "{", "$", "constructor", "=", "$", "instance", "->", "getConstructor", "(", ")", ";", "$", "instantiatorParams", "=", "$", "this", "->", "buildParams", "(", "$", "instance", "->", "getParams", "(", ")", ")", ";", "if", "(", "'__construct'", "!==", "$", "constructor", ")", "{", "// Constructor callback", "if", "(", "is_callable", "(", "$", "constructor", ")", ")", "{", "$", "callback", "=", "$", "constructor", ";", "if", "(", "is_array", "(", "$", "callback", ")", ")", "{", "$", "class", "=", "(", "is_object", "(", "$", "callback", "[", "0", "]", ")", ")", "?", "get_class", "(", "$", "callback", "[", "0", "]", ")", ":", "$", "callback", "[", "0", "]", ";", "$", "method", "=", "$", "callback", "[", "1", "]", ";", "}", "elseif", "(", "is_string", "(", "$", "callback", ")", "&&", "strpos", "(", "$", "callback", ",", "'::'", ")", "!==", "false", ")", "{", "list", "(", "$", "class", ",", "$", "method", ")", "=", "explode", "(", "'::'", ",", "$", "callback", ",", "2", ")", ";", "}", "$", "callback", "=", "var_export", "(", "array", "(", "$", "class", ",", "$", "method", ")", ",", "true", ")", ";", "if", "(", "count", "(", "$", "instantiatorParams", ")", ")", "{", "$", "creation", "=", "sprintf", "(", "'$object = call_user_func(%s, %s);'", ",", "$", "callback", ",", "implode", "(", "', '", ",", "$", "instantiatorParams", ")", ")", ";", "}", "else", "{", "$", "creation", "=", "sprintf", "(", "'$object = call_user_func(%s);'", ",", "$", "callback", ")", ";", "}", "}", "else", "if", "(", "is_string", "(", "$", "constructor", ")", "&&", "strpos", "(", "$", "constructor", ",", "'->'", ")", "!==", "false", ")", "{", "list", "(", "$", "class", ",", "$", "method", ")", "=", "explode", "(", "'->'", ",", "$", "constructor", ",", "2", ")", ";", "if", "(", "!", "class_exists", "(", "$", "class", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'No class found: '", ".", "$", "class", ")", ";", "}", "if", "(", "count", "(", "$", "instantiatorParams", ")", ")", "{", "$", "creation", "=", "sprintf", "(", "'$object = $di->get(%s)->%s(%s);'", ",", "var_export", "(", "$", "class", ",", "true", ")", ",", "$", "method", ",", "implode", "(", "', '", ",", "$", "instantiatorParams", ")", ")", ";", "}", "else", "{", "$", "creation", "=", "sprintf", "(", "'$object = $di->get(%s)->%s();'", ",", "var_export", "(", "$", "class", ",", "true", ")", ",", "$", "method", ")", ";", "}", "}", "else", "{", "throw", "new", "InvalidArgumentException", "(", "'Invalid instantiator supplied for class: '", ".", "$", "name", ")", ";", "}", "}", "else", "{", "$", "className", "=", "'\\\\'", ".", "trim", "(", "$", "this", "->", "reduceAlias", "(", "$", "name", ")", ",", "'\\\\'", ")", ";", "if", "(", "count", "(", "$", "instantiatorParams", ")", ")", "{", "$", "creation", "=", "sprintf", "(", "'$object = new %s(%s);'", ",", "$", "className", ",", "implode", "(", "', '", ",", "$", "instantiatorParams", ")", ")", ";", "}", "else", "{", "$", "creation", "=", "sprintf", "(", "'$object = new %s();'", ",", "$", "className", ")", ";", "}", "}", "// Create method call code", "if", "(", "$", "instance", "->", "isShared", "(", ")", ")", "{", "$", "creation", ".=", "\"\\n\\nif (\\$isShared) {\\n\"", ".", "$", "indent", ".", "'$di->instanceManager()->addSharedInstance($object, \\''", ".", "$", "instance", "->", "getName", "(", ")", ".", "'\\');'", ".", "\"\\n}\\n\"", ";", "}", "$", "methods", "=", "''", ";", "foreach", "(", "$", "instance", "->", "getMethods", "(", ")", "as", "$", "methodData", ")", "{", "$", "methodName", "=", "$", "methodData", "[", "'method'", "]", ";", "$", "methodParams", "=", "$", "methodData", "[", "'params'", "]", ";", "// Create method parameter representation", "$", "params", "=", "$", "this", "->", "buildParams", "(", "$", "methodParams", ")", ";", "if", "(", "count", "(", "$", "params", ")", ")", "{", "$", "methods", ".=", "sprintf", "(", "\"\\$object->%s(%s);\\n\"", ",", "$", "methodName", ",", "implode", "(", "', '", ",", "$", "params", ")", ")", ";", "}", "}", "// Start creating getter", "$", "getterBody", "=", "\"function (\\\\Zend\\\\Di\\\\Di \\$di, \\$isShared) {\\n\"", ";", "// Creation and method calls", "$", "getterBody", ".=", "$", "indent", ".", "str_replace", "(", "\"\\n\"", ",", "\"\\n\"", ".", "$", "indent", ",", "$", "creation", ")", ".", "\"\\n\"", ";", "$", "getterBody", ".=", "$", "indent", ".", "str_replace", "(", "\"\\n\"", ",", "\"\\n\"", ".", "$", "indent", ",", "$", "methods", ")", ";", "// End getter body", "$", "getterBody", ".=", "\"\\n\"", ".", "$", "indent", ".", "\"return \\$object;\\n}\"", ";", "$", "getters", "[", "$", "name", "]", "=", "$", "getterBody", ";", "}", "$", "fileBody", "=", "\"return array(\\n\"", ";", "foreach", "(", "$", "getters", "as", "$", "name", "=>", "$", "getterBody", ")", "{", "$", "fileBody", ".=", "$", "indent", ".", "var_export", "(", "$", "name", ",", "true", ")", ";", "$", "fileBody", ".=", "' => '", ".", "str_replace", "(", "\"\\n\"", ",", "\"\\n\"", ".", "$", "indent", ",", "$", "getterBody", ")", ".", "\",\\n\\n\"", ";", "}", "$", "fileBody", ".=", "\");\\n\"", ";", "// Create PHP file code generation object", "$", "generator", "=", "$", "this", "->", "getFileGenerator", "(", ")", ";", "$", "generator", "->", "setBody", "(", "$", "fileBody", ")", ";", "return", "$", "generator", ";", "}" ]
Compiles a Di Definitions to a in a service locator, that extends Zend\Di\Di and writes it to disk It uses Zend\Code\Generator\FileGenerator @return FileGenerator @throws InvalidArgumentException
[ "Compiles", "a", "Di", "Definitions", "to", "a", "in", "a", "service", "locator", "that", "extends", "Zend", "\\", "Di", "\\", "Di", "and", "writes", "it", "to", "disk" ]
train
https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Generator/DiInstantiatorCompiler.php#L115-L223
Ocramius/OcraDiCompiler
src/OcraDiCompiler/Generator/DiInstantiatorCompiler.php
DiInstantiatorCompiler.reduceAlias
protected function reduceAlias($name) { $aliases = $this->dumper->getAliases(); if (isset($aliases[$name])) { return $this->reduceAlias($aliases[$name]); } return $name; }
php
protected function reduceAlias($name) { $aliases = $this->dumper->getAliases(); if (isset($aliases[$name])) { return $this->reduceAlias($aliases[$name]); } return $name; }
[ "protected", "function", "reduceAlias", "(", "$", "name", ")", "{", "$", "aliases", "=", "$", "this", "->", "dumper", "->", "getAliases", "(", ")", ";", "if", "(", "isset", "(", "$", "aliases", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "reduceAlias", "(", "$", "aliases", "[", "$", "name", "]", ")", ";", "}", "return", "$", "name", ";", "}" ]
Reduce aliases @param string $name @return string
[ "Reduce", "aliases" ]
train
https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Generator/DiInstantiatorCompiler.php#L231-L240
Ocramius/OcraDiCompiler
src/OcraDiCompiler/Generator/DiInstantiatorCompiler.php
DiInstantiatorCompiler.buildParams
protected function buildParams(array $params) { $normalizedParameters = array(); foreach ($params as $parameter) { if ($parameter instanceof GeneratorInstance) { /* @var $parameter GeneratorInstance */ $normalizedParameters[] = sprintf('$di->get(%s)', '\'' . $parameter->getName() . '\''); } else { $normalizedParameters[] = var_export($parameter, true); } } return $normalizedParameters; }
php
protected function buildParams(array $params) { $normalizedParameters = array(); foreach ($params as $parameter) { if ($parameter instanceof GeneratorInstance) { /* @var $parameter GeneratorInstance */ $normalizedParameters[] = sprintf('$di->get(%s)', '\'' . $parameter->getName() . '\''); } else { $normalizedParameters[] = var_export($parameter, true); } } return $normalizedParameters; }
[ "protected", "function", "buildParams", "(", "array", "$", "params", ")", "{", "$", "normalizedParameters", "=", "array", "(", ")", ";", "foreach", "(", "$", "params", "as", "$", "parameter", ")", "{", "if", "(", "$", "parameter", "instanceof", "GeneratorInstance", ")", "{", "/* @var $parameter GeneratorInstance */", "$", "normalizedParameters", "[", "]", "=", "sprintf", "(", "'$di->get(%s)'", ",", "'\\''", ".", "$", "parameter", "->", "getName", "(", ")", ".", "'\\''", ")", ";", "}", "else", "{", "$", "normalizedParameters", "[", "]", "=", "var_export", "(", "$", "parameter", ",", "true", ")", ";", "}", "}", "return", "$", "normalizedParameters", ";", "}" ]
Generates parameter strings to be used as injections, replacing reference parameters with their respective getters @param array $params @return array
[ "Generates", "parameter", "strings", "to", "be", "used", "as", "injections", "replacing", "reference", "parameters", "with", "their", "respective", "getters" ]
train
https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Generator/DiInstantiatorCompiler.php#L249-L263
anime-db/app-bundle
src/Controller/CommandController.php
CommandController.execAction
public function execAction(Request $request) { ignore_user_abort(true); set_time_limit(0); $this->get('anime_db.command')->execute($request->get('command'), 0); return new Response(); }
php
public function execAction(Request $request) { ignore_user_abort(true); set_time_limit(0); $this->get('anime_db.command')->execute($request->get('command'), 0); return new Response(); }
[ "public", "function", "execAction", "(", "Request", "$", "request", ")", "{", "ignore_user_abort", "(", "true", ")", ";", "set_time_limit", "(", "0", ")", ";", "$", "this", "->", "get", "(", "'anime_db.command'", ")", "->", "execute", "(", "$", "request", "->", "get", "(", "'command'", ")", ",", "0", ")", ";", "return", "new", "Response", "(", ")", ";", "}" ]
Execute command in background. @param Request $request @return Response
[ "Execute", "command", "in", "background", "." ]
train
https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Controller/CommandController.php#L24-L32
CakeCMS/Core
src/ORM/Table.php
Table.beforeMarshal
public function beforeMarshal(Event $event, \ArrayObject $data, \ArrayObject $options) { $this->_prepareParamsData($data); }
php
public function beforeMarshal(Event $event, \ArrayObject $data, \ArrayObject $options) { $this->_prepareParamsData($data); }
[ "public", "function", "beforeMarshal", "(", "Event", "$", "event", ",", "\\", "ArrayObject", "$", "data", ",", "\\", "ArrayObject", "$", "options", ")", "{", "$", "this", "->", "_prepareParamsData", "(", "$", "data", ")", ";", "}" ]
Callback before request data is converted into entities. @param Event $event @param \ArrayObject $data @param \ArrayObject $options @return void @SuppressWarnings("unused")
[ "Callback", "before", "request", "data", "is", "converted", "into", "entities", "." ]
train
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/ORM/Table.php#L40-L43
CakeCMS/Core
src/ORM/Table.php
Table._prepareParamsData
protected function _prepareParamsData(\ArrayObject $data) { if (isset($data['params'])) { $params = new JSON((array) $data['params']); $data->offsetSet('params', $params); } }
php
protected function _prepareParamsData(\ArrayObject $data) { if (isset($data['params'])) { $params = new JSON((array) $data['params']); $data->offsetSet('params', $params); } }
[ "protected", "function", "_prepareParamsData", "(", "\\", "ArrayObject", "$", "data", ")", "{", "if", "(", "isset", "(", "$", "data", "[", "'params'", "]", ")", ")", "{", "$", "params", "=", "new", "JSON", "(", "(", "array", ")", "$", "data", "[", "'params'", "]", ")", ";", "$", "data", "->", "offsetSet", "(", "'params'", ",", "$", "params", ")", ";", "}", "}" ]
Prepare params data. @param \ArrayObject $data @return void
[ "Prepare", "params", "data", "." ]
train
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/ORM/Table.php#L51-L57
thecodingmachine/service-provider-bridge-bundle
src/InteropServiceProviderBridgeBundle.php
InteropServiceProviderBridgeBundle.boot
public function boot() { $registryServiceName = 'service_provider_registry_'.$this->id; $this->container->set($registryServiceName, $this->getRegistry($this->container)); }
php
public function boot() { $registryServiceName = 'service_provider_registry_'.$this->id; $this->container->set($registryServiceName, $this->getRegistry($this->container)); }
[ "public", "function", "boot", "(", ")", "{", "$", "registryServiceName", "=", "'service_provider_registry_'", ".", "$", "this", "->", "id", ";", "$", "this", "->", "container", "->", "set", "(", "$", "registryServiceName", ",", "$", "this", "->", "getRegistry", "(", "$", "this", "->", "container", ")", ")", ";", "}" ]
At boot time, let's fill the container with the registry.
[ "At", "boot", "time", "let", "s", "fill", "the", "container", "with", "the", "registry", "." ]
train
https://github.com/thecodingmachine/service-provider-bridge-bundle/blob/7ac2d64c6aa7f093ad36fb1f3a4b86b397777c99/src/InteropServiceProviderBridgeBundle.php#L39-L43
PeekAndPoke/psi
src/Operation/Terminal/CollectToMapOperation.php
CollectToMapOperation.apply
public function apply(\Iterator $set) { $result = []; $keyMapper = $this->keyMapper; $valueMapper = $this->valueMapper; foreach ($set as $key => $item) { $result[$keyMapper($item, $key)] = $valueMapper($item, $key); } return $result; }
php
public function apply(\Iterator $set) { $result = []; $keyMapper = $this->keyMapper; $valueMapper = $this->valueMapper; foreach ($set as $key => $item) { $result[$keyMapper($item, $key)] = $valueMapper($item, $key); } return $result; }
[ "public", "function", "apply", "(", "\\", "Iterator", "$", "set", ")", "{", "$", "result", "=", "[", "]", ";", "$", "keyMapper", "=", "$", "this", "->", "keyMapper", ";", "$", "valueMapper", "=", "$", "this", "->", "valueMapper", ";", "foreach", "(", "$", "set", "as", "$", "key", "=>", "$", "item", ")", "{", "$", "result", "[", "$", "keyMapper", "(", "$", "item", ",", "$", "key", ")", "]", "=", "$", "valueMapper", "(", "$", "item", ",", "$", "key", ")", ";", "}", "return", "$", "result", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/Terminal/CollectToMapOperation.php#L40-L52
gnugat/marshaller
src/Gnugat/Marshaller/Marshaller.php
Marshaller.add
public function add(MarshallerStrategy $strategy, $priority = 0) { $this->prioritizedStrategies[$priority][] = $strategy; $this->isSorted = false; }
php
public function add(MarshallerStrategy $strategy, $priority = 0) { $this->prioritizedStrategies[$priority][] = $strategy; $this->isSorted = false; }
[ "public", "function", "add", "(", "MarshallerStrategy", "$", "strategy", ",", "$", "priority", "=", "0", ")", "{", "$", "this", "->", "prioritizedStrategies", "[", "$", "priority", "]", "[", "]", "=", "$", "strategy", ";", "$", "this", "->", "isSorted", "=", "false", ";", "}" ]
@param MarshallerStrategy $strategy @param int $priority @api
[ "@param", "MarshallerStrategy", "$strategy", "@param", "int", "$priority" ]
train
https://github.com/gnugat/marshaller/blob/1238cc167b200ce9be5ae9e22890860c15e7f728/src/Gnugat/Marshaller/Marshaller.php#L37-L41
gnugat/marshaller
src/Gnugat/Marshaller/Marshaller.php
Marshaller.marshal
public function marshal($toMarshal, $category = null) { if (!$this->isSorted) { $this->sortStrategies(); } foreach ($this->prioritizedStrategies as $priority => $strategies) { foreach ($strategies as $strategy) { if ($strategy->supports($toMarshal, $category)) { return $strategy->marshal($toMarshal); } } } throw new NotSupportedException('The given $toMarshal is not supported by any registered strategies.'); }
php
public function marshal($toMarshal, $category = null) { if (!$this->isSorted) { $this->sortStrategies(); } foreach ($this->prioritizedStrategies as $priority => $strategies) { foreach ($strategies as $strategy) { if ($strategy->supports($toMarshal, $category)) { return $strategy->marshal($toMarshal); } } } throw new NotSupportedException('The given $toMarshal is not supported by any registered strategies.'); }
[ "public", "function", "marshal", "(", "$", "toMarshal", ",", "$", "category", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "isSorted", ")", "{", "$", "this", "->", "sortStrategies", "(", ")", ";", "}", "foreach", "(", "$", "this", "->", "prioritizedStrategies", "as", "$", "priority", "=>", "$", "strategies", ")", "{", "foreach", "(", "$", "strategies", "as", "$", "strategy", ")", "{", "if", "(", "$", "strategy", "->", "supports", "(", "$", "toMarshal", ",", "$", "category", ")", ")", "{", "return", "$", "strategy", "->", "marshal", "(", "$", "toMarshal", ")", ";", "}", "}", "}", "throw", "new", "NotSupportedException", "(", "'The given $toMarshal is not supported by any registered strategies.'", ")", ";", "}" ]
@param mixed $toMarshal @param string $category @return mixed @throws NotSupportedException If the given $toMarshal isn't supported by any registered strategies @api
[ "@param", "mixed", "$toMarshal", "@param", "string", "$category" ]
train
https://github.com/gnugat/marshaller/blob/1238cc167b200ce9be5ae9e22890860c15e7f728/src/Gnugat/Marshaller/Marshaller.php#L53-L67
gnugat/marshaller
src/Gnugat/Marshaller/Marshaller.php
Marshaller.marshalCollection
public function marshalCollection(array $collection, $category = null) { if (!$this->isSorted) { $this->sortStrategies(); } $marshalledCollection = array(); foreach ($collection as $toMarshal) { $marshalledCollection[] = $this->marshal($toMarshal, $category); } return $marshalledCollection; }
php
public function marshalCollection(array $collection, $category = null) { if (!$this->isSorted) { $this->sortStrategies(); } $marshalledCollection = array(); foreach ($collection as $toMarshal) { $marshalledCollection[] = $this->marshal($toMarshal, $category); } return $marshalledCollection; }
[ "public", "function", "marshalCollection", "(", "array", "$", "collection", ",", "$", "category", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "isSorted", ")", "{", "$", "this", "->", "sortStrategies", "(", ")", ";", "}", "$", "marshalledCollection", "=", "array", "(", ")", ";", "foreach", "(", "$", "collection", "as", "$", "toMarshal", ")", "{", "$", "marshalledCollection", "[", "]", "=", "$", "this", "->", "marshal", "(", "$", "toMarshal", ",", "$", "category", ")", ";", "}", "return", "$", "marshalledCollection", ";", "}" ]
@param array $collection @param string $category @return mixed @throws NotSupportedException If the given $toMarshal isn't supported by any registered strategies @api
[ "@param", "array", "$collection", "@param", "string", "$category" ]
train
https://github.com/gnugat/marshaller/blob/1238cc167b200ce9be5ae9e22890860c15e7f728/src/Gnugat/Marshaller/Marshaller.php#L79-L90
datasift/php_webdriver
src/php/DataSift/WebDriver/WebDriverClient.php
WebDriverClient.newSession
public function newSession($browser = 'chrome', $additional_capabilities = array()) { // merge the browser name into any additional requested capabilities $desired_capabilities = array_merge( $additional_capabilities, array('browserName' => $browser) ); // tell webdriver to create the new session $results = $this->curl( 'POST', '/session', array('desiredCapabilities' => $desired_capabilities), array(CURLOPT_FOLLOWLOCATION => true) ); // did we get a sessionId back? // // this happens when SauceLabs doesn't like what we've asked; // genuine Selenium WebDriver returns a proper error! if(!isset($results['sessionId'])) { throw new E5xx_SessionNotCreatedWebDriverError('no error message provided by selenium webdriver, sorry :('); } // return the session back to the caller return new WebDriverSession($this->url . '/session/'. $results['sessionId']); }
php
public function newSession($browser = 'chrome', $additional_capabilities = array()) { // merge the browser name into any additional requested capabilities $desired_capabilities = array_merge( $additional_capabilities, array('browserName' => $browser) ); // tell webdriver to create the new session $results = $this->curl( 'POST', '/session', array('desiredCapabilities' => $desired_capabilities), array(CURLOPT_FOLLOWLOCATION => true) ); // did we get a sessionId back? // // this happens when SauceLabs doesn't like what we've asked; // genuine Selenium WebDriver returns a proper error! if(!isset($results['sessionId'])) { throw new E5xx_SessionNotCreatedWebDriverError('no error message provided by selenium webdriver, sorry :('); } // return the session back to the caller return new WebDriverSession($this->url . '/session/'. $results['sessionId']); }
[ "public", "function", "newSession", "(", "$", "browser", "=", "'chrome'", ",", "$", "additional_capabilities", "=", "array", "(", ")", ")", "{", "// merge the browser name into any additional requested capabilities", "$", "desired_capabilities", "=", "array_merge", "(", "$", "additional_capabilities", ",", "array", "(", "'browserName'", "=>", "$", "browser", ")", ")", ";", "// tell webdriver to create the new session", "$", "results", "=", "$", "this", "->", "curl", "(", "'POST'", ",", "'/session'", ",", "array", "(", "'desiredCapabilities'", "=>", "$", "desired_capabilities", ")", ",", "array", "(", "CURLOPT_FOLLOWLOCATION", "=>", "true", ")", ")", ";", "// did we get a sessionId back?", "//", "// this happens when SauceLabs doesn't like what we've asked;", "// genuine Selenium WebDriver returns a proper error!", "if", "(", "!", "isset", "(", "$", "results", "[", "'sessionId'", "]", ")", ")", "{", "throw", "new", "E5xx_SessionNotCreatedWebDriverError", "(", "'no error message provided by selenium webdriver, sorry :('", ")", ";", "}", "// return the session back to the caller", "return", "new", "WebDriverSession", "(", "$", "this", "->", "url", ".", "'/session/'", ".", "$", "results", "[", "'sessionId'", "]", ")", ";", "}" ]
create a new session / launch a new browser to control @param string $browser the name of the browser to use @param array $additional_capabilities a list of the capabilities that are needed for this test @return WebDriverSession the new WebDriverSession to use to control the browser
[ "create", "a", "new", "session", "/", "launch", "a", "new", "browser", "to", "control" ]
train
https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/WebDriver/WebDriverClient.php#L60-L86
datasift/php_webdriver
src/php/DataSift/WebDriver/WebDriverClient.php
WebDriverClient.getSessions
public function getSessions() { // our return value $sessions = array(); // get a raw list of the current sessions $result = $this->curl('GET', '/sessions'); // convert the raw list into an array of WebDriverSession objects foreach ($result['value'] as $session) { $sessions[] = new WebDriverSession($this->url . '/session/' . $session['id']); } // return the full list of sessions return $sessions; }
php
public function getSessions() { // our return value $sessions = array(); // get a raw list of the current sessions $result = $this->curl('GET', '/sessions'); // convert the raw list into an array of WebDriverSession objects foreach ($result['value'] as $session) { $sessions[] = new WebDriverSession($this->url . '/session/' . $session['id']); } // return the full list of sessions return $sessions; }
[ "public", "function", "getSessions", "(", ")", "{", "// our return value", "$", "sessions", "=", "array", "(", ")", ";", "// get a raw list of the current sessions", "$", "result", "=", "$", "this", "->", "curl", "(", "'GET'", ",", "'/sessions'", ")", ";", "// convert the raw list into an array of WebDriverSession objects", "foreach", "(", "$", "result", "[", "'value'", "]", "as", "$", "session", ")", "{", "$", "sessions", "[", "]", "=", "new", "WebDriverSession", "(", "$", "this", "->", "url", ".", "'/session/'", ".", "$", "session", "[", "'id'", "]", ")", ";", "}", "// return the full list of sessions", "return", "$", "sessions", ";", "}" ]
get a list of active sessions @return array(WebDriverSession) a list of the sessions that webdriver currently knows about
[ "get", "a", "list", "of", "active", "sessions" ]
train
https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/WebDriver/WebDriverClient.php#L94-L109
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.write
public function write($path, $contents, Config $config) { $location = $this->applyPathPrefix($path); $options = $this->getOptionsFromConfig($config); return $this->ossClient->putObject($this->bucket, $location, $contents, $options); }
php
public function write($path, $contents, Config $config) { $location = $this->applyPathPrefix($path); $options = $this->getOptionsFromConfig($config); return $this->ossClient->putObject($this->bucket, $location, $contents, $options); }
[ "public", "function", "write", "(", "$", "path", ",", "$", "contents", ",", "Config", "$", "config", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "options", "=", "$", "this", "->", "getOptionsFromConfig", "(", "$", "config", ")", ";", "return", "$", "this", "->", "ossClient", "->", "putObject", "(", "$", "this", "->", "bucket", ",", "$", "location", ",", "$", "contents", ",", "$", "options", ")", ";", "}" ]
Write a new file. @param string $path @param string $contents @param Config $config Config object @return array|false false on failure file meta data on success
[ "Write", "a", "new", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L82-L87
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.writeStream
public function writeStream($path, $resource, Config $config) { $location = $this->applyPathPrefix($path); $result = $this->write($location, stream_get_contents($resource), $config); if (is_resource($resource)) { fclose($resource); } return $result; }
php
public function writeStream($path, $resource, Config $config) { $location = $this->applyPathPrefix($path); $result = $this->write($location, stream_get_contents($resource), $config); if (is_resource($resource)) { fclose($resource); } return $result; }
[ "public", "function", "writeStream", "(", "$", "path", ",", "$", "resource", ",", "Config", "$", "config", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "result", "=", "$", "this", "->", "write", "(", "$", "location", ",", "stream_get_contents", "(", "$", "resource", ")", ",", "$", "config", ")", ";", "if", "(", "is_resource", "(", "$", "resource", ")", ")", "{", "fclose", "(", "$", "resource", ")", ";", "}", "return", "$", "result", ";", "}" ]
Write a new file using a stream. @param string $path @param resource $resource @param Config $config Config object @return array|false false on failure file meta data on success
[ "Write", "a", "new", "file", "using", "a", "stream", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L98-L106
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.rename
public function rename($path, $newpath) { $location = $this->applyPathPrefix($path); $destination = $this->applyPathPrefix($newpath); $this->ossClient->copyObject($this->bucket, $location, $this->bucket, $destination); $this->ossClient->deleteObject($this->bucket, $location); return true; }
php
public function rename($path, $newpath) { $location = $this->applyPathPrefix($path); $destination = $this->applyPathPrefix($newpath); $this->ossClient->copyObject($this->bucket, $location, $this->bucket, $destination); $this->ossClient->deleteObject($this->bucket, $location); return true; }
[ "public", "function", "rename", "(", "$", "path", ",", "$", "newpath", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "destination", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "newpath", ")", ";", "$", "this", "->", "ossClient", "->", "copyObject", "(", "$", "this", "->", "bucket", ",", "$", "location", ",", "$", "this", "->", "bucket", ",", "$", "destination", ")", ";", "$", "this", "->", "ossClient", "->", "deleteObject", "(", "$", "this", "->", "bucket", ",", "$", "location", ")", ";", "return", "true", ";", "}" ]
Rename a file. @param string $path @param string $newpath @return bool @throws \OSS\Core\OssException
[ "Rename", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L152-L159
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.copy
public function copy($path, $newpath) { $location = $this->applyPathPrefix($path); $destination = $this->applyPathPrefix($newpath); $this->ossClient->copyObject($this->bucket, $location, $this->bucket, $destination); return true; }
php
public function copy($path, $newpath) { $location = $this->applyPathPrefix($path); $destination = $this->applyPathPrefix($newpath); $this->ossClient->copyObject($this->bucket, $location, $this->bucket, $destination); return true; }
[ "public", "function", "copy", "(", "$", "path", ",", "$", "newpath", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "destination", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "newpath", ")", ";", "$", "this", "->", "ossClient", "->", "copyObject", "(", "$", "this", "->", "bucket", ",", "$", "location", ",", "$", "this", "->", "bucket", ",", "$", "destination", ")", ";", "return", "true", ";", "}" ]
Copy a file. @param string $path @param string $newpath @return bool @throws \OSS\Core\OssException
[ "Copy", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L170-L176
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.delete
public function delete($path) { $location = $this->applyPathPrefix($path); $this->ossClient->deleteObject($this->bucket, $location); return true; }
php
public function delete($path) { $location = $this->applyPathPrefix($path); $this->ossClient->deleteObject($this->bucket, $location); return true; }
[ "public", "function", "delete", "(", "$", "path", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "this", "->", "ossClient", "->", "deleteObject", "(", "$", "this", "->", "bucket", ",", "$", "location", ")", ";", "return", "true", ";", "}" ]
Delete a file. @param string $path @return bool
[ "Delete", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L185-L190
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.deleteDir
public function deleteDir($dirName) { $location = $this->applyPathPrefix($dirName); $lists = $this->listContents($location, true); if (!$lists) { return false; } $objectList = []; foreach ($lists as $value) { $objectList[] = $value['path']; } $this->ossClient->deleteObjects($this->bucket, $objectList); return true; }
php
public function deleteDir($dirName) { $location = $this->applyPathPrefix($dirName); $lists = $this->listContents($location, true); if (!$lists) { return false; } $objectList = []; foreach ($lists as $value) { $objectList[] = $value['path']; } $this->ossClient->deleteObjects($this->bucket, $objectList); return true; }
[ "public", "function", "deleteDir", "(", "$", "dirName", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "dirName", ")", ";", "$", "lists", "=", "$", "this", "->", "listContents", "(", "$", "location", ",", "true", ")", ";", "if", "(", "!", "$", "lists", ")", "{", "return", "false", ";", "}", "$", "objectList", "=", "[", "]", ";", "foreach", "(", "$", "lists", "as", "$", "value", ")", "{", "$", "objectList", "[", "]", "=", "$", "value", "[", "'path'", "]", ";", "}", "$", "this", "->", "ossClient", "->", "deleteObjects", "(", "$", "this", "->", "bucket", ",", "$", "objectList", ")", ";", "return", "true", ";", "}" ]
Delete a directory. @param string $dirName @return bool @throws \OSS\Core\OssException
[ "Delete", "a", "directory", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L200-L213
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.createDir
public function createDir($dirname, Config $config) { $this->ossClient->createObjectDir($this->bucket, $dirname); return true; }
php
public function createDir($dirname, Config $config) { $this->ossClient->createObjectDir($this->bucket, $dirname); return true; }
[ "public", "function", "createDir", "(", "$", "dirname", ",", "Config", "$", "config", ")", "{", "$", "this", "->", "ossClient", "->", "createObjectDir", "(", "$", "this", "->", "bucket", ",", "$", "dirname", ")", ";", "return", "true", ";", "}" ]
Create a directory. @param string $dirname directory name @param Config $config @return array|false
[ "Create", "a", "directory", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L223-L227
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.setVisibility
public function setVisibility($path, $visibility) { $location = $this->applyPathPrefix($path); $this->ossClient->putObjectAcl( $this->bucket, $location, ($visibility == 'public') ? 'public-read' : 'private' ); return true; }
php
public function setVisibility($path, $visibility) { $location = $this->applyPathPrefix($path); $this->ossClient->putObjectAcl( $this->bucket, $location, ($visibility == 'public') ? 'public-read' : 'private' ); return true; }
[ "public", "function", "setVisibility", "(", "$", "path", ",", "$", "visibility", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "this", "->", "ossClient", "->", "putObjectAcl", "(", "$", "this", "->", "bucket", ",", "$", "location", ",", "(", "$", "visibility", "==", "'public'", ")", "?", "'public-read'", ":", "'private'", ")", ";", "return", "true", ";", "}" ]
Set the visibility for a file. @param string $path @param string $visibility @return array|false file meta data Aliyun OSS ACL value: 'default', 'private', 'public-read', 'public-read-write' @throws \OSS\Core\OssException
[ "Set", "the", "visibility", "for", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L240-L249
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.has
public function has($path) { $location = $this->applyPathPrefix($path); return $this->ossClient->doesObjectExist($this->bucket, $location); }
php
public function has($path) { $location = $this->applyPathPrefix($path); return $this->ossClient->doesObjectExist($this->bucket, $location); }
[ "public", "function", "has", "(", "$", "path", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "return", "$", "this", "->", "ossClient", "->", "doesObjectExist", "(", "$", "this", "->", "bucket", ",", "$", "location", ")", ";", "}" ]
Check whether a file exists. @param string $path @return array|bool|null
[ "Check", "whether", "a", "file", "exists", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L258-L262
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.read
public function read($path) { $location = $this->applyPathPrefix($path); return [ 'contents' => $this->ossClient->getObject($this->bucket, $location) ]; }
php
public function read($path) { $location = $this->applyPathPrefix($path); return [ 'contents' => $this->ossClient->getObject($this->bucket, $location) ]; }
[ "public", "function", "read", "(", "$", "path", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "return", "[", "'contents'", "=>", "$", "this", "->", "ossClient", "->", "getObject", "(", "$", "this", "->", "bucket", ",", "$", "location", ")", "]", ";", "}" ]
Read a file. @param string $path @return array|false
[ "Read", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L271-L277
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.readStream
public function readStream($path) { $location = $this->applyPathPrefix($path); $resource = ($this->ossClient->isUseSSL() ? 'https://' : 'http://') . $this->bucket . '.' . $this->endpoint . '/' . $location; return [ 'stream' => $resource = fopen($resource, 'r') ]; }
php
public function readStream($path) { $location = $this->applyPathPrefix($path); $resource = ($this->ossClient->isUseSSL() ? 'https://' : 'http://') . $this->bucket . '.' . $this->endpoint . '/' . $location; return [ 'stream' => $resource = fopen($resource, 'r') ]; }
[ "public", "function", "readStream", "(", "$", "path", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "resource", "=", "(", "$", "this", "->", "ossClient", "->", "isUseSSL", "(", ")", "?", "'https://'", ":", "'http://'", ")", ".", "$", "this", "->", "bucket", ".", "'.'", ".", "$", "this", "->", "endpoint", ".", "'/'", ".", "$", "location", ";", "return", "[", "'stream'", "=>", "$", "resource", "=", "fopen", "(", "$", "resource", ",", "'r'", ")", "]", ";", "}" ]
Read a file as a stream. @param string $path @return array|false
[ "Read", "a", "file", "as", "a", "stream", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L286-L293
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.getObjectUrl
public function getObjectUrl($path) { $location = $this->applyPathPrefix($path); if (($this->ossClient->getObjectAcl($this->bucket, $location)) == 'private') { throw new RuntimeException('This object does not support retrieving URLs.'); } //SDK未提供获取 hostname的公开方法,这里变相获取 $temporaryUrl = $this->getTemporaryUrl($path,60,[]); $urls = parse_url($temporaryUrl); return $urls['scheme'] .'://'. $urls['host'] . $urls['path']; }
php
public function getObjectUrl($path) { $location = $this->applyPathPrefix($path); if (($this->ossClient->getObjectAcl($this->bucket, $location)) == 'private') { throw new RuntimeException('This object does not support retrieving URLs.'); } //SDK未提供获取 hostname的公开方法,这里变相获取 $temporaryUrl = $this->getTemporaryUrl($path,60,[]); $urls = parse_url($temporaryUrl); return $urls['scheme'] .'://'. $urls['host'] . $urls['path']; }
[ "public", "function", "getObjectUrl", "(", "$", "path", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "if", "(", "(", "$", "this", "->", "ossClient", "->", "getObjectAcl", "(", "$", "this", "->", "bucket", ",", "$", "location", ")", ")", "==", "'private'", ")", "{", "throw", "new", "RuntimeException", "(", "'This object does not support retrieving URLs.'", ")", ";", "}", "//SDK未提供获取 hostname的公开方法,这里变相获取", "$", "temporaryUrl", "=", "$", "this", "->", "getTemporaryUrl", "(", "$", "path", ",", "60", ",", "[", "]", ")", ";", "$", "urls", "=", "parse_url", "(", "$", "temporaryUrl", ")", ";", "return", "$", "urls", "[", "'scheme'", "]", ".", "'://'", ".", "$", "urls", "[", "'host'", "]", ".", "$", "urls", "[", "'path'", "]", ";", "}" ]
获取对象访问Url @param string $path @return string @throws \OSS\Core\OssException
[ "获取对象访问Url" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L301-L311
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.getTemporaryUrl
public function getTemporaryUrl($path, $expiration, $options) { $location = $this->applyPathPrefix($path); $temporaryUrl = $this->ossClient->signUrl($this->bucket, $location, $expiration, OssClient::OSS_HTTP_GET, $options); return $temporaryUrl; }
php
public function getTemporaryUrl($path, $expiration, $options) { $location = $this->applyPathPrefix($path); $temporaryUrl = $this->ossClient->signUrl($this->bucket, $location, $expiration, OssClient::OSS_HTTP_GET, $options); return $temporaryUrl; }
[ "public", "function", "getTemporaryUrl", "(", "$", "path", ",", "$", "expiration", ",", "$", "options", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "temporaryUrl", "=", "$", "this", "->", "ossClient", "->", "signUrl", "(", "$", "this", "->", "bucket", ",", "$", "location", ",", "$", "expiration", ",", "OssClient", "::", "OSS_HTTP_GET", ",", "$", "options", ")", ";", "return", "$", "temporaryUrl", ";", "}" ]
获取文件临时访问路径 @param $path @param $expiration @param $options @return string @throws \OSS\Core\OssException
[ "获取文件临时访问路径" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L321-L326
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.listContents
public function listContents($directory = '', $recursive = false) { $directory = rtrim($directory, '\\/'); $result = []; $nextMarker = ''; while (true) { // max-keys 用于限定此次返回object的最大数,如果不设定,默认为100,max-keys取值不能大于1000。 // prefix 限定返回的object key必须以prefix作为前缀。注意使用prefix查询时,返回的key中仍会包含prefix。 // delimiter是一个用于对Object名字进行分组的字符。所有名字包含指定的前缀且第一次出现delimiter字符之间的object作为一组元素 // marker 用户设定结果从marker之后按字母排序的第一个开始返回。 $options = [ 'max-keys' => 1000, 'prefix' => $directory . '/', 'delimiter' => '/', 'marker' => $nextMarker, ]; $res = $this->ossClient->listObjects($this->bucket, $options); // 得到nextMarker,从上一次$res读到的最后一个文件的下一个文件开始继续获取文件列表 $nextMarker = $res->getNextMarker(); $prefixList = $res->getPrefixList(); // 目录列表 $objectList = $res->getObjectList(); // 文件列表 if ($prefixList) { foreach ($prefixList as $value) { $result[] = [ 'type' => 'dir', 'path' => $value->getPrefix() ]; if ($recursive) { $result = array_merge($result, $this->listContents($value->getPrefix(), $recursive)); } } } if ($objectList) { foreach ($objectList as $value) { if (($value->getSize() === 0) && ($value->getKey() === $directory . '/')) { continue; } $result[] = [ 'type' => 'file', 'path' => $value->getKey(), 'timestamp' => strtotime($value->getLastModified()), 'size' => $value->getSize() ]; } } if ($nextMarker === '') { break; } } return $result; }
php
public function listContents($directory = '', $recursive = false) { $directory = rtrim($directory, '\\/'); $result = []; $nextMarker = ''; while (true) { // max-keys 用于限定此次返回object的最大数,如果不设定,默认为100,max-keys取值不能大于1000。 // prefix 限定返回的object key必须以prefix作为前缀。注意使用prefix查询时,返回的key中仍会包含prefix。 // delimiter是一个用于对Object名字进行分组的字符。所有名字包含指定的前缀且第一次出现delimiter字符之间的object作为一组元素 // marker 用户设定结果从marker之后按字母排序的第一个开始返回。 $options = [ 'max-keys' => 1000, 'prefix' => $directory . '/', 'delimiter' => '/', 'marker' => $nextMarker, ]; $res = $this->ossClient->listObjects($this->bucket, $options); // 得到nextMarker,从上一次$res读到的最后一个文件的下一个文件开始继续获取文件列表 $nextMarker = $res->getNextMarker(); $prefixList = $res->getPrefixList(); // 目录列表 $objectList = $res->getObjectList(); // 文件列表 if ($prefixList) { foreach ($prefixList as $value) { $result[] = [ 'type' => 'dir', 'path' => $value->getPrefix() ]; if ($recursive) { $result = array_merge($result, $this->listContents($value->getPrefix(), $recursive)); } } } if ($objectList) { foreach ($objectList as $value) { if (($value->getSize() === 0) && ($value->getKey() === $directory . '/')) { continue; } $result[] = [ 'type' => 'file', 'path' => $value->getKey(), 'timestamp' => strtotime($value->getLastModified()), 'size' => $value->getSize() ]; } } if ($nextMarker === '') { break; } } return $result; }
[ "public", "function", "listContents", "(", "$", "directory", "=", "''", ",", "$", "recursive", "=", "false", ")", "{", "$", "directory", "=", "rtrim", "(", "$", "directory", ",", "'\\\\/'", ")", ";", "$", "result", "=", "[", "]", ";", "$", "nextMarker", "=", "''", ";", "while", "(", "true", ")", "{", "// max-keys 用于限定此次返回object的最大数,如果不设定,默认为100,max-keys取值不能大于1000。", "// prefix 限定返回的object key必须以prefix作为前缀。注意使用prefix查询时,返回的key中仍会包含prefix。", "// delimiter是一个用于对Object名字进行分组的字符。所有名字包含指定的前缀且第一次出现delimiter字符之间的object作为一组元素", "// marker 用户设定结果从marker之后按字母排序的第一个开始返回。", "$", "options", "=", "[", "'max-keys'", "=>", "1000", ",", "'prefix'", "=>", "$", "directory", ".", "'/'", ",", "'delimiter'", "=>", "'/'", ",", "'marker'", "=>", "$", "nextMarker", ",", "]", ";", "$", "res", "=", "$", "this", "->", "ossClient", "->", "listObjects", "(", "$", "this", "->", "bucket", ",", "$", "options", ")", ";", "// 得到nextMarker,从上一次$res读到的最后一个文件的下一个文件开始继续获取文件列表", "$", "nextMarker", "=", "$", "res", "->", "getNextMarker", "(", ")", ";", "$", "prefixList", "=", "$", "res", "->", "getPrefixList", "(", ")", ";", "// 目录列表", "$", "objectList", "=", "$", "res", "->", "getObjectList", "(", ")", ";", "// 文件列表", "if", "(", "$", "prefixList", ")", "{", "foreach", "(", "$", "prefixList", "as", "$", "value", ")", "{", "$", "result", "[", "]", "=", "[", "'type'", "=>", "'dir'", ",", "'path'", "=>", "$", "value", "->", "getPrefix", "(", ")", "]", ";", "if", "(", "$", "recursive", ")", "{", "$", "result", "=", "array_merge", "(", "$", "result", ",", "$", "this", "->", "listContents", "(", "$", "value", "->", "getPrefix", "(", ")", ",", "$", "recursive", ")", ")", ";", "}", "}", "}", "if", "(", "$", "objectList", ")", "{", "foreach", "(", "$", "objectList", "as", "$", "value", ")", "{", "if", "(", "(", "$", "value", "->", "getSize", "(", ")", "===", "0", ")", "&&", "(", "$", "value", "->", "getKey", "(", ")", "===", "$", "directory", ".", "'/'", ")", ")", "{", "continue", ";", "}", "$", "result", "[", "]", "=", "[", "'type'", "=>", "'file'", ",", "'path'", "=>", "$", "value", "->", "getKey", "(", ")", ",", "'timestamp'", "=>", "strtotime", "(", "$", "value", "->", "getLastModified", "(", ")", ")", ",", "'size'", "=>", "$", "value", "->", "getSize", "(", ")", "]", ";", "}", "}", "if", "(", "$", "nextMarker", "===", "''", ")", "{", "break", ";", "}", "}", "return", "$", "result", ";", "}" ]
List contents of a directory. @param string $directory @param bool $recursive @return array @throws \OSS\Core\OssException
[ "List", "contents", "of", "a", "directory", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L337-L390
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.getMetadata
public function getMetadata($path) { $location = $this->applyPathPrefix($path); return $this->ossClient->getObjectMeta($this->bucket, $location); }
php
public function getMetadata($path) { $location = $this->applyPathPrefix($path); return $this->ossClient->getObjectMeta($this->bucket, $location); }
[ "public", "function", "getMetadata", "(", "$", "path", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "return", "$", "this", "->", "ossClient", "->", "getObjectMeta", "(", "$", "this", "->", "bucket", ",", "$", "location", ")", ";", "}" ]
Get all the meta data of a file or directory. @param string $path @return array|false
[ "Get", "all", "the", "meta", "data", "of", "a", "file", "or", "directory", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L399-L403
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.getSize
public function getSize($path) { $location = $this->applyPathPrefix($path); $response = $this->ossClient->getObjectMeta($this->bucket, $location); return [ 'size' => $response['content-length'] ]; }
php
public function getSize($path) { $location = $this->applyPathPrefix($path); $response = $this->ossClient->getObjectMeta($this->bucket, $location); return [ 'size' => $response['content-length'] ]; }
[ "public", "function", "getSize", "(", "$", "path", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "response", "=", "$", "this", "->", "ossClient", "->", "getObjectMeta", "(", "$", "this", "->", "bucket", ",", "$", "location", ")", ";", "return", "[", "'size'", "=>", "$", "response", "[", "'content-length'", "]", "]", ";", "}" ]
Get the size of a file. @param string $path @return array|false
[ "Get", "the", "size", "of", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L412-L419
yuncms/framework
src/filesystem/adapters/OssAdapter.php
OssAdapter.getVisibility
public function getVisibility($path) { $location = $this->applyPathPrefix($path); $response = $this->ossClient->getObjectAcl($this->bucket, $location); return [ 'visibility' => $response, ]; }
php
public function getVisibility($path) { $location = $this->applyPathPrefix($path); $response = $this->ossClient->getObjectAcl($this->bucket, $location); return [ 'visibility' => $response, ]; }
[ "public", "function", "getVisibility", "(", "$", "path", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "response", "=", "$", "this", "->", "ossClient", "->", "getObjectAcl", "(", "$", "this", "->", "bucket", ",", "$", "location", ")", ";", "return", "[", "'visibility'", "=>", "$", "response", ",", "]", ";", "}" ]
Get the visibility of a file. @param string $path @return array|false @throws \OSS\Core\OssException
[ "Get", "the", "visibility", "of", "a", "file", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L461-L468
zodream/thirdparty
src/API/Common.php
Common.exchange
public function exchange($from, $to, $amount = 1) { return $this->getExchange()->setHeader([ 'apikey' => $this->get('apikey') ])->parameters([ 'fromCurrency' => $from, 'toCurrency' => $to, 'amount' => $amount ])->json(); }
php
public function exchange($from, $to, $amount = 1) { return $this->getExchange()->setHeader([ 'apikey' => $this->get('apikey') ])->parameters([ 'fromCurrency' => $from, 'toCurrency' => $to, 'amount' => $amount ])->json(); }
[ "public", "function", "exchange", "(", "$", "from", ",", "$", "to", ",", "$", "amount", "=", "1", ")", "{", "return", "$", "this", "->", "getExchange", "(", ")", "->", "setHeader", "(", "[", "'apikey'", "=>", "$", "this", "->", "get", "(", "'apikey'", ")", "]", ")", "->", "parameters", "(", "[", "'fromCurrency'", "=>", "$", "from", ",", "'toCurrency'", "=>", "$", "to", ",", "'amount'", "=>", "$", "amount", "]", ")", "->", "json", "(", ")", ";", "}" ]
汇率查询 @param string $from @param string $to @param int $amount @return array @throws \Exception
[ "汇率查询" ]
train
https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/API/Common.php#L108-L116
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.applyDefaultValues
public function applyDefaultValues() { $this->config_displayerrors = 'Off'; $this->config_bypasscache = 'Off'; $this->config_minifymarkup = 'Off'; $this->config_debugmode = 'Off'; $this->config_maintenancemode = 'Off'; $this->config_gzipscripts = 'Off'; $this->config_rewriteurl = 'Off'; }
php
public function applyDefaultValues() { $this->config_displayerrors = 'Off'; $this->config_bypasscache = 'Off'; $this->config_minifymarkup = 'Off'; $this->config_debugmode = 'Off'; $this->config_maintenancemode = 'Off'; $this->config_gzipscripts = 'Off'; $this->config_rewriteurl = 'Off'; }
[ "public", "function", "applyDefaultValues", "(", ")", "{", "$", "this", "->", "config_displayerrors", "=", "'Off'", ";", "$", "this", "->", "config_bypasscache", "=", "'Off'", ";", "$", "this", "->", "config_minifymarkup", "=", "'Off'", ";", "$", "this", "->", "config_debugmode", "=", "'Off'", ";", "$", "this", "->", "config_maintenancemode", "=", "'Off'", ";", "$", "this", "->", "config_gzipscripts", "=", "'Off'", ";", "$", "this", "->", "config_rewriteurl", "=", "'Off'", ";", "}" ]
Applies default values to this object. This method should be called from the object's constructor (or equivalent initialization method). @see __construct()
[ "Applies", "default", "values", "to", "this", "object", ".", "This", "method", "should", "be", "called", "from", "the", "object", "s", "constructor", "(", "or", "equivalent", "initialization", "method", ")", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L221-L230
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.getExtensions
public function getExtensions() { if (null == $this->extensions_unserialized && null !== $this->extensions) { $this->extensions_unserialized = unserialize($this->extensions); } return $this->extensions_unserialized; }
php
public function getExtensions() { if (null == $this->extensions_unserialized && null !== $this->extensions) { $this->extensions_unserialized = unserialize($this->extensions); } return $this->extensions_unserialized; }
[ "public", "function", "getExtensions", "(", ")", "{", "if", "(", "null", "==", "$", "this", "->", "extensions_unserialized", "&&", "null", "!==", "$", "this", "->", "extensions", ")", "{", "$", "this", "->", "extensions_unserialized", "=", "unserialize", "(", "$", "this", "->", "extensions", ")", ";", "}", "return", "$", "this", "->", "extensions_unserialized", ";", "}" ]
Get the [extensions] column value. @return
[ "Get", "the", "[", "extensions", "]", "column", "value", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L412-L419
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.getLog
public function getLog() { if (null == $this->log_unserialized && null !== $this->log) { $this->log_unserialized = unserialize($this->log); } return $this->log_unserialized; }
php
public function getLog() { if (null == $this->log_unserialized && null !== $this->log) { $this->log_unserialized = unserialize($this->log); } return $this->log_unserialized; }
[ "public", "function", "getLog", "(", ")", "{", "if", "(", "null", "==", "$", "this", "->", "log_unserialized", "&&", "null", "!==", "$", "this", "->", "log", ")", "{", "$", "this", "->", "log_unserialized", "=", "unserialize", "(", "$", "this", "->", "log", ")", ";", "}", "return", "$", "this", "->", "log_unserialized", ";", "}" ]
Get the [log] column value. @return
[ "Get", "the", "[", "log", "]", "column", "value", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L426-L433
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.getPHP
public function getPHP() { if (null == $this->php_unserialized && null !== $this->php) { $this->php_unserialized = unserialize($this->php); } return $this->php_unserialized; }
php
public function getPHP() { if (null == $this->php_unserialized && null !== $this->php) { $this->php_unserialized = unserialize($this->php); } return $this->php_unserialized; }
[ "public", "function", "getPHP", "(", ")", "{", "if", "(", "null", "==", "$", "this", "->", "php_unserialized", "&&", "null", "!==", "$", "this", "->", "php", ")", "{", "$", "this", "->", "php_unserialized", "=", "unserialize", "(", "$", "this", "->", "php", ")", ";", "}", "return", "$", "this", "->", "php_unserialized", ";", "}" ]
Get the [php] column value. @return
[ "Get", "the", "[", "php", "]", "column", "value", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L440-L447
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.getMySQL
public function getMySQL() { if (null == $this->mysql_unserialized && null !== $this->mysql) { $this->mysql_unserialized = unserialize($this->mysql); } return $this->mysql_unserialized; }
php
public function getMySQL() { if (null == $this->mysql_unserialized && null !== $this->mysql) { $this->mysql_unserialized = unserialize($this->mysql); } return $this->mysql_unserialized; }
[ "public", "function", "getMySQL", "(", ")", "{", "if", "(", "null", "==", "$", "this", "->", "mysql_unserialized", "&&", "null", "!==", "$", "this", "->", "mysql", ")", "{", "$", "this", "->", "mysql_unserialized", "=", "unserialize", "(", "$", "this", "->", "mysql", ")", ";", "}", "return", "$", "this", "->", "mysql_unserialized", ";", "}" ]
Get the [mysql] column value. @return
[ "Get", "the", "[", "mysql", "]", "column", "value", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L454-L461
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setRemoteAppId
public function setRemoteAppId($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } if ($this->remote_app_id !== $v) { $this->remote_app_id = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::REMOTE_APP_ID; } if ($this->aRemoteApp !== null && $this->aRemoteApp->getId() !== $v) { $this->aRemoteApp = null; } return $this; }
php
public function setRemoteAppId($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } if ($this->remote_app_id !== $v) { $this->remote_app_id = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::REMOTE_APP_ID; } if ($this->aRemoteApp !== null && $this->aRemoteApp->getId() !== $v) { $this->aRemoteApp = null; } return $this; }
[ "public", "function", "setRemoteAppId", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", "&&", "is_numeric", "(", "$", "v", ")", ")", "{", "$", "v", "=", "(", "int", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "remote_app_id", "!==", "$", "v", ")", "{", "$", "this", "->", "remote_app_id", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "REMOTE_APP_ID", ";", "}", "if", "(", "$", "this", "->", "aRemoteApp", "!==", "null", "&&", "$", "this", "->", "aRemoteApp", "->", "getId", "(", ")", "!==", "$", "v", ")", "{", "$", "this", "->", "aRemoteApp", "=", "null", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [remote_app_id] column. @param int $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "remote_app_id", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L490-L507
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setApiversion
public function setApiversion($v) { if ($v !== null) { $v = (string) $v; } if ($this->apiversion !== $v) { $this->apiversion = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::APIVERSION; } return $this; }
php
public function setApiversion($v) { if ($v !== null) { $v = (string) $v; } if ($this->apiversion !== $v) { $this->apiversion = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::APIVERSION; } return $this; }
[ "public", "function", "setApiversion", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "apiversion", "!==", "$", "v", ")", "{", "$", "this", "->", "apiversion", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "APIVERSION", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [apiversion] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "apiversion", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L515-L528
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setVersion
public function setVersion($v) { if ($v !== null) { $v = (string) $v; } if ($this->version !== $v) { $this->version = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::VERSION; } return $this; }
php
public function setVersion($v) { if ($v !== null) { $v = (string) $v; } if ($this->version !== $v) { $this->version = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::VERSION; } return $this; }
[ "public", "function", "setVersion", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "version", "!==", "$", "v", ")", "{", "$", "this", "->", "version", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "VERSION", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [version] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "version", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L557-L570
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setConfigDisplayerrors
public function setConfigDisplayerrors($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_displayerrors !== $v) { $this->config_displayerrors = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS; } return $this; }
php
public function setConfigDisplayerrors($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_displayerrors !== $v) { $this->config_displayerrors = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS; } return $this; }
[ "public", "function", "setConfigDisplayerrors", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "config_displayerrors", "!==", "$", "v", ")", "{", "$", "this", "->", "config_displayerrors", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "CONFIG_DISPLAYERRORS", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [config_displayerrors] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "config_displayerrors", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L578-L591
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setConfigBypasscache
public function setConfigBypasscache($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_bypasscache !== $v) { $this->config_bypasscache = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE; } return $this; }
php
public function setConfigBypasscache($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_bypasscache !== $v) { $this->config_bypasscache = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE; } return $this; }
[ "public", "function", "setConfigBypasscache", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "config_bypasscache", "!==", "$", "v", ")", "{", "$", "this", "->", "config_bypasscache", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "CONFIG_BYPASSCACHE", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [config_bypasscache] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "config_bypasscache", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L599-L612
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setConfigMinifymarkup
public function setConfigMinifymarkup($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_minifymarkup !== $v) { $this->config_minifymarkup = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP; } return $this; }
php
public function setConfigMinifymarkup($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_minifymarkup !== $v) { $this->config_minifymarkup = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP; } return $this; }
[ "public", "function", "setConfigMinifymarkup", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "config_minifymarkup", "!==", "$", "v", ")", "{", "$", "this", "->", "config_minifymarkup", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "CONFIG_MINIFYMARKUP", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [config_minifymarkup] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "config_minifymarkup", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L620-L633
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setConfigDebugmode
public function setConfigDebugmode($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_debugmode !== $v) { $this->config_debugmode = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_DEBUGMODE; } return $this; }
php
public function setConfigDebugmode($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_debugmode !== $v) { $this->config_debugmode = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_DEBUGMODE; } return $this; }
[ "public", "function", "setConfigDebugmode", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "config_debugmode", "!==", "$", "v", ")", "{", "$", "this", "->", "config_debugmode", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "CONFIG_DEBUGMODE", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [config_debugmode] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "config_debugmode", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L641-L654
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setConfigMaintenancemode
public function setConfigMaintenancemode($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_maintenancemode !== $v) { $this->config_maintenancemode = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE; } return $this; }
php
public function setConfigMaintenancemode($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_maintenancemode !== $v) { $this->config_maintenancemode = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE; } return $this; }
[ "public", "function", "setConfigMaintenancemode", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "config_maintenancemode", "!==", "$", "v", ")", "{", "$", "this", "->", "config_maintenancemode", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "CONFIG_MAINTENANCEMODE", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [config_maintenancemode] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "config_maintenancemode", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L662-L675
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setConfigGzipscripts
public function setConfigGzipscripts($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_gzipscripts !== $v) { $this->config_gzipscripts = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS; } return $this; }
php
public function setConfigGzipscripts($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_gzipscripts !== $v) { $this->config_gzipscripts = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS; } return $this; }
[ "public", "function", "setConfigGzipscripts", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "config_gzipscripts", "!==", "$", "v", ")", "{", "$", "this", "->", "config_gzipscripts", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "CONFIG_GZIPSCRIPTS", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [config_gzipscripts] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "config_gzipscripts", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L683-L696
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setConfigRewriteurl
public function setConfigRewriteurl($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_rewriteurl !== $v) { $this->config_rewriteurl = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_REWRITEURL; } return $this; }
php
public function setConfigRewriteurl($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_rewriteurl !== $v) { $this->config_rewriteurl = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_REWRITEURL; } return $this; }
[ "public", "function", "setConfigRewriteurl", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "config_rewriteurl", "!==", "$", "v", ")", "{", "$", "this", "->", "config_rewriteurl", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "CONFIG_REWRITEURL", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [config_rewriteurl] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "config_rewriteurl", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L704-L717
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setConfigAdminemail
public function setConfigAdminemail($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_adminemail !== $v) { $this->config_adminemail = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL; } return $this; }
php
public function setConfigAdminemail($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_adminemail !== $v) { $this->config_adminemail = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL; } return $this; }
[ "public", "function", "setConfigAdminemail", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "config_adminemail", "!==", "$", "v", ")", "{", "$", "this", "->", "config_adminemail", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "CONFIG_ADMINEMAIL", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [config_adminemail] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "config_adminemail", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L725-L738
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setConfigCachemode
public function setConfigCachemode($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_cachemode !== $v) { $this->config_cachemode = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_CACHEMODE; } return $this; }
php
public function setConfigCachemode($v) { if ($v !== null) { $v = (string) $v; } if ($this->config_cachemode !== $v) { $this->config_cachemode = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::CONFIG_CACHEMODE; } return $this; }
[ "public", "function", "setConfigCachemode", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "config_cachemode", "!==", "$", "v", ")", "{", "$", "this", "->", "config_cachemode", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "CONFIG_CACHEMODE", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [config_cachemode] column. @param string $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "config_cachemode", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L746-L759
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setStatuscode
public function setStatuscode($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } if ($this->statuscode !== $v) { $this->statuscode = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::STATUSCODE; } return $this; }
php
public function setStatuscode($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } if ($this->statuscode !== $v) { $this->statuscode = $v; $this->modifiedColumns[] = RemoteHistoryContaoPeer::STATUSCODE; } return $this; }
[ "public", "function", "setStatuscode", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", "&&", "is_numeric", "(", "$", "v", ")", ")", "{", "$", "v", "=", "(", "int", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "statuscode", "!==", "$", "v", ")", "{", "$", "this", "->", "statuscode", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "STATUSCODE", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [statuscode] column. @param int $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "statuscode", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L767-L780
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setExtensions
public function setExtensions($v) { if ($this->extensions_unserialized !== $v) { $this->extensions_unserialized = $v; $this->extensions = serialize($v); $this->modifiedColumns[] = RemoteHistoryContaoPeer::EXTENSIONS; } return $this; }
php
public function setExtensions($v) { if ($this->extensions_unserialized !== $v) { $this->extensions_unserialized = $v; $this->extensions = serialize($v); $this->modifiedColumns[] = RemoteHistoryContaoPeer::EXTENSIONS; } return $this; }
[ "public", "function", "setExtensions", "(", "$", "v", ")", "{", "if", "(", "$", "this", "->", "extensions_unserialized", "!==", "$", "v", ")", "{", "$", "this", "->", "extensions_unserialized", "=", "$", "v", ";", "$", "this", "->", "extensions", "=", "serialize", "(", "$", "v", ")", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "EXTENSIONS", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [extensions] column. @param $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "extensions", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L788-L798
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setLog
public function setLog($v) { if ($this->log_unserialized !== $v) { $this->log_unserialized = $v; $this->log = serialize($v); $this->modifiedColumns[] = RemoteHistoryContaoPeer::LOG; } return $this; }
php
public function setLog($v) { if ($this->log_unserialized !== $v) { $this->log_unserialized = $v; $this->log = serialize($v); $this->modifiedColumns[] = RemoteHistoryContaoPeer::LOG; } return $this; }
[ "public", "function", "setLog", "(", "$", "v", ")", "{", "if", "(", "$", "this", "->", "log_unserialized", "!==", "$", "v", ")", "{", "$", "this", "->", "log_unserialized", "=", "$", "v", ";", "$", "this", "->", "log", "=", "serialize", "(", "$", "v", ")", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "LOG", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [log] column. @param $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "log", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L806-L816
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setPHP
public function setPHP($v) { if ($this->php_unserialized !== $v) { $this->php_unserialized = $v; $this->php = serialize($v); $this->modifiedColumns[] = RemoteHistoryContaoPeer::PHP; } return $this; }
php
public function setPHP($v) { if ($this->php_unserialized !== $v) { $this->php_unserialized = $v; $this->php = serialize($v); $this->modifiedColumns[] = RemoteHistoryContaoPeer::PHP; } return $this; }
[ "public", "function", "setPHP", "(", "$", "v", ")", "{", "if", "(", "$", "this", "->", "php_unserialized", "!==", "$", "v", ")", "{", "$", "this", "->", "php_unserialized", "=", "$", "v", ";", "$", "this", "->", "php", "=", "serialize", "(", "$", "v", ")", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "PHP", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [php] column. @param $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "php", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L824-L834
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setMySQL
public function setMySQL($v) { if ($this->mysql_unserialized !== $v) { $this->mysql_unserialized = $v; $this->mysql = serialize($v); $this->modifiedColumns[] = RemoteHistoryContaoPeer::MYSQL; } return $this; }
php
public function setMySQL($v) { if ($this->mysql_unserialized !== $v) { $this->mysql_unserialized = $v; $this->mysql = serialize($v); $this->modifiedColumns[] = RemoteHistoryContaoPeer::MYSQL; } return $this; }
[ "public", "function", "setMySQL", "(", "$", "v", ")", "{", "if", "(", "$", "this", "->", "mysql_unserialized", "!==", "$", "v", ")", "{", "$", "this", "->", "mysql_unserialized", "=", "$", "v", ";", "$", "this", "->", "mysql", "=", "serialize", "(", "$", "v", ")", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "MYSQL", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [mysql] column. @param $v new value @return RemoteHistoryContao The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "mysql", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L842-L852
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.hasOnlyDefaultValues
public function hasOnlyDefaultValues() { if ($this->config_displayerrors !== 'Off') { return false; } if ($this->config_bypasscache !== 'Off') { return false; } if ($this->config_minifymarkup !== 'Off') { return false; } if ($this->config_debugmode !== 'Off') { return false; } if ($this->config_maintenancemode !== 'Off') { return false; } if ($this->config_gzipscripts !== 'Off') { return false; } if ($this->config_rewriteurl !== 'Off') { return false; } // otherwise, everything was equal, so return true return true; }
php
public function hasOnlyDefaultValues() { if ($this->config_displayerrors !== 'Off') { return false; } if ($this->config_bypasscache !== 'Off') { return false; } if ($this->config_minifymarkup !== 'Off') { return false; } if ($this->config_debugmode !== 'Off') { return false; } if ($this->config_maintenancemode !== 'Off') { return false; } if ($this->config_gzipscripts !== 'Off') { return false; } if ($this->config_rewriteurl !== 'Off') { return false; } // otherwise, everything was equal, so return true return true; }
[ "public", "function", "hasOnlyDefaultValues", "(", ")", "{", "if", "(", "$", "this", "->", "config_displayerrors", "!==", "'Off'", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "config_bypasscache", "!==", "'Off'", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "config_minifymarkup", "!==", "'Off'", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "config_debugmode", "!==", "'Off'", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "config_maintenancemode", "!==", "'Off'", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "config_gzipscripts", "!==", "'Off'", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "config_rewriteurl", "!==", "'Off'", ")", "{", "return", "false", ";", "}", "// otherwise, everything was equal, so return true", "return", "true", ";", "}" ]
Indicates whether the columns in this object are only set to default values. This method can be used in conjunction with isModified() to indicate whether an object is both modified _and_ has some values set which are non-default. @return boolean Whether the columns in this object are only been set with default values.
[ "Indicates", "whether", "the", "columns", "in", "this", "object", "are", "only", "set", "to", "default", "values", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L862-L894
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.hydrate
public function hydrate($row, $startcol = 0, $rehydrate = false) { try { $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->remote_app_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; $this->apiversion = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->name = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->version = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; $this->config_displayerrors = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; $this->config_bypasscache = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; $this->config_minifymarkup = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; $this->config_debugmode = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; $this->config_maintenancemode = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; $this->config_gzipscripts = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; $this->config_rewriteurl = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; $this->config_adminemail = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; $this->config_cachemode = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; $this->statuscode = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null; $this->extensions = $row[$startcol + 15]; $this->log = $row[$startcol + 16]; $this->php = $row[$startcol + 17]; $this->mysql = $row[$startcol + 18]; $this->resetModified(); $this->setNew(false); if ($rehydrate) { $this->ensureConsistency(); } $this->postHydrate($row, $startcol, $rehydrate); return $startcol + 19; // 19 = RemoteHistoryContaoPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating RemoteHistoryContao object", $e); } }
php
public function hydrate($row, $startcol = 0, $rehydrate = false) { try { $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->remote_app_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; $this->apiversion = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->name = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->version = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; $this->config_displayerrors = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; $this->config_bypasscache = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; $this->config_minifymarkup = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; $this->config_debugmode = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; $this->config_maintenancemode = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; $this->config_gzipscripts = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; $this->config_rewriteurl = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; $this->config_adminemail = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; $this->config_cachemode = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; $this->statuscode = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null; $this->extensions = $row[$startcol + 15]; $this->log = $row[$startcol + 16]; $this->php = $row[$startcol + 17]; $this->mysql = $row[$startcol + 18]; $this->resetModified(); $this->setNew(false); if ($rehydrate) { $this->ensureConsistency(); } $this->postHydrate($row, $startcol, $rehydrate); return $startcol + 19; // 19 = RemoteHistoryContaoPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating RemoteHistoryContao object", $e); } }
[ "public", "function", "hydrate", "(", "$", "row", ",", "$", "startcol", "=", "0", ",", "$", "rehydrate", "=", "false", ")", "{", "try", "{", "$", "this", "->", "id", "=", "(", "$", "row", "[", "$", "startcol", "+", "0", "]", "!==", "null", ")", "?", "(", "int", ")", "$", "row", "[", "$", "startcol", "+", "0", "]", ":", "null", ";", "$", "this", "->", "remote_app_id", "=", "(", "$", "row", "[", "$", "startcol", "+", "1", "]", "!==", "null", ")", "?", "(", "int", ")", "$", "row", "[", "$", "startcol", "+", "1", "]", ":", "null", ";", "$", "this", "->", "apiversion", "=", "(", "$", "row", "[", "$", "startcol", "+", "2", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "2", "]", ":", "null", ";", "$", "this", "->", "name", "=", "(", "$", "row", "[", "$", "startcol", "+", "3", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "3", "]", ":", "null", ";", "$", "this", "->", "version", "=", "(", "$", "row", "[", "$", "startcol", "+", "4", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "4", "]", ":", "null", ";", "$", "this", "->", "config_displayerrors", "=", "(", "$", "row", "[", "$", "startcol", "+", "5", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "5", "]", ":", "null", ";", "$", "this", "->", "config_bypasscache", "=", "(", "$", "row", "[", "$", "startcol", "+", "6", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "6", "]", ":", "null", ";", "$", "this", "->", "config_minifymarkup", "=", "(", "$", "row", "[", "$", "startcol", "+", "7", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "7", "]", ":", "null", ";", "$", "this", "->", "config_debugmode", "=", "(", "$", "row", "[", "$", "startcol", "+", "8", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "8", "]", ":", "null", ";", "$", "this", "->", "config_maintenancemode", "=", "(", "$", "row", "[", "$", "startcol", "+", "9", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "9", "]", ":", "null", ";", "$", "this", "->", "config_gzipscripts", "=", "(", "$", "row", "[", "$", "startcol", "+", "10", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "10", "]", ":", "null", ";", "$", "this", "->", "config_rewriteurl", "=", "(", "$", "row", "[", "$", "startcol", "+", "11", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "11", "]", ":", "null", ";", "$", "this", "->", "config_adminemail", "=", "(", "$", "row", "[", "$", "startcol", "+", "12", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "12", "]", ":", "null", ";", "$", "this", "->", "config_cachemode", "=", "(", "$", "row", "[", "$", "startcol", "+", "13", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "13", "]", ":", "null", ";", "$", "this", "->", "statuscode", "=", "(", "$", "row", "[", "$", "startcol", "+", "14", "]", "!==", "null", ")", "?", "(", "int", ")", "$", "row", "[", "$", "startcol", "+", "14", "]", ":", "null", ";", "$", "this", "->", "extensions", "=", "$", "row", "[", "$", "startcol", "+", "15", "]", ";", "$", "this", "->", "log", "=", "$", "row", "[", "$", "startcol", "+", "16", "]", ";", "$", "this", "->", "php", "=", "$", "row", "[", "$", "startcol", "+", "17", "]", ";", "$", "this", "->", "mysql", "=", "$", "row", "[", "$", "startcol", "+", "18", "]", ";", "$", "this", "->", "resetModified", "(", ")", ";", "$", "this", "->", "setNew", "(", "false", ")", ";", "if", "(", "$", "rehydrate", ")", "{", "$", "this", "->", "ensureConsistency", "(", ")", ";", "}", "$", "this", "->", "postHydrate", "(", "$", "row", ",", "$", "startcol", ",", "$", "rehydrate", ")", ";", "return", "$", "startcol", "+", "19", ";", "// 19 = RemoteHistoryContaoPeer::NUM_HYDRATE_COLUMNS.", "}", "catch", "(", "Exception", "$", "e", ")", "{", "throw", "new", "PropelException", "(", "\"Error populating RemoteHistoryContao object\"", ",", "$", "e", ")", ";", "}", "}" ]
Hydrates (populates) the object variables with values from the database resultset. An offset (0-based "start column") is specified so that objects can be hydrated with a subset of the columns in the resultset rows. This is needed, for example, for results of JOIN queries where the resultset row includes columns from two or more tables. @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) @param int $startcol 0-based offset column which indicates which resultset column to start with. @param boolean $rehydrate Whether this object is being re-hydrated from the database. @return int next starting column @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
[ "Hydrates", "(", "populates", ")", "the", "object", "variables", "with", "values", "from", "the", "database", "resultset", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L910-L947
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.ensureConsistency
public function ensureConsistency() { if ($this->aRemoteApp !== null && $this->remote_app_id !== $this->aRemoteApp->getId()) { $this->aRemoteApp = null; } }
php
public function ensureConsistency() { if ($this->aRemoteApp !== null && $this->remote_app_id !== $this->aRemoteApp->getId()) { $this->aRemoteApp = null; } }
[ "public", "function", "ensureConsistency", "(", ")", "{", "if", "(", "$", "this", "->", "aRemoteApp", "!==", "null", "&&", "$", "this", "->", "remote_app_id", "!==", "$", "this", "->", "aRemoteApp", "->", "getId", "(", ")", ")", "{", "$", "this", "->", "aRemoteApp", "=", "null", ";", "}", "}" ]
Checks and repairs the internal consistency of the object. This method is executed after an already-instantiated object is re-hydrated from the database. It exists to check any foreign keys to make sure that the objects related to the current object are correct based on foreign key. You can override this method in the stub class, but you should always invoke the base method from the overridden method (i.e. parent::ensureConsistency()), in case your model changes. @throws PropelException
[ "Checks", "and", "repairs", "the", "internal", "consistency", "of", "the", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L962-L968
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.doSave
protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aRemoteApp !== null) { if ($this->aRemoteApp->isModified() || $this->aRemoteApp->isNew()) { $affectedRows += $this->aRemoteApp->save($con); } $this->setRemoteApp($this->aRemoteApp); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; }
php
protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aRemoteApp !== null) { if ($this->aRemoteApp->isModified() || $this->aRemoteApp->isNew()) { $affectedRows += $this->aRemoteApp->save($con); } $this->setRemoteApp($this->aRemoteApp); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; }
[ "protected", "function", "doSave", "(", "PropelPDO", "$", "con", ")", "{", "$", "affectedRows", "=", "0", ";", "// initialize var to track total num of affected rows", "if", "(", "!", "$", "this", "->", "alreadyInSave", ")", "{", "$", "this", "->", "alreadyInSave", "=", "true", ";", "// We call the save method on the following object(s) if they", "// were passed to this object by their corresponding set", "// method. This object relates to these object(s) by a", "// foreign key reference.", "if", "(", "$", "this", "->", "aRemoteApp", "!==", "null", ")", "{", "if", "(", "$", "this", "->", "aRemoteApp", "->", "isModified", "(", ")", "||", "$", "this", "->", "aRemoteApp", "->", "isNew", "(", ")", ")", "{", "$", "affectedRows", "+=", "$", "this", "->", "aRemoteApp", "->", "save", "(", "$", "con", ")", ";", "}", "$", "this", "->", "setRemoteApp", "(", "$", "this", "->", "aRemoteApp", ")", ";", "}", "if", "(", "$", "this", "->", "isNew", "(", ")", "||", "$", "this", "->", "isModified", "(", ")", ")", "{", "// persist changes", "if", "(", "$", "this", "->", "isNew", "(", ")", ")", "{", "$", "this", "->", "doInsert", "(", "$", "con", ")", ";", "}", "else", "{", "$", "this", "->", "doUpdate", "(", "$", "con", ")", ";", "}", "$", "affectedRows", "+=", "1", ";", "$", "this", "->", "resetModified", "(", ")", ";", "}", "$", "this", "->", "alreadyInSave", "=", "false", ";", "}", "return", "$", "affectedRows", ";", "}" ]
Performs the work of inserting or updating the row in the database. If the object is new, it inserts it; otherwise an update is performed. All related objects are also updated in this method. @param PropelPDO $con @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. @throws PropelException @see save()
[ "Performs", "the", "work", "of", "inserting", "or", "updating", "the", "row", "in", "the", "database", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1115-L1149
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.doInsert
protected function doInsert(PropelPDO $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[] = RemoteHistoryContaoPeer::ID; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . RemoteHistoryContaoPeer::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(RemoteHistoryContaoPeer::ID)) { $modifiedColumns[':p' . $index++] = '`id`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::REMOTE_APP_ID)) { $modifiedColumns[':p' . $index++] = '`remote_app_id`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::APIVERSION)) { $modifiedColumns[':p' . $index++] = '`apiVersion`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::NAME)) { $modifiedColumns[':p' . $index++] = '`name`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::VERSION)) { $modifiedColumns[':p' . $index++] = '`version`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS)) { $modifiedColumns[':p' . $index++] = '`config_displayErrors`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE)) { $modifiedColumns[':p' . $index++] = '`config_bypassCache`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP)) { $modifiedColumns[':p' . $index++] = '`config_minifyMarkup`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_DEBUGMODE)) { $modifiedColumns[':p' . $index++] = '`config_debugMode`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE)) { $modifiedColumns[':p' . $index++] = '`config_maintenanceMode`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS)) { $modifiedColumns[':p' . $index++] = '`config_gzipScripts`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_REWRITEURL)) { $modifiedColumns[':p' . $index++] = '`config_rewriteURL`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL)) { $modifiedColumns[':p' . $index++] = '`config_adminEmail`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_CACHEMODE)) { $modifiedColumns[':p' . $index++] = '`config_cacheMode`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::STATUSCODE)) { $modifiedColumns[':p' . $index++] = '`statuscode`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::EXTENSIONS)) { $modifiedColumns[':p' . $index++] = '`extensions`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::LOG)) { $modifiedColumns[':p' . $index++] = '`log`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::PHP)) { $modifiedColumns[':p' . $index++] = '`php`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::MYSQL)) { $modifiedColumns[':p' . $index++] = '`mysql`'; } $sql = sprintf( 'INSERT INTO `remote_history_contao` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); try { $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { case '`id`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; case '`remote_app_id`': $stmt->bindValue($identifier, $this->remote_app_id, PDO::PARAM_INT); break; case '`apiVersion`': $stmt->bindValue($identifier, $this->apiversion, PDO::PARAM_STR); break; case '`name`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case '`version`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_STR); break; case '`config_displayErrors`': $stmt->bindValue($identifier, $this->config_displayerrors, PDO::PARAM_STR); break; case '`config_bypassCache`': $stmt->bindValue($identifier, $this->config_bypasscache, PDO::PARAM_STR); break; case '`config_minifyMarkup`': $stmt->bindValue($identifier, $this->config_minifymarkup, PDO::PARAM_STR); break; case '`config_debugMode`': $stmt->bindValue($identifier, $this->config_debugmode, PDO::PARAM_STR); break; case '`config_maintenanceMode`': $stmt->bindValue($identifier, $this->config_maintenancemode, PDO::PARAM_STR); break; case '`config_gzipScripts`': $stmt->bindValue($identifier, $this->config_gzipscripts, PDO::PARAM_STR); break; case '`config_rewriteURL`': $stmt->bindValue($identifier, $this->config_rewriteurl, PDO::PARAM_STR); break; case '`config_adminEmail`': $stmt->bindValue($identifier, $this->config_adminemail, PDO::PARAM_STR); break; case '`config_cacheMode`': $stmt->bindValue($identifier, $this->config_cachemode, PDO::PARAM_STR); break; case '`statuscode`': $stmt->bindValue($identifier, $this->statuscode, PDO::PARAM_INT); break; case '`extensions`': $stmt->bindValue($identifier, $this->extensions, PDO::PARAM_STR); break; case '`log`': $stmt->bindValue($identifier, $this->log, PDO::PARAM_STR); break; case '`php`': $stmt->bindValue($identifier, $this->php, PDO::PARAM_STR); break; case '`mysql`': $stmt->bindValue($identifier, $this->mysql, PDO::PARAM_STR); break; } } $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); } try { $pk = $con->lastInsertId(); } catch (Exception $e) { throw new PropelException('Unable to get autoincrement id.', $e); } $this->setId($pk); $this->setNew(false); }
php
protected function doInsert(PropelPDO $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[] = RemoteHistoryContaoPeer::ID; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . RemoteHistoryContaoPeer::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(RemoteHistoryContaoPeer::ID)) { $modifiedColumns[':p' . $index++] = '`id`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::REMOTE_APP_ID)) { $modifiedColumns[':p' . $index++] = '`remote_app_id`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::APIVERSION)) { $modifiedColumns[':p' . $index++] = '`apiVersion`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::NAME)) { $modifiedColumns[':p' . $index++] = '`name`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::VERSION)) { $modifiedColumns[':p' . $index++] = '`version`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS)) { $modifiedColumns[':p' . $index++] = '`config_displayErrors`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE)) { $modifiedColumns[':p' . $index++] = '`config_bypassCache`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP)) { $modifiedColumns[':p' . $index++] = '`config_minifyMarkup`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_DEBUGMODE)) { $modifiedColumns[':p' . $index++] = '`config_debugMode`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE)) { $modifiedColumns[':p' . $index++] = '`config_maintenanceMode`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS)) { $modifiedColumns[':p' . $index++] = '`config_gzipScripts`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_REWRITEURL)) { $modifiedColumns[':p' . $index++] = '`config_rewriteURL`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL)) { $modifiedColumns[':p' . $index++] = '`config_adminEmail`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_CACHEMODE)) { $modifiedColumns[':p' . $index++] = '`config_cacheMode`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::STATUSCODE)) { $modifiedColumns[':p' . $index++] = '`statuscode`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::EXTENSIONS)) { $modifiedColumns[':p' . $index++] = '`extensions`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::LOG)) { $modifiedColumns[':p' . $index++] = '`log`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::PHP)) { $modifiedColumns[':p' . $index++] = '`php`'; } if ($this->isColumnModified(RemoteHistoryContaoPeer::MYSQL)) { $modifiedColumns[':p' . $index++] = '`mysql`'; } $sql = sprintf( 'INSERT INTO `remote_history_contao` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); try { $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { case '`id`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; case '`remote_app_id`': $stmt->bindValue($identifier, $this->remote_app_id, PDO::PARAM_INT); break; case '`apiVersion`': $stmt->bindValue($identifier, $this->apiversion, PDO::PARAM_STR); break; case '`name`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case '`version`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_STR); break; case '`config_displayErrors`': $stmt->bindValue($identifier, $this->config_displayerrors, PDO::PARAM_STR); break; case '`config_bypassCache`': $stmt->bindValue($identifier, $this->config_bypasscache, PDO::PARAM_STR); break; case '`config_minifyMarkup`': $stmt->bindValue($identifier, $this->config_minifymarkup, PDO::PARAM_STR); break; case '`config_debugMode`': $stmt->bindValue($identifier, $this->config_debugmode, PDO::PARAM_STR); break; case '`config_maintenanceMode`': $stmt->bindValue($identifier, $this->config_maintenancemode, PDO::PARAM_STR); break; case '`config_gzipScripts`': $stmt->bindValue($identifier, $this->config_gzipscripts, PDO::PARAM_STR); break; case '`config_rewriteURL`': $stmt->bindValue($identifier, $this->config_rewriteurl, PDO::PARAM_STR); break; case '`config_adminEmail`': $stmt->bindValue($identifier, $this->config_adminemail, PDO::PARAM_STR); break; case '`config_cacheMode`': $stmt->bindValue($identifier, $this->config_cachemode, PDO::PARAM_STR); break; case '`statuscode`': $stmt->bindValue($identifier, $this->statuscode, PDO::PARAM_INT); break; case '`extensions`': $stmt->bindValue($identifier, $this->extensions, PDO::PARAM_STR); break; case '`log`': $stmt->bindValue($identifier, $this->log, PDO::PARAM_STR); break; case '`php`': $stmt->bindValue($identifier, $this->php, PDO::PARAM_STR); break; case '`mysql`': $stmt->bindValue($identifier, $this->mysql, PDO::PARAM_STR); break; } } $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); } try { $pk = $con->lastInsertId(); } catch (Exception $e) { throw new PropelException('Unable to get autoincrement id.', $e); } $this->setId($pk); $this->setNew(false); }
[ "protected", "function", "doInsert", "(", "PropelPDO", "$", "con", ")", "{", "$", "modifiedColumns", "=", "array", "(", ")", ";", "$", "index", "=", "0", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteHistoryContaoPeer", "::", "ID", ";", "if", "(", "null", "!==", "$", "this", "->", "id", ")", "{", "throw", "new", "PropelException", "(", "'Cannot insert a value for auto-increment primary key ('", ".", "RemoteHistoryContaoPeer", "::", "ID", ".", "')'", ")", ";", "}", "// check the columns in natural order for more readable SQL queries", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "ID", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`id`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "REMOTE_APP_ID", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`remote_app_id`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "APIVERSION", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`apiVersion`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "NAME", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`name`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "VERSION", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`version`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_DISPLAYERRORS", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`config_displayErrors`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_BYPASSCACHE", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`config_bypassCache`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_MINIFYMARKUP", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`config_minifyMarkup`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_DEBUGMODE", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`config_debugMode`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_MAINTENANCEMODE", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`config_maintenanceMode`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_GZIPSCRIPTS", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`config_gzipScripts`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_REWRITEURL", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`config_rewriteURL`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_ADMINEMAIL", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`config_adminEmail`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_CACHEMODE", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`config_cacheMode`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "STATUSCODE", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`statuscode`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "EXTENSIONS", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`extensions`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "LOG", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`log`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "PHP", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`php`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "MYSQL", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`mysql`'", ";", "}", "$", "sql", "=", "sprintf", "(", "'INSERT INTO `remote_history_contao` (%s) VALUES (%s)'", ",", "implode", "(", "', '", ",", "$", "modifiedColumns", ")", ",", "implode", "(", "', '", ",", "array_keys", "(", "$", "modifiedColumns", ")", ")", ")", ";", "try", "{", "$", "stmt", "=", "$", "con", "->", "prepare", "(", "$", "sql", ")", ";", "foreach", "(", "$", "modifiedColumns", "as", "$", "identifier", "=>", "$", "columnName", ")", "{", "switch", "(", "$", "columnName", ")", "{", "case", "'`id`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "id", ",", "PDO", "::", "PARAM_INT", ")", ";", "break", ";", "case", "'`remote_app_id`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "remote_app_id", ",", "PDO", "::", "PARAM_INT", ")", ";", "break", ";", "case", "'`apiVersion`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "apiversion", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`name`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "name", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`version`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "version", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`config_displayErrors`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "config_displayerrors", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`config_bypassCache`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "config_bypasscache", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`config_minifyMarkup`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "config_minifymarkup", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`config_debugMode`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "config_debugmode", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`config_maintenanceMode`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "config_maintenancemode", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`config_gzipScripts`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "config_gzipscripts", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`config_rewriteURL`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "config_rewriteurl", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`config_adminEmail`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "config_adminemail", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`config_cacheMode`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "config_cachemode", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`statuscode`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "statuscode", ",", "PDO", "::", "PARAM_INT", ")", ";", "break", ";", "case", "'`extensions`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "extensions", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`log`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "log", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`php`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "php", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`mysql`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "mysql", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "}", "}", "$", "stmt", "->", "execute", "(", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "Propel", "::", "log", "(", "$", "e", "->", "getMessage", "(", ")", ",", "Propel", "::", "LOG_ERR", ")", ";", "throw", "new", "PropelException", "(", "sprintf", "(", "'Unable to execute INSERT statement [%s]'", ",", "$", "sql", ")", ",", "$", "e", ")", ";", "}", "try", "{", "$", "pk", "=", "$", "con", "->", "lastInsertId", "(", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "throw", "new", "PropelException", "(", "'Unable to get autoincrement id.'", ",", "$", "e", ")", ";", "}", "$", "this", "->", "setId", "(", "$", "pk", ")", ";", "$", "this", "->", "setNew", "(", "false", ")", ";", "}" ]
Insert the row in the database. @param PropelPDO $con @throws PropelException @see doSave()
[ "Insert", "the", "row", "in", "the", "database", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1159-L1311
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.getByPosition
public function getByPosition($pos) { switch ($pos) { case 0: return $this->getId(); break; case 1: return $this->getRemoteAppId(); break; case 2: return $this->getApiversion(); break; case 3: return $this->getName(); break; case 4: return $this->getVersion(); break; case 5: return $this->getConfigDisplayerrors(); break; case 6: return $this->getConfigBypasscache(); break; case 7: return $this->getConfigMinifymarkup(); break; case 8: return $this->getConfigDebugmode(); break; case 9: return $this->getConfigMaintenancemode(); break; case 10: return $this->getConfigGzipscripts(); break; case 11: return $this->getConfigRewriteurl(); break; case 12: return $this->getConfigAdminemail(); break; case 13: return $this->getConfigCachemode(); break; case 14: return $this->getStatuscode(); break; case 15: return $this->getExtensions(); break; case 16: return $this->getLog(); break; case 17: return $this->getPHP(); break; case 18: return $this->getMySQL(); break; default: return null; break; } // switch() }
php
public function getByPosition($pos) { switch ($pos) { case 0: return $this->getId(); break; case 1: return $this->getRemoteAppId(); break; case 2: return $this->getApiversion(); break; case 3: return $this->getName(); break; case 4: return $this->getVersion(); break; case 5: return $this->getConfigDisplayerrors(); break; case 6: return $this->getConfigBypasscache(); break; case 7: return $this->getConfigMinifymarkup(); break; case 8: return $this->getConfigDebugmode(); break; case 9: return $this->getConfigMaintenancemode(); break; case 10: return $this->getConfigGzipscripts(); break; case 11: return $this->getConfigRewriteurl(); break; case 12: return $this->getConfigAdminemail(); break; case 13: return $this->getConfigCachemode(); break; case 14: return $this->getStatuscode(); break; case 15: return $this->getExtensions(); break; case 16: return $this->getLog(); break; case 17: return $this->getPHP(); break; case 18: return $this->getMySQL(); break; default: return null; break; } // switch() }
[ "public", "function", "getByPosition", "(", "$", "pos", ")", "{", "switch", "(", "$", "pos", ")", "{", "case", "0", ":", "return", "$", "this", "->", "getId", "(", ")", ";", "break", ";", "case", "1", ":", "return", "$", "this", "->", "getRemoteAppId", "(", ")", ";", "break", ";", "case", "2", ":", "return", "$", "this", "->", "getApiversion", "(", ")", ";", "break", ";", "case", "3", ":", "return", "$", "this", "->", "getName", "(", ")", ";", "break", ";", "case", "4", ":", "return", "$", "this", "->", "getVersion", "(", ")", ";", "break", ";", "case", "5", ":", "return", "$", "this", "->", "getConfigDisplayerrors", "(", ")", ";", "break", ";", "case", "6", ":", "return", "$", "this", "->", "getConfigBypasscache", "(", ")", ";", "break", ";", "case", "7", ":", "return", "$", "this", "->", "getConfigMinifymarkup", "(", ")", ";", "break", ";", "case", "8", ":", "return", "$", "this", "->", "getConfigDebugmode", "(", ")", ";", "break", ";", "case", "9", ":", "return", "$", "this", "->", "getConfigMaintenancemode", "(", ")", ";", "break", ";", "case", "10", ":", "return", "$", "this", "->", "getConfigGzipscripts", "(", ")", ";", "break", ";", "case", "11", ":", "return", "$", "this", "->", "getConfigRewriteurl", "(", ")", ";", "break", ";", "case", "12", ":", "return", "$", "this", "->", "getConfigAdminemail", "(", ")", ";", "break", ";", "case", "13", ":", "return", "$", "this", "->", "getConfigCachemode", "(", ")", ";", "break", ";", "case", "14", ":", "return", "$", "this", "->", "getStatuscode", "(", ")", ";", "break", ";", "case", "15", ":", "return", "$", "this", "->", "getExtensions", "(", ")", ";", "break", ";", "case", "16", ":", "return", "$", "this", "->", "getLog", "(", ")", ";", "break", ";", "case", "17", ":", "return", "$", "this", "->", "getPHP", "(", ")", ";", "break", ";", "case", "18", ":", "return", "$", "this", "->", "getMySQL", "(", ")", ";", "break", ";", "default", ":", "return", "null", ";", "break", ";", "}", "// switch()", "}" ]
Retrieves a field from the object by Position as specified in the xml schema. Zero-based. @param int $pos position in xml schema @return mixed Value of field at $pos
[ "Retrieves", "a", "field", "from", "the", "object", "by", "Position", "as", "specified", "in", "the", "xml", "schema", ".", "Zero", "-", "based", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1438-L1502
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.toArray
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['RemoteHistoryContao'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['RemoteHistoryContao'][$this->getPrimaryKey()] = true; $keys = RemoteHistoryContaoPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getRemoteAppId(), $keys[2] => $this->getApiversion(), $keys[3] => $this->getName(), $keys[4] => $this->getVersion(), $keys[5] => $this->getConfigDisplayerrors(), $keys[6] => $this->getConfigBypasscache(), $keys[7] => $this->getConfigMinifymarkup(), $keys[8] => $this->getConfigDebugmode(), $keys[9] => $this->getConfigMaintenancemode(), $keys[10] => $this->getConfigGzipscripts(), $keys[11] => $this->getConfigRewriteurl(), $keys[12] => $this->getConfigAdminemail(), $keys[13] => $this->getConfigCachemode(), $keys[14] => $this->getStatuscode(), $keys[15] => $this->getExtensions(), $keys[16] => $this->getLog(), $keys[17] => $this->getPHP(), $keys[18] => $this->getMySQL(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aRemoteApp) { $result['RemoteApp'] = $this->aRemoteApp->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } return $result; }
php
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['RemoteHistoryContao'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['RemoteHistoryContao'][$this->getPrimaryKey()] = true; $keys = RemoteHistoryContaoPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getRemoteAppId(), $keys[2] => $this->getApiversion(), $keys[3] => $this->getName(), $keys[4] => $this->getVersion(), $keys[5] => $this->getConfigDisplayerrors(), $keys[6] => $this->getConfigBypasscache(), $keys[7] => $this->getConfigMinifymarkup(), $keys[8] => $this->getConfigDebugmode(), $keys[9] => $this->getConfigMaintenancemode(), $keys[10] => $this->getConfigGzipscripts(), $keys[11] => $this->getConfigRewriteurl(), $keys[12] => $this->getConfigAdminemail(), $keys[13] => $this->getConfigCachemode(), $keys[14] => $this->getStatuscode(), $keys[15] => $this->getExtensions(), $keys[16] => $this->getLog(), $keys[17] => $this->getPHP(), $keys[18] => $this->getMySQL(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aRemoteApp) { $result['RemoteApp'] = $this->aRemoteApp->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } return $result; }
[ "public", "function", "toArray", "(", "$", "keyType", "=", "BasePeer", "::", "TYPE_PHPNAME", ",", "$", "includeLazyLoadColumns", "=", "true", ",", "$", "alreadyDumpedObjects", "=", "array", "(", ")", ",", "$", "includeForeignObjects", "=", "false", ")", "{", "if", "(", "isset", "(", "$", "alreadyDumpedObjects", "[", "'RemoteHistoryContao'", "]", "[", "$", "this", "->", "getPrimaryKey", "(", ")", "]", ")", ")", "{", "return", "'*RECURSION*'", ";", "}", "$", "alreadyDumpedObjects", "[", "'RemoteHistoryContao'", "]", "[", "$", "this", "->", "getPrimaryKey", "(", ")", "]", "=", "true", ";", "$", "keys", "=", "RemoteHistoryContaoPeer", "::", "getFieldNames", "(", "$", "keyType", ")", ";", "$", "result", "=", "array", "(", "$", "keys", "[", "0", "]", "=>", "$", "this", "->", "getId", "(", ")", ",", "$", "keys", "[", "1", "]", "=>", "$", "this", "->", "getRemoteAppId", "(", ")", ",", "$", "keys", "[", "2", "]", "=>", "$", "this", "->", "getApiversion", "(", ")", ",", "$", "keys", "[", "3", "]", "=>", "$", "this", "->", "getName", "(", ")", ",", "$", "keys", "[", "4", "]", "=>", "$", "this", "->", "getVersion", "(", ")", ",", "$", "keys", "[", "5", "]", "=>", "$", "this", "->", "getConfigDisplayerrors", "(", ")", ",", "$", "keys", "[", "6", "]", "=>", "$", "this", "->", "getConfigBypasscache", "(", ")", ",", "$", "keys", "[", "7", "]", "=>", "$", "this", "->", "getConfigMinifymarkup", "(", ")", ",", "$", "keys", "[", "8", "]", "=>", "$", "this", "->", "getConfigDebugmode", "(", ")", ",", "$", "keys", "[", "9", "]", "=>", "$", "this", "->", "getConfigMaintenancemode", "(", ")", ",", "$", "keys", "[", "10", "]", "=>", "$", "this", "->", "getConfigGzipscripts", "(", ")", ",", "$", "keys", "[", "11", "]", "=>", "$", "this", "->", "getConfigRewriteurl", "(", ")", ",", "$", "keys", "[", "12", "]", "=>", "$", "this", "->", "getConfigAdminemail", "(", ")", ",", "$", "keys", "[", "13", "]", "=>", "$", "this", "->", "getConfigCachemode", "(", ")", ",", "$", "keys", "[", "14", "]", "=>", "$", "this", "->", "getStatuscode", "(", ")", ",", "$", "keys", "[", "15", "]", "=>", "$", "this", "->", "getExtensions", "(", ")", ",", "$", "keys", "[", "16", "]", "=>", "$", "this", "->", "getLog", "(", ")", ",", "$", "keys", "[", "17", "]", "=>", "$", "this", "->", "getPHP", "(", ")", ",", "$", "keys", "[", "18", "]", "=>", "$", "this", "->", "getMySQL", "(", ")", ",", ")", ";", "$", "virtualColumns", "=", "$", "this", "->", "virtualColumns", ";", "foreach", "(", "$", "virtualColumns", "as", "$", "key", "=>", "$", "virtualColumn", ")", "{", "$", "result", "[", "$", "key", "]", "=", "$", "virtualColumn", ";", "}", "if", "(", "$", "includeForeignObjects", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "aRemoteApp", ")", "{", "$", "result", "[", "'RemoteApp'", "]", "=", "$", "this", "->", "aRemoteApp", "->", "toArray", "(", "$", "keyType", ",", "$", "includeLazyLoadColumns", ",", "$", "alreadyDumpedObjects", ",", "true", ")", ";", "}", "}", "return", "$", "result", ";", "}" ]
Exports the object as an array. You can specify the key type of the array by passing one of the class type constants. @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. @param array $alreadyDumpedObjects List of objects to skip to avoid recursion @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. @return array an associative array containing the field names (as keys) and field values
[ "Exports", "the", "object", "as", "an", "array", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1519-L1559
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.setByPosition
public function setByPosition($pos, $value) { switch ($pos) { case 0: $this->setId($value); break; case 1: $this->setRemoteAppId($value); break; case 2: $this->setApiversion($value); break; case 3: $this->setName($value); break; case 4: $this->setVersion($value); break; case 5: $this->setConfigDisplayerrors($value); break; case 6: $this->setConfigBypasscache($value); break; case 7: $this->setConfigMinifymarkup($value); break; case 8: $this->setConfigDebugmode($value); break; case 9: $this->setConfigMaintenancemode($value); break; case 10: $this->setConfigGzipscripts($value); break; case 11: $this->setConfigRewriteurl($value); break; case 12: $this->setConfigAdminemail($value); break; case 13: $this->setConfigCachemode($value); break; case 14: $this->setStatuscode($value); break; case 15: $this->setExtensions($value); break; case 16: $this->setLog($value); break; case 17: $this->setPHP($value); break; case 18: $this->setMySQL($value); break; } // switch() }
php
public function setByPosition($pos, $value) { switch ($pos) { case 0: $this->setId($value); break; case 1: $this->setRemoteAppId($value); break; case 2: $this->setApiversion($value); break; case 3: $this->setName($value); break; case 4: $this->setVersion($value); break; case 5: $this->setConfigDisplayerrors($value); break; case 6: $this->setConfigBypasscache($value); break; case 7: $this->setConfigMinifymarkup($value); break; case 8: $this->setConfigDebugmode($value); break; case 9: $this->setConfigMaintenancemode($value); break; case 10: $this->setConfigGzipscripts($value); break; case 11: $this->setConfigRewriteurl($value); break; case 12: $this->setConfigAdminemail($value); break; case 13: $this->setConfigCachemode($value); break; case 14: $this->setStatuscode($value); break; case 15: $this->setExtensions($value); break; case 16: $this->setLog($value); break; case 17: $this->setPHP($value); break; case 18: $this->setMySQL($value); break; } // switch() }
[ "public", "function", "setByPosition", "(", "$", "pos", ",", "$", "value", ")", "{", "switch", "(", "$", "pos", ")", "{", "case", "0", ":", "$", "this", "->", "setId", "(", "$", "value", ")", ";", "break", ";", "case", "1", ":", "$", "this", "->", "setRemoteAppId", "(", "$", "value", ")", ";", "break", ";", "case", "2", ":", "$", "this", "->", "setApiversion", "(", "$", "value", ")", ";", "break", ";", "case", "3", ":", "$", "this", "->", "setName", "(", "$", "value", ")", ";", "break", ";", "case", "4", ":", "$", "this", "->", "setVersion", "(", "$", "value", ")", ";", "break", ";", "case", "5", ":", "$", "this", "->", "setConfigDisplayerrors", "(", "$", "value", ")", ";", "break", ";", "case", "6", ":", "$", "this", "->", "setConfigBypasscache", "(", "$", "value", ")", ";", "break", ";", "case", "7", ":", "$", "this", "->", "setConfigMinifymarkup", "(", "$", "value", ")", ";", "break", ";", "case", "8", ":", "$", "this", "->", "setConfigDebugmode", "(", "$", "value", ")", ";", "break", ";", "case", "9", ":", "$", "this", "->", "setConfigMaintenancemode", "(", "$", "value", ")", ";", "break", ";", "case", "10", ":", "$", "this", "->", "setConfigGzipscripts", "(", "$", "value", ")", ";", "break", ";", "case", "11", ":", "$", "this", "->", "setConfigRewriteurl", "(", "$", "value", ")", ";", "break", ";", "case", "12", ":", "$", "this", "->", "setConfigAdminemail", "(", "$", "value", ")", ";", "break", ";", "case", "13", ":", "$", "this", "->", "setConfigCachemode", "(", "$", "value", ")", ";", "break", ";", "case", "14", ":", "$", "this", "->", "setStatuscode", "(", "$", "value", ")", ";", "break", ";", "case", "15", ":", "$", "this", "->", "setExtensions", "(", "$", "value", ")", ";", "break", ";", "case", "16", ":", "$", "this", "->", "setLog", "(", "$", "value", ")", ";", "break", ";", "case", "17", ":", "$", "this", "->", "setPHP", "(", "$", "value", ")", ";", "break", ";", "case", "18", ":", "$", "this", "->", "setMySQL", "(", "$", "value", ")", ";", "break", ";", "}", "// switch()", "}" ]
Sets a field from the object by Position as specified in the xml schema. Zero-based. @param int $pos position in xml schema @param mixed $value field value @return void
[ "Sets", "a", "field", "from", "the", "object", "by", "Position", "as", "specified", "in", "the", "xml", "schema", ".", "Zero", "-", "based", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1587-L1648
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.fromArray
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RemoteHistoryContaoPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setRemoteAppId($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setApiversion($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setName($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setVersion($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setConfigDisplayerrors($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setConfigBypasscache($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setConfigMinifymarkup($arr[$keys[7]]); if (array_key_exists($keys[8], $arr)) $this->setConfigDebugmode($arr[$keys[8]]); if (array_key_exists($keys[9], $arr)) $this->setConfigMaintenancemode($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setConfigGzipscripts($arr[$keys[10]]); if (array_key_exists($keys[11], $arr)) $this->setConfigRewriteurl($arr[$keys[11]]); if (array_key_exists($keys[12], $arr)) $this->setConfigAdminemail($arr[$keys[12]]); if (array_key_exists($keys[13], $arr)) $this->setConfigCachemode($arr[$keys[13]]); if (array_key_exists($keys[14], $arr)) $this->setStatuscode($arr[$keys[14]]); if (array_key_exists($keys[15], $arr)) $this->setExtensions($arr[$keys[15]]); if (array_key_exists($keys[16], $arr)) $this->setLog($arr[$keys[16]]); if (array_key_exists($keys[17], $arr)) $this->setPHP($arr[$keys[17]]); if (array_key_exists($keys[18], $arr)) $this->setMySQL($arr[$keys[18]]); }
php
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RemoteHistoryContaoPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setRemoteAppId($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setApiversion($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setName($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setVersion($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setConfigDisplayerrors($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setConfigBypasscache($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setConfigMinifymarkup($arr[$keys[7]]); if (array_key_exists($keys[8], $arr)) $this->setConfigDebugmode($arr[$keys[8]]); if (array_key_exists($keys[9], $arr)) $this->setConfigMaintenancemode($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setConfigGzipscripts($arr[$keys[10]]); if (array_key_exists($keys[11], $arr)) $this->setConfigRewriteurl($arr[$keys[11]]); if (array_key_exists($keys[12], $arr)) $this->setConfigAdminemail($arr[$keys[12]]); if (array_key_exists($keys[13], $arr)) $this->setConfigCachemode($arr[$keys[13]]); if (array_key_exists($keys[14], $arr)) $this->setStatuscode($arr[$keys[14]]); if (array_key_exists($keys[15], $arr)) $this->setExtensions($arr[$keys[15]]); if (array_key_exists($keys[16], $arr)) $this->setLog($arr[$keys[16]]); if (array_key_exists($keys[17], $arr)) $this->setPHP($arr[$keys[17]]); if (array_key_exists($keys[18], $arr)) $this->setMySQL($arr[$keys[18]]); }
[ "public", "function", "fromArray", "(", "$", "arr", ",", "$", "keyType", "=", "BasePeer", "::", "TYPE_PHPNAME", ")", "{", "$", "keys", "=", "RemoteHistoryContaoPeer", "::", "getFieldNames", "(", "$", "keyType", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "0", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setId", "(", "$", "arr", "[", "$", "keys", "[", "0", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "1", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setRemoteAppId", "(", "$", "arr", "[", "$", "keys", "[", "1", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "2", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiversion", "(", "$", "arr", "[", "$", "keys", "[", "2", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "3", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setName", "(", "$", "arr", "[", "$", "keys", "[", "3", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "4", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setVersion", "(", "$", "arr", "[", "$", "keys", "[", "4", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "5", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setConfigDisplayerrors", "(", "$", "arr", "[", "$", "keys", "[", "5", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "6", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setConfigBypasscache", "(", "$", "arr", "[", "$", "keys", "[", "6", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "7", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setConfigMinifymarkup", "(", "$", "arr", "[", "$", "keys", "[", "7", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "8", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setConfigDebugmode", "(", "$", "arr", "[", "$", "keys", "[", "8", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "9", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setConfigMaintenancemode", "(", "$", "arr", "[", "$", "keys", "[", "9", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "10", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setConfigGzipscripts", "(", "$", "arr", "[", "$", "keys", "[", "10", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "11", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setConfigRewriteurl", "(", "$", "arr", "[", "$", "keys", "[", "11", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "12", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setConfigAdminemail", "(", "$", "arr", "[", "$", "keys", "[", "12", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "13", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setConfigCachemode", "(", "$", "arr", "[", "$", "keys", "[", "13", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "14", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setStatuscode", "(", "$", "arr", "[", "$", "keys", "[", "14", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "15", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setExtensions", "(", "$", "arr", "[", "$", "keys", "[", "15", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "16", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setLog", "(", "$", "arr", "[", "$", "keys", "[", "16", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "17", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setPHP", "(", "$", "arr", "[", "$", "keys", "[", "17", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "18", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setMySQL", "(", "$", "arr", "[", "$", "keys", "[", "18", "]", "]", ")", ";", "}" ]
Populates the object using an array. This is particularly useful when populating an object from one of the request arrays (e.g. $_POST). This method goes through the column names, checking to see whether a matching key exists in populated array. If so the setByName() method is called for that column. You can specify the key type of the array by additionally passing one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. The default key type is the column's BasePeer::TYPE_PHPNAME @param array $arr An array to populate the object from. @param string $keyType The type of keys the array uses. @return void
[ "Populates", "the", "object", "using", "an", "array", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1667-L1690
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.buildCriteria
public function buildCriteria() { $criteria = new Criteria(RemoteHistoryContaoPeer::DATABASE_NAME); if ($this->isColumnModified(RemoteHistoryContaoPeer::ID)) $criteria->add(RemoteHistoryContaoPeer::ID, $this->id); if ($this->isColumnModified(RemoteHistoryContaoPeer::REMOTE_APP_ID)) $criteria->add(RemoteHistoryContaoPeer::REMOTE_APP_ID, $this->remote_app_id); if ($this->isColumnModified(RemoteHistoryContaoPeer::APIVERSION)) $criteria->add(RemoteHistoryContaoPeer::APIVERSION, $this->apiversion); if ($this->isColumnModified(RemoteHistoryContaoPeer::NAME)) $criteria->add(RemoteHistoryContaoPeer::NAME, $this->name); if ($this->isColumnModified(RemoteHistoryContaoPeer::VERSION)) $criteria->add(RemoteHistoryContaoPeer::VERSION, $this->version); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS, $this->config_displayerrors); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE, $this->config_bypasscache); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP, $this->config_minifymarkup); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_DEBUGMODE)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_DEBUGMODE, $this->config_debugmode); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE, $this->config_maintenancemode); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS, $this->config_gzipscripts); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_REWRITEURL)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_REWRITEURL, $this->config_rewriteurl); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL, $this->config_adminemail); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_CACHEMODE)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_CACHEMODE, $this->config_cachemode); if ($this->isColumnModified(RemoteHistoryContaoPeer::STATUSCODE)) $criteria->add(RemoteHistoryContaoPeer::STATUSCODE, $this->statuscode); if ($this->isColumnModified(RemoteHistoryContaoPeer::EXTENSIONS)) $criteria->add(RemoteHistoryContaoPeer::EXTENSIONS, $this->extensions); if ($this->isColumnModified(RemoteHistoryContaoPeer::LOG)) $criteria->add(RemoteHistoryContaoPeer::LOG, $this->log); if ($this->isColumnModified(RemoteHistoryContaoPeer::PHP)) $criteria->add(RemoteHistoryContaoPeer::PHP, $this->php); if ($this->isColumnModified(RemoteHistoryContaoPeer::MYSQL)) $criteria->add(RemoteHistoryContaoPeer::MYSQL, $this->mysql); return $criteria; }
php
public function buildCriteria() { $criteria = new Criteria(RemoteHistoryContaoPeer::DATABASE_NAME); if ($this->isColumnModified(RemoteHistoryContaoPeer::ID)) $criteria->add(RemoteHistoryContaoPeer::ID, $this->id); if ($this->isColumnModified(RemoteHistoryContaoPeer::REMOTE_APP_ID)) $criteria->add(RemoteHistoryContaoPeer::REMOTE_APP_ID, $this->remote_app_id); if ($this->isColumnModified(RemoteHistoryContaoPeer::APIVERSION)) $criteria->add(RemoteHistoryContaoPeer::APIVERSION, $this->apiversion); if ($this->isColumnModified(RemoteHistoryContaoPeer::NAME)) $criteria->add(RemoteHistoryContaoPeer::NAME, $this->name); if ($this->isColumnModified(RemoteHistoryContaoPeer::VERSION)) $criteria->add(RemoteHistoryContaoPeer::VERSION, $this->version); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS, $this->config_displayerrors); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE, $this->config_bypasscache); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP, $this->config_minifymarkup); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_DEBUGMODE)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_DEBUGMODE, $this->config_debugmode); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE, $this->config_maintenancemode); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS, $this->config_gzipscripts); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_REWRITEURL)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_REWRITEURL, $this->config_rewriteurl); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL, $this->config_adminemail); if ($this->isColumnModified(RemoteHistoryContaoPeer::CONFIG_CACHEMODE)) $criteria->add(RemoteHistoryContaoPeer::CONFIG_CACHEMODE, $this->config_cachemode); if ($this->isColumnModified(RemoteHistoryContaoPeer::STATUSCODE)) $criteria->add(RemoteHistoryContaoPeer::STATUSCODE, $this->statuscode); if ($this->isColumnModified(RemoteHistoryContaoPeer::EXTENSIONS)) $criteria->add(RemoteHistoryContaoPeer::EXTENSIONS, $this->extensions); if ($this->isColumnModified(RemoteHistoryContaoPeer::LOG)) $criteria->add(RemoteHistoryContaoPeer::LOG, $this->log); if ($this->isColumnModified(RemoteHistoryContaoPeer::PHP)) $criteria->add(RemoteHistoryContaoPeer::PHP, $this->php); if ($this->isColumnModified(RemoteHistoryContaoPeer::MYSQL)) $criteria->add(RemoteHistoryContaoPeer::MYSQL, $this->mysql); return $criteria; }
[ "public", "function", "buildCriteria", "(", ")", "{", "$", "criteria", "=", "new", "Criteria", "(", "RemoteHistoryContaoPeer", "::", "DATABASE_NAME", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "ID", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "ID", ",", "$", "this", "->", "id", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "REMOTE_APP_ID", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "REMOTE_APP_ID", ",", "$", "this", "->", "remote_app_id", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "APIVERSION", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "APIVERSION", ",", "$", "this", "->", "apiversion", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "NAME", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "NAME", ",", "$", "this", "->", "name", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "VERSION", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "VERSION", ",", "$", "this", "->", "version", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_DISPLAYERRORS", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_DISPLAYERRORS", ",", "$", "this", "->", "config_displayerrors", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_BYPASSCACHE", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_BYPASSCACHE", ",", "$", "this", "->", "config_bypasscache", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_MINIFYMARKUP", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_MINIFYMARKUP", ",", "$", "this", "->", "config_minifymarkup", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_DEBUGMODE", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_DEBUGMODE", ",", "$", "this", "->", "config_debugmode", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_MAINTENANCEMODE", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_MAINTENANCEMODE", ",", "$", "this", "->", "config_maintenancemode", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_GZIPSCRIPTS", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_GZIPSCRIPTS", ",", "$", "this", "->", "config_gzipscripts", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_REWRITEURL", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_REWRITEURL", ",", "$", "this", "->", "config_rewriteurl", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_ADMINEMAIL", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_ADMINEMAIL", ",", "$", "this", "->", "config_adminemail", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_CACHEMODE", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_CACHEMODE", ",", "$", "this", "->", "config_cachemode", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "STATUSCODE", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "STATUSCODE", ",", "$", "this", "->", "statuscode", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "EXTENSIONS", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "EXTENSIONS", ",", "$", "this", "->", "extensions", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "LOG", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "LOG", ",", "$", "this", "->", "log", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "PHP", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "PHP", ",", "$", "this", "->", "php", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteHistoryContaoPeer", "::", "MYSQL", ")", ")", "$", "criteria", "->", "add", "(", "RemoteHistoryContaoPeer", "::", "MYSQL", ",", "$", "this", "->", "mysql", ")", ";", "return", "$", "criteria", ";", "}" ]
Build a Criteria object containing the values of all modified columns in this object. @return Criteria The Criteria object containing all modified values.
[ "Build", "a", "Criteria", "object", "containing", "the", "values", "of", "all", "modified", "columns", "in", "this", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1697-L1722
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.copyInto
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setRemoteAppId($this->getRemoteAppId()); $copyObj->setApiversion($this->getApiversion()); $copyObj->setName($this->getName()); $copyObj->setVersion($this->getVersion()); $copyObj->setConfigDisplayerrors($this->getConfigDisplayerrors()); $copyObj->setConfigBypasscache($this->getConfigBypasscache()); $copyObj->setConfigMinifymarkup($this->getConfigMinifymarkup()); $copyObj->setConfigDebugmode($this->getConfigDebugmode()); $copyObj->setConfigMaintenancemode($this->getConfigMaintenancemode()); $copyObj->setConfigGzipscripts($this->getConfigGzipscripts()); $copyObj->setConfigRewriteurl($this->getConfigRewriteurl()); $copyObj->setConfigAdminemail($this->getConfigAdminemail()); $copyObj->setConfigCachemode($this->getConfigCachemode()); $copyObj->setStatuscode($this->getStatuscode()); $copyObj->setExtensions($this->getExtensions()); $copyObj->setLog($this->getLog()); $copyObj->setPHP($this->getPHP()); $copyObj->setMySQL($this->getMySQL()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); // store object hash to prevent cycle $this->startCopy = true; //unflag object copy $this->startCopy = false; } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
php
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setRemoteAppId($this->getRemoteAppId()); $copyObj->setApiversion($this->getApiversion()); $copyObj->setName($this->getName()); $copyObj->setVersion($this->getVersion()); $copyObj->setConfigDisplayerrors($this->getConfigDisplayerrors()); $copyObj->setConfigBypasscache($this->getConfigBypasscache()); $copyObj->setConfigMinifymarkup($this->getConfigMinifymarkup()); $copyObj->setConfigDebugmode($this->getConfigDebugmode()); $copyObj->setConfigMaintenancemode($this->getConfigMaintenancemode()); $copyObj->setConfigGzipscripts($this->getConfigGzipscripts()); $copyObj->setConfigRewriteurl($this->getConfigRewriteurl()); $copyObj->setConfigAdminemail($this->getConfigAdminemail()); $copyObj->setConfigCachemode($this->getConfigCachemode()); $copyObj->setStatuscode($this->getStatuscode()); $copyObj->setExtensions($this->getExtensions()); $copyObj->setLog($this->getLog()); $copyObj->setPHP($this->getPHP()); $copyObj->setMySQL($this->getMySQL()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); // store object hash to prevent cycle $this->startCopy = true; //unflag object copy $this->startCopy = false; } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
[ "public", "function", "copyInto", "(", "$", "copyObj", ",", "$", "deepCopy", "=", "false", ",", "$", "makeNew", "=", "true", ")", "{", "$", "copyObj", "->", "setRemoteAppId", "(", "$", "this", "->", "getRemoteAppId", "(", ")", ")", ";", "$", "copyObj", "->", "setApiversion", "(", "$", "this", "->", "getApiversion", "(", ")", ")", ";", "$", "copyObj", "->", "setName", "(", "$", "this", "->", "getName", "(", ")", ")", ";", "$", "copyObj", "->", "setVersion", "(", "$", "this", "->", "getVersion", "(", ")", ")", ";", "$", "copyObj", "->", "setConfigDisplayerrors", "(", "$", "this", "->", "getConfigDisplayerrors", "(", ")", ")", ";", "$", "copyObj", "->", "setConfigBypasscache", "(", "$", "this", "->", "getConfigBypasscache", "(", ")", ")", ";", "$", "copyObj", "->", "setConfigMinifymarkup", "(", "$", "this", "->", "getConfigMinifymarkup", "(", ")", ")", ";", "$", "copyObj", "->", "setConfigDebugmode", "(", "$", "this", "->", "getConfigDebugmode", "(", ")", ")", ";", "$", "copyObj", "->", "setConfigMaintenancemode", "(", "$", "this", "->", "getConfigMaintenancemode", "(", ")", ")", ";", "$", "copyObj", "->", "setConfigGzipscripts", "(", "$", "this", "->", "getConfigGzipscripts", "(", ")", ")", ";", "$", "copyObj", "->", "setConfigRewriteurl", "(", "$", "this", "->", "getConfigRewriteurl", "(", ")", ")", ";", "$", "copyObj", "->", "setConfigAdminemail", "(", "$", "this", "->", "getConfigAdminemail", "(", ")", ")", ";", "$", "copyObj", "->", "setConfigCachemode", "(", "$", "this", "->", "getConfigCachemode", "(", ")", ")", ";", "$", "copyObj", "->", "setStatuscode", "(", "$", "this", "->", "getStatuscode", "(", ")", ")", ";", "$", "copyObj", "->", "setExtensions", "(", "$", "this", "->", "getExtensions", "(", ")", ")", ";", "$", "copyObj", "->", "setLog", "(", "$", "this", "->", "getLog", "(", ")", ")", ";", "$", "copyObj", "->", "setPHP", "(", "$", "this", "->", "getPHP", "(", ")", ")", ";", "$", "copyObj", "->", "setMySQL", "(", "$", "this", "->", "getMySQL", "(", ")", ")", ";", "if", "(", "$", "deepCopy", "&&", "!", "$", "this", "->", "startCopy", ")", "{", "// important: temporarily setNew(false) because this affects the behavior of", "// the getter/setter methods for fkey referrer objects.", "$", "copyObj", "->", "setNew", "(", "false", ")", ";", "// store object hash to prevent cycle", "$", "this", "->", "startCopy", "=", "true", ";", "//unflag object copy", "$", "this", "->", "startCopy", "=", "false", ";", "}", "// if ($deepCopy)", "if", "(", "$", "makeNew", ")", "{", "$", "copyObj", "->", "setNew", "(", "true", ")", ";", "$", "copyObj", "->", "setId", "(", "NULL", ")", ";", "// this is a auto-increment column, so set to default value", "}", "}" ]
Sets contents of passed object to values from current object. If desired, this method can also make copies of all associated (fkey referrers) objects. @param object $copyObj An object of RemoteHistoryContao (or compatible) type. @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. @throws PropelException
[ "Sets", "contents", "of", "passed", "object", "to", "values", "from", "current", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1781-L1817
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.clear
public function clear() { $this->id = null; $this->remote_app_id = null; $this->apiversion = null; $this->name = null; $this->version = null; $this->config_displayerrors = null; $this->config_bypasscache = null; $this->config_minifymarkup = null; $this->config_debugmode = null; $this->config_maintenancemode = null; $this->config_gzipscripts = null; $this->config_rewriteurl = null; $this->config_adminemail = null; $this->config_cachemode = null; $this->statuscode = null; $this->extensions = null; $this->extensions_unserialized = null; $this->log = null; $this->log_unserialized = null; $this->php = null; $this->php_unserialized = null; $this->mysql = null; $this->mysql_unserialized = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; $this->clearAllReferences(); $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
php
public function clear() { $this->id = null; $this->remote_app_id = null; $this->apiversion = null; $this->name = null; $this->version = null; $this->config_displayerrors = null; $this->config_bypasscache = null; $this->config_minifymarkup = null; $this->config_debugmode = null; $this->config_maintenancemode = null; $this->config_gzipscripts = null; $this->config_rewriteurl = null; $this->config_adminemail = null; $this->config_cachemode = null; $this->statuscode = null; $this->extensions = null; $this->extensions_unserialized = null; $this->log = null; $this->log_unserialized = null; $this->php = null; $this->php_unserialized = null; $this->mysql = null; $this->mysql_unserialized = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; $this->clearAllReferences(); $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
[ "public", "function", "clear", "(", ")", "{", "$", "this", "->", "id", "=", "null", ";", "$", "this", "->", "remote_app_id", "=", "null", ";", "$", "this", "->", "apiversion", "=", "null", ";", "$", "this", "->", "name", "=", "null", ";", "$", "this", "->", "version", "=", "null", ";", "$", "this", "->", "config_displayerrors", "=", "null", ";", "$", "this", "->", "config_bypasscache", "=", "null", ";", "$", "this", "->", "config_minifymarkup", "=", "null", ";", "$", "this", "->", "config_debugmode", "=", "null", ";", "$", "this", "->", "config_maintenancemode", "=", "null", ";", "$", "this", "->", "config_gzipscripts", "=", "null", ";", "$", "this", "->", "config_rewriteurl", "=", "null", ";", "$", "this", "->", "config_adminemail", "=", "null", ";", "$", "this", "->", "config_cachemode", "=", "null", ";", "$", "this", "->", "statuscode", "=", "null", ";", "$", "this", "->", "extensions", "=", "null", ";", "$", "this", "->", "extensions_unserialized", "=", "null", ";", "$", "this", "->", "log", "=", "null", ";", "$", "this", "->", "log_unserialized", "=", "null", ";", "$", "this", "->", "php", "=", "null", ";", "$", "this", "->", "php_unserialized", "=", "null", ";", "$", "this", "->", "mysql", "=", "null", ";", "$", "this", "->", "mysql_unserialized", "=", "null", ";", "$", "this", "->", "alreadyInSave", "=", "false", ";", "$", "this", "->", "alreadyInValidation", "=", "false", ";", "$", "this", "->", "alreadyInClearAllReferencesDeep", "=", "false", ";", "$", "this", "->", "clearAllReferences", "(", ")", ";", "$", "this", "->", "applyDefaultValues", "(", ")", ";", "$", "this", "->", "resetModified", "(", ")", ";", "$", "this", "->", "setNew", "(", "true", ")", ";", "$", "this", "->", "setDeleted", "(", "false", ")", ";", "}" ]
Clears the current object and sets all attributes to their default values
[ "Clears", "the", "current", "object", "and", "sets", "all", "attributes", "to", "their", "default", "values" ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1914-L1947
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php
BaseRemoteHistoryContao.clearAllReferences
public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->aRemoteApp instanceof Persistent) { $this->aRemoteApp->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) $this->aRemoteApp = null; }
php
public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->aRemoteApp instanceof Persistent) { $this->aRemoteApp->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) $this->aRemoteApp = null; }
[ "public", "function", "clearAllReferences", "(", "$", "deep", "=", "false", ")", "{", "if", "(", "$", "deep", "&&", "!", "$", "this", "->", "alreadyInClearAllReferencesDeep", ")", "{", "$", "this", "->", "alreadyInClearAllReferencesDeep", "=", "true", ";", "if", "(", "$", "this", "->", "aRemoteApp", "instanceof", "Persistent", ")", "{", "$", "this", "->", "aRemoteApp", "->", "clearAllReferences", "(", "$", "deep", ")", ";", "}", "$", "this", "->", "alreadyInClearAllReferencesDeep", "=", "false", ";", "}", "// if ($deep)", "$", "this", "->", "aRemoteApp", "=", "null", ";", "}" ]
Resets all references to other model objects or collections of model objects. This method is a user-space workaround for PHP's inability to garbage collect objects with circular references (even in PHP 5.3). This is currently necessary when using Propel in certain daemon or large-volume/high-memory operations. @param boolean $deep Whether to also clear the references on all referrer objects.
[ "Resets", "all", "references", "to", "other", "model", "objects", "or", "collections", "of", "model", "objects", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContao.php#L1958-L1970
ClanCats/Core
src/classes/CCStr.php
CCStr.charset
public static function charset( $charset = null ) { switch( $charset ) { case 'pass': case 'secure': case 'password': return static::SECURE; break; case 'key': return static::KEY; break; case 'alphanum': return static::ALPHA_NUM; break; case 'alpha': return static::ALPHA; break; case 'alpha_low': case 'lowercase': return static::ALPHA_LOW; break; case 'alpha_up': case 'uppercase': return static::ALPHA_UP; break; case 'numeric': case 'num': return static::NUM; break; case 'hex': return static::HEX; break; case 'bin': return static::BIN; break; default: if ( !is_null( $charset ) ) { return $charset; } return static::charset( 'alphanum' ); break; } }
php
public static function charset( $charset = null ) { switch( $charset ) { case 'pass': case 'secure': case 'password': return static::SECURE; break; case 'key': return static::KEY; break; case 'alphanum': return static::ALPHA_NUM; break; case 'alpha': return static::ALPHA; break; case 'alpha_low': case 'lowercase': return static::ALPHA_LOW; break; case 'alpha_up': case 'uppercase': return static::ALPHA_UP; break; case 'numeric': case 'num': return static::NUM; break; case 'hex': return static::HEX; break; case 'bin': return static::BIN; break; default: if ( !is_null( $charset ) ) { return $charset; } return static::charset( 'alphanum' ); break; } }
[ "public", "static", "function", "charset", "(", "$", "charset", "=", "null", ")", "{", "switch", "(", "$", "charset", ")", "{", "case", "'pass'", ":", "case", "'secure'", ":", "case", "'password'", ":", "return", "static", "::", "SECURE", ";", "break", ";", "case", "'key'", ":", "return", "static", "::", "KEY", ";", "break", ";", "case", "'alphanum'", ":", "return", "static", "::", "ALPHA_NUM", ";", "break", ";", "case", "'alpha'", ":", "return", "static", "::", "ALPHA", ";", "break", ";", "case", "'alpha_low'", ":", "case", "'lowercase'", ":", "return", "static", "::", "ALPHA_LOW", ";", "break", ";", "case", "'alpha_up'", ":", "case", "'uppercase'", ":", "return", "static", "::", "ALPHA_UP", ";", "break", ";", "case", "'numeric'", ":", "case", "'num'", ":", "return", "static", "::", "NUM", ";", "break", ";", "case", "'hex'", ":", "return", "static", "::", "HEX", ";", "break", ";", "case", "'bin'", ":", "return", "static", "::", "BIN", ";", "break", ";", "default", ":", "if", "(", "!", "is_null", "(", "$", "charset", ")", ")", "{", "return", "$", "charset", ";", "}", "return", "static", "::", "charset", "(", "'alphanum'", ")", ";", "break", ";", "}", "}" ]
Get a charset, a string containing a set of characters. There are some predefined charsets like: pass secure password key alphanum alpha alpha_low lowercase alpha_up uppercase numeric num hex bin Everything else gets returned as its own charset. @param string $charset use predefined charset or your own @return string
[ "Get", "a", "charset", "a", "string", "containing", "a", "set", "of", "characters", "." ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L51-L104
ClanCats/Core
src/classes/CCStr.php
CCStr.random
public static function random( $length = 25, $charset = null ) { $charset = static::charset( $charset ); $count = strlen( $charset ); $string = ''; while ( $length-- ) { $string .= $charset[mt_rand(0, $count-1)]; } return $string; }
php
public static function random( $length = 25, $charset = null ) { $charset = static::charset( $charset ); $count = strlen( $charset ); $string = ''; while ( $length-- ) { $string .= $charset[mt_rand(0, $count-1)]; } return $string; }
[ "public", "static", "function", "random", "(", "$", "length", "=", "25", ",", "$", "charset", "=", "null", ")", "{", "$", "charset", "=", "static", "::", "charset", "(", "$", "charset", ")", ";", "$", "count", "=", "strlen", "(", "$", "charset", ")", ";", "$", "string", "=", "''", ";", "while", "(", "$", "length", "--", ")", "{", "$", "string", ".=", "$", "charset", "[", "mt_rand", "(", "0", ",", "$", "count", "-", "1", ")", "]", ";", "}", "return", "$", "string", ";", "}" ]
Generate a random string with the given length and charset. CCStr::random( 8, 'hex' ); // 56F6AE10 CCStr::random( 4, 'password' ); // ?F%7 @param int $length Default is 25 @param string $charset This parameter uses the CCStr::charset function @return string
[ "Generate", "a", "random", "string", "with", "the", "given", "length", "and", "charset", "." ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L116-L128
ClanCats/Core
src/classes/CCStr.php
CCStr.capture
public static function capture( $callback, $params = array() ) { if ( is_string( $callback ) ) { return $callback; } if ( !is_closure( $callback ) ) { return ""; } if ( !is_array( $params ) ) { $params = array( $params ); } ob_start(); $return = call_user_func_array( $callback, $params ); $buffer = ob_get_clean(); if ( !is_null( $return ) ) { return $return; } return $buffer; }
php
public static function capture( $callback, $params = array() ) { if ( is_string( $callback ) ) { return $callback; } if ( !is_closure( $callback ) ) { return ""; } if ( !is_array( $params ) ) { $params = array( $params ); } ob_start(); $return = call_user_func_array( $callback, $params ); $buffer = ob_get_clean(); if ( !is_null( $return ) ) { return $return; } return $buffer; }
[ "public", "static", "function", "capture", "(", "$", "callback", ",", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "is_string", "(", "$", "callback", ")", ")", "{", "return", "$", "callback", ";", "}", "if", "(", "!", "is_closure", "(", "$", "callback", ")", ")", "{", "return", "\"\"", ";", "}", "if", "(", "!", "is_array", "(", "$", "params", ")", ")", "{", "$", "params", "=", "array", "(", "$", "params", ")", ";", "}", "ob_start", "(", ")", ";", "$", "return", "=", "call_user_func_array", "(", "$", "callback", ",", "$", "params", ")", ";", "$", "buffer", "=", "ob_get_clean", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "return", ")", ")", "{", "return", "$", "return", ";", "}", "return", "$", "buffer", ";", "}" ]
Try to get a string from a callback reading the output buffer @param mixed $callback @param array $params @return string
[ "Try", "to", "get", "a", "string", "from", "a", "callback", "reading", "the", "output", "buffer" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L137-L164
ClanCats/Core
src/classes/CCStr.php
CCStr.htmlentities
public static function htmlentities( $string, $recursive = false ) { if ( is_array( $string ) ) { foreach( $string as $key => $item ) { if ( $recursive ) { if ( is_array( $item ) ) { $string[$key] = static::htmlentities( $item, $recursive ); } } if ( is_string( $item ) ) { $string[$key] = htmlentities( $item ); } } return $string; } return htmlentities( $string, ENT_QUOTES, ClanCats::$config->charset ); }
php
public static function htmlentities( $string, $recursive = false ) { if ( is_array( $string ) ) { foreach( $string as $key => $item ) { if ( $recursive ) { if ( is_array( $item ) ) { $string[$key] = static::htmlentities( $item, $recursive ); } } if ( is_string( $item ) ) { $string[$key] = htmlentities( $item ); } } return $string; } return htmlentities( $string, ENT_QUOTES, ClanCats::$config->charset ); }
[ "public", "static", "function", "htmlentities", "(", "$", "string", ",", "$", "recursive", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "string", ")", ")", "{", "foreach", "(", "$", "string", "as", "$", "key", "=>", "$", "item", ")", "{", "if", "(", "$", "recursive", ")", "{", "if", "(", "is_array", "(", "$", "item", ")", ")", "{", "$", "string", "[", "$", "key", "]", "=", "static", "::", "htmlentities", "(", "$", "item", ",", "$", "recursive", ")", ";", "}", "}", "if", "(", "is_string", "(", "$", "item", ")", ")", "{", "$", "string", "[", "$", "key", "]", "=", "htmlentities", "(", "$", "item", ")", ";", "}", "}", "return", "$", "string", ";", "}", "return", "htmlentities", "(", "$", "string", ",", "ENT_QUOTES", ",", "ClanCats", "::", "$", "config", "->", "charset", ")", ";", "}" ]
Does the same as the PHP native htmlentities function but you can pass arrays. @param string|array $string @param bool $recursive @return string|array
[ "Does", "the", "same", "as", "the", "PHP", "native", "htmlentities", "function", "but", "you", "can", "pass", "arrays", "." ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L173-L197
ClanCats/Core
src/classes/CCStr.php
CCStr.suffix
public static function suffix( $string, $sep = '-' ) { return substr( $string, strrpos( $string, $sep )+strlen( $sep ) ); }
php
public static function suffix( $string, $sep = '-' ) { return substr( $string, strrpos( $string, $sep )+strlen( $sep ) ); }
[ "public", "static", "function", "suffix", "(", "$", "string", ",", "$", "sep", "=", "'-'", ")", "{", "return", "substr", "(", "$", "string", ",", "strrpos", "(", "$", "string", ",", "$", "sep", ")", "+", "strlen", "(", "$", "sep", ")", ")", ";", "}" ]
Get the last part of a string CCStr::suffix( 'some-strange-file-name-2014' ); // 2014 CCStr::suffix( '/path/to/my/file.xml', '/' ); // file.xml @param string $string @param string $sep The seperator string. @return string
[ "Get", "the", "last", "part", "of", "a", "string" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L209-L212
ClanCats/Core
src/classes/CCStr.php
CCStr.hash
public static function hash( $string ) { if (is_numeric( $algo = ClanCats::$config->get( 'security.hash', 'md5') )) { return password_hash( $string, $algo ); } return call_user_func( $algo, $string ); }
php
public static function hash( $string ) { if (is_numeric( $algo = ClanCats::$config->get( 'security.hash', 'md5') )) { return password_hash( $string, $algo ); } return call_user_func( $algo, $string ); }
[ "public", "static", "function", "hash", "(", "$", "string", ")", "{", "if", "(", "is_numeric", "(", "$", "algo", "=", "ClanCats", "::", "$", "config", "->", "get", "(", "'security.hash'", ",", "'md5'", ")", ")", ")", "{", "return", "password_hash", "(", "$", "string", ",", "$", "algo", ")", ";", "}", "return", "call_user_func", "(", "$", "algo", ",", "$", "string", ")", ";", "}" ]
Hashs a string using the configurable method. ( main.config -> security.hash ) @param string $string @return string
[ "Hashs", "a", "string", "using", "the", "configurable", "method", ".", "(", "main", ".", "config", "-", ">", "security", ".", "hash", ")" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L247-L254
ClanCats/Core
src/classes/CCStr.php
CCStr.verify_hash
public static function verify_hash( $string, $hash ) { if (is_numeric( $algo = ClanCats::$config->get( 'security.hash', 'md5') )) { return password_verify( $string, $hash ); } return ($hash === call_user_func( $algo, $string )); }
php
public static function verify_hash( $string, $hash ) { if (is_numeric( $algo = ClanCats::$config->get( 'security.hash', 'md5') )) { return password_verify( $string, $hash ); } return ($hash === call_user_func( $algo, $string )); }
[ "public", "static", "function", "verify_hash", "(", "$", "string", ",", "$", "hash", ")", "{", "if", "(", "is_numeric", "(", "$", "algo", "=", "ClanCats", "::", "$", "config", "->", "get", "(", "'security.hash'", ",", "'md5'", ")", ")", ")", "{", "return", "password_verify", "(", "$", "string", ",", "$", "hash", ")", ";", "}", "return", "(", "$", "hash", "===", "call_user_func", "(", "$", "algo", ",", "$", "string", ")", ")", ";", "}" ]
Verifies a hash with a plaintext string using the configurable method. ( main.config -> security.hash ) @param string $string @param string $hash @return bool
[ "Verifies", "a", "hash", "with", "a", "plaintext", "string", "using", "the", "configurable", "method", ".", "(", "main", ".", "config", "-", ">", "security", ".", "hash", ")" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L263-L270
ClanCats/Core
src/classes/CCStr.php
CCStr.clean_url
public static function clean_url( $string, $sep = null ) { // basic clean $string = strtolower( static::replace_accents( trim( $string ) ) ); // these characters get replaced with our seperator $string = str_replace( array( ' ', '&', '\r\n', '\n', '+', ',', '.', '_' ) , '-', $string ); $string = preg_replace( array( '/[^a-z0-9\-]/', // remove non alphanumerics '/[\-]+/', // only allow one in a row ), array( '', '-' ), $string ); // custom seperator if ( !is_null( $sep ) ) { $string = str_replace( '-', $sep, $string ); } // trim the result again return trim( $string, '-' ); }
php
public static function clean_url( $string, $sep = null ) { // basic clean $string = strtolower( static::replace_accents( trim( $string ) ) ); // these characters get replaced with our seperator $string = str_replace( array( ' ', '&', '\r\n', '\n', '+', ',', '.', '_' ) , '-', $string ); $string = preg_replace( array( '/[^a-z0-9\-]/', // remove non alphanumerics '/[\-]+/', // only allow one in a row ), array( '', '-' ), $string ); // custom seperator if ( !is_null( $sep ) ) { $string = str_replace( '-', $sep, $string ); } // trim the result again return trim( $string, '-' ); }
[ "public", "static", "function", "clean_url", "(", "$", "string", ",", "$", "sep", "=", "null", ")", "{", "// basic clean", "$", "string", "=", "strtolower", "(", "static", "::", "replace_accents", "(", "trim", "(", "$", "string", ")", ")", ")", ";", "// these characters get replaced with our seperator", "$", "string", "=", "str_replace", "(", "array", "(", "' '", ",", "'&'", ",", "'\\r\\n'", ",", "'\\n'", ",", "'+'", ",", "','", ",", "'.'", ",", "'_'", ")", ",", "'-'", ",", "$", "string", ")", ";", "$", "string", "=", "preg_replace", "(", "array", "(", "'/[^a-z0-9\\-]/'", ",", "// remove non alphanumerics", "'/[\\-]+/'", ",", "// only allow one in a row", ")", ",", "array", "(", "''", ",", "'-'", ")", ",", "$", "string", ")", ";", "// custom seperator", "if", "(", "!", "is_null", "(", "$", "sep", ")", ")", "{", "$", "string", "=", "str_replace", "(", "'-'", ",", "$", "sep", ",", "$", "string", ")", ";", "}", "// trim the result again", "return", "trim", "(", "$", "string", ",", "'-'", ")", ";", "}" ]
Try to form a string to url valid segment. It will remove all special characters replace accents characters remove and replace whitespaces breaks etc.. @param string $string @param string $sep You can define another seperator default is "-" @return string
[ "Try", "to", "form", "a", "string", "to", "url", "valid", "segment", ".", "It", "will", "remove", "all", "special", "characters", "replace", "accents", "characters", "remove", "and", "replace", "whitespaces", "breaks", "etc", ".." ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L299-L319
ClanCats/Core
src/classes/CCStr.php
CCStr.replace
public static function replace( $string, $arr, $count = null ) { return str_replace( array_keys( $arr ), array_values( $arr ), $string, $count ); }
php
public static function replace( $string, $arr, $count = null ) { return str_replace( array_keys( $arr ), array_values( $arr ), $string, $count ); }
[ "public", "static", "function", "replace", "(", "$", "string", ",", "$", "arr", ",", "$", "count", "=", "null", ")", "{", "return", "str_replace", "(", "array_keys", "(", "$", "arr", ")", ",", "array_values", "(", "$", "arr", ")", ",", "$", "string", ",", "$", "count", ")", ";", "}" ]
str_replace using key => value of an array @param string $string @param array $arr @param int $count @return string
[ "str_replace", "using", "key", "=", ">", "value", "of", "an", "array" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L329-L332
ClanCats/Core
src/classes/CCStr.php
CCStr.preg_replace
public static function preg_replace( $arr, $string, $count = null ) { return preg_replace( array_keys( $arr ), array_values( $arr ), $string, $count ); }
php
public static function preg_replace( $arr, $string, $count = null ) { return preg_replace( array_keys( $arr ), array_values( $arr ), $string, $count ); }
[ "public", "static", "function", "preg_replace", "(", "$", "arr", ",", "$", "string", ",", "$", "count", "=", "null", ")", "{", "return", "preg_replace", "(", "array_keys", "(", "$", "arr", ")", ",", "array_values", "(", "$", "arr", ")", ",", "$", "string", ",", "$", "count", ")", ";", "}" ]
preg replace using key => value of an array @param string $string @param array $arr @param int $count @return string
[ "preg", "replace", "using", "key", "=", ">", "value", "of", "an", "array" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L342-L345
ClanCats/Core
src/classes/CCStr.php
CCStr.lower
public static function lower( $string, $encoding = null ) { if ( is_null( $encoding ) ) { $encoding = ClanCats::$config->charset; } return mb_strtolower( $string, $encoding ); }
php
public static function lower( $string, $encoding = null ) { if ( is_null( $encoding ) ) { $encoding = ClanCats::$config->charset; } return mb_strtolower( $string, $encoding ); }
[ "public", "static", "function", "lower", "(", "$", "string", ",", "$", "encoding", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "encoding", ")", ")", "{", "$", "encoding", "=", "ClanCats", "::", "$", "config", "->", "charset", ";", "}", "return", "mb_strtolower", "(", "$", "string", ",", "$", "encoding", ")", ";", "}" ]
Converts an string to lowercase using the system encoding @param string $string @param string $encoding @return string
[ "Converts", "an", "string", "to", "lowercase", "using", "the", "system", "encoding" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L354-L361
ClanCats/Core
src/classes/CCStr.php
CCStr.upper
public static function upper( $string, $encoding = null ) { if ( is_null( $encoding ) ) { $encoding = ClanCats::$config->charset; } return mb_strtoupper( $string, $encoding ); }
php
public static function upper( $string, $encoding = null ) { if ( is_null( $encoding ) ) { $encoding = ClanCats::$config->charset; } return mb_strtoupper( $string, $encoding ); }
[ "public", "static", "function", "upper", "(", "$", "string", ",", "$", "encoding", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "encoding", ")", ")", "{", "$", "encoding", "=", "ClanCats", "::", "$", "config", "->", "charset", ";", "}", "return", "mb_strtoupper", "(", "$", "string", ",", "$", "encoding", ")", ";", "}" ]
Converts an string to uppercase using the system encoding @param string $string @param string $encoding @return string
[ "Converts", "an", "string", "to", "uppercase", "using", "the", "system", "encoding" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L370-L377
ClanCats/Core
src/classes/CCStr.php
CCStr.cut
public static function cut( $string, $key, $cut_key = true, $last = false ) { if ( $last ) { $pos = strrpos( $string, $key ); } else { $pos = strpos( $string, $key ); } if ( $pos === false ) { return $string; } if ( !$cut_key ) { $pos += strlen( $key ); } return substr( $string, 0, $pos ); }
php
public static function cut( $string, $key, $cut_key = true, $last = false ) { if ( $last ) { $pos = strrpos( $string, $key ); } else { $pos = strpos( $string, $key ); } if ( $pos === false ) { return $string; } if ( !$cut_key ) { $pos += strlen( $key ); } return substr( $string, 0, $pos ); }
[ "public", "static", "function", "cut", "(", "$", "string", ",", "$", "key", ",", "$", "cut_key", "=", "true", ",", "$", "last", "=", "false", ")", "{", "if", "(", "$", "last", ")", "{", "$", "pos", "=", "strrpos", "(", "$", "string", ",", "$", "key", ")", ";", "}", "else", "{", "$", "pos", "=", "strpos", "(", "$", "string", ",", "$", "key", ")", ";", "}", "if", "(", "$", "pos", "===", "false", ")", "{", "return", "$", "string", ";", "}", "if", "(", "!", "$", "cut_key", ")", "{", "$", "pos", "+=", "strlen", "(", "$", "key", ")", ";", "}", "return", "substr", "(", "$", "string", ",", "0", ",", "$", "pos", ")", ";", "}" ]
Cuts a string after another string. CCStr::cut( 'some/path/to/user.config.xml', '.' ); // some/path/to/user CCStr::cut( 'some/path/to/user.config.xml', '/', false ); // some/ CCStr::cut( 'some/path/to/user.config.xml', '/', true, true ); // some/path/to @param string $string @param string $key The string that after that should be cutted. @param bool $cut_key Should the key itself also be removed? @param bool $last Cut after the last appearing of the key? @return string
[ "Cuts", "a", "string", "after", "another", "string", "." ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L422-L442
ClanCats/Core
src/classes/CCStr.php
CCStr.bytes
public static function bytes( $size, $round = 2 ) { $unit = array( 'b', 'kb', 'mb', 'gb', 'tb', 'pb' ); return @round( $size / pow( 1024, ( $i = floor( log( $size, 1024 ) ) ) ), $round ).$unit[$i]; }
php
public static function bytes( $size, $round = 2 ) { $unit = array( 'b', 'kb', 'mb', 'gb', 'tb', 'pb' ); return @round( $size / pow( 1024, ( $i = floor( log( $size, 1024 ) ) ) ), $round ).$unit[$i]; }
[ "public", "static", "function", "bytes", "(", "$", "size", ",", "$", "round", "=", "2", ")", "{", "$", "unit", "=", "array", "(", "'b'", ",", "'kb'", ",", "'mb'", ",", "'gb'", ",", "'tb'", ",", "'pb'", ")", ";", "return", "@", "round", "(", "$", "size", "/", "pow", "(", "1024", ",", "(", "$", "i", "=", "floor", "(", "log", "(", "$", "size", ",", "1024", ")", ")", ")", ")", ",", "$", "round", ")", ".", "$", "unit", "[", "$", "i", "]", ";", "}" ]
Convert bytes to a human readable format CCStr::bytes( 39247293 ); // 37.43mb @param int $size @return string
[ "Convert", "bytes", "to", "a", "human", "readable", "format" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L484-L488
Chill-project/Main
Templating/TranslatableStringHelper.php
TranslatableStringHelper.localize
public function localize(array $translatableStrings) { if (NULL === $translatableStrings) { return NULL; } $language = $this->requestStack->getCurrentRequest()->getLocale(); if (isset($translatableStrings[$language])) { return $translatableStrings[$language]; } else { foreach ($this->fallbackLocales as $locale) { if (array_key_exists($locale, $translatableStrings)) { return $translatableStrings[$locale]; } } } return ''; }
php
public function localize(array $translatableStrings) { if (NULL === $translatableStrings) { return NULL; } $language = $this->requestStack->getCurrentRequest()->getLocale(); if (isset($translatableStrings[$language])) { return $translatableStrings[$language]; } else { foreach ($this->fallbackLocales as $locale) { if (array_key_exists($locale, $translatableStrings)) { return $translatableStrings[$locale]; } } } return ''; }
[ "public", "function", "localize", "(", "array", "$", "translatableStrings", ")", "{", "if", "(", "NULL", "===", "$", "translatableStrings", ")", "{", "return", "NULL", ";", "}", "$", "language", "=", "$", "this", "->", "requestStack", "->", "getCurrentRequest", "(", ")", "->", "getLocale", "(", ")", ";", "if", "(", "isset", "(", "$", "translatableStrings", "[", "$", "language", "]", ")", ")", "{", "return", "$", "translatableStrings", "[", "$", "language", "]", ";", "}", "else", "{", "foreach", "(", "$", "this", "->", "fallbackLocales", "as", "$", "locale", ")", "{", "if", "(", "array_key_exists", "(", "$", "locale", ",", "$", "translatableStrings", ")", ")", "{", "return", "$", "translatableStrings", "[", "$", "locale", "]", ";", "}", "}", "}", "return", "''", ";", "}" ]
return the string in current locale if it exists. If it does not exists; return the name in the first language available. Return a blank string if any strings are available. Return NULL if $translatableString is NULL @param array $translatableStrings @return string
[ "return", "the", "string", "in", "current", "locale", "if", "it", "exists", "." ]
train
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Templating/TranslatableStringHelper.php#L60-L84
OwlyCode/StreamingBird
src/Location/Circle.php
Circle.getBoundingBox
public function getBoundingBox() { // Calc bounding boxes $maxLat = round($this->latitude + rad2deg($this->radius / self::EARTH_RADIUS_KM), 2); $minLat = round($this->latitude - rad2deg($this->radius / self::EARTH_RADIUS_KM), 2); // Compensate for degrees longitude getting smaller with increasing latitude $maxLon = round($this->longitude + rad2deg($this->radius / self::EARTH_RADIUS_KM / cos(deg2rad($this->latitude))), 2); $minLon = round($this->longitude - rad2deg($this->radius / self::EARTH_RADIUS_KM / cos(deg2rad($this->latitude))), 2); return [$minLon, $minLat, $maxLon, $maxLat]; }
php
public function getBoundingBox() { // Calc bounding boxes $maxLat = round($this->latitude + rad2deg($this->radius / self::EARTH_RADIUS_KM), 2); $minLat = round($this->latitude - rad2deg($this->radius / self::EARTH_RADIUS_KM), 2); // Compensate for degrees longitude getting smaller with increasing latitude $maxLon = round($this->longitude + rad2deg($this->radius / self::EARTH_RADIUS_KM / cos(deg2rad($this->latitude))), 2); $minLon = round($this->longitude - rad2deg($this->radius / self::EARTH_RADIUS_KM / cos(deg2rad($this->latitude))), 2); return [$minLon, $minLat, $maxLon, $maxLat]; }
[ "public", "function", "getBoundingBox", "(", ")", "{", "// Calc bounding boxes", "$", "maxLat", "=", "round", "(", "$", "this", "->", "latitude", "+", "rad2deg", "(", "$", "this", "->", "radius", "/", "self", "::", "EARTH_RADIUS_KM", ")", ",", "2", ")", ";", "$", "minLat", "=", "round", "(", "$", "this", "->", "latitude", "-", "rad2deg", "(", "$", "this", "->", "radius", "/", "self", "::", "EARTH_RADIUS_KM", ")", ",", "2", ")", ";", "// Compensate for degrees longitude getting smaller with increasing latitude", "$", "maxLon", "=", "round", "(", "$", "this", "->", "longitude", "+", "rad2deg", "(", "$", "this", "->", "radius", "/", "self", "::", "EARTH_RADIUS_KM", "/", "cos", "(", "deg2rad", "(", "$", "this", "->", "latitude", ")", ")", ")", ",", "2", ")", ";", "$", "minLon", "=", "round", "(", "$", "this", "->", "longitude", "-", "rad2deg", "(", "$", "this", "->", "radius", "/", "self", "::", "EARTH_RADIUS_KM", "/", "cos", "(", "deg2rad", "(", "$", "this", "->", "latitude", ")", ")", ")", ",", "2", ")", ";", "return", "[", "$", "minLon", ",", "$", "minLat", ",", "$", "maxLon", ",", "$", "maxLat", "]", ";", "}" ]
{@inheritDoc}
[ "{" ]
train
https://github.com/OwlyCode/StreamingBird/blob/177fc8a9dc8f911865a5abd9ac8d4ef85cef4003/src/Location/Circle.php#L39-L50