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 |
|---|---|---|---|---|---|---|---|---|---|---|
opulencephp/Opulence | src/Opulence/Environments/Environment.php | Environment.setVar | public static function setVar(string $name, $value)
{
// Do not overwrite the variable if it already exists
if (self::getVar($name) === null) {
putenv("$name=$value");
$_ENV[$name] = $value;
$_SERVER[$name] = $value;
}
} | php | public static function setVar(string $name, $value)
{
// Do not overwrite the variable if it already exists
if (self::getVar($name) === null) {
putenv("$name=$value");
$_ENV[$name] = $value;
$_SERVER[$name] = $value;
}
} | [
"public",
"static",
"function",
"setVar",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
"{",
"// Do not overwrite the variable if it already exists",
"if",
"(",
"self",
"::",
"getVar",
"(",
"$",
"name",
")",
"===",
"null",
")",
"{",
"putenv",
"(",
"\"$... | Sets an environment variable, but does not overwrite existing variables
@param string $name The name of the environment variable to set
@param mixed $value The value | [
"Sets",
"an",
"environment",
"variable",
"but",
"does",
"not",
"overwrite",
"existing",
"variables"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Environments/Environment.php#L67-L75 |
opulencephp/Opulence | src/Opulence/Framework/Authentication/Bootstrappers/AuthenticationBootstrapper.php | AuthenticationBootstrapper.getAuthenticator | protected function getAuthenticator(IContainer $container) : IAuthenticator
{
$authenticatorRegistry = new AuthenticatorRegistry();
$authenticator = new Authenticator($authenticatorRegistry);
$container->bindInstance(IAuthenticatorRegistry::class, $authenticatorRegistry);
return $au... | php | protected function getAuthenticator(IContainer $container) : IAuthenticator
{
$authenticatorRegistry = new AuthenticatorRegistry();
$authenticator = new Authenticator($authenticatorRegistry);
$container->bindInstance(IAuthenticatorRegistry::class, $authenticatorRegistry);
return $au... | [
"protected",
"function",
"getAuthenticator",
"(",
"IContainer",
"$",
"container",
")",
":",
"IAuthenticator",
"{",
"$",
"authenticatorRegistry",
"=",
"new",
"AuthenticatorRegistry",
"(",
")",
";",
"$",
"authenticator",
"=",
"new",
"Authenticator",
"(",
"$",
"authe... | Gets the authenticator
@param IContainer $container The IoC container
@return IAuthenticator The authenticator | [
"Gets",
"the",
"authenticator"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Authentication/Bootstrappers/AuthenticationBootstrapper.php#L83-L90 |
opulencephp/Opulence | src/Opulence/Authentication/Tokens/Signatures/Algorithms.php | Algorithms.getAll | public static function getAll() : array
{
return [
self::RSA_SHA256,
self::RSA_SHA384,
self::RSA_SHA512,
self::SHA256,
self::SHA384,
self::SHA512
];
} | php | public static function getAll() : array
{
return [
self::RSA_SHA256,
self::RSA_SHA384,
self::RSA_SHA512,
self::SHA256,
self::SHA384,
self::SHA512
];
} | [
"public",
"static",
"function",
"getAll",
"(",
")",
":",
"array",
"{",
"return",
"[",
"self",
"::",
"RSA_SHA256",
",",
"self",
"::",
"RSA_SHA384",
",",
"self",
"::",
"RSA_SHA512",
",",
"self",
"::",
"SHA256",
",",
"self",
"::",
"SHA384",
",",
"self",
"... | Gets all the supported algorithms
@return array All the supported algorithms | [
"Gets",
"all",
"the",
"supported",
"algorithms"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Authentication/Tokens/Signatures/Algorithms.php#L38-L48 |
opulencephp/Opulence | src/Opulence/Authentication/Tokens/Signatures/Algorithms.php | Algorithms.isSymmetric | public static function isSymmetric($algorithm) : bool
{
if (!self::has($algorithm)) {
throw new InvalidArgumentException("Algorithm \"$algorithm\" is not valid");
}
return in_array($algorithm, [Algorithms::SHA256, Algorithms::SHA384, Algorithms::SHA512]);
} | php | public static function isSymmetric($algorithm) : bool
{
if (!self::has($algorithm)) {
throw new InvalidArgumentException("Algorithm \"$algorithm\" is not valid");
}
return in_array($algorithm, [Algorithms::SHA256, Algorithms::SHA384, Algorithms::SHA512]);
} | [
"public",
"static",
"function",
"isSymmetric",
"(",
"$",
"algorithm",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"self",
"::",
"has",
"(",
"$",
"algorithm",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Algorithm \\\"$algorithm\\\" is not valid\... | Checks if an algorithm is symmetric
@param mixed $algorithm The algorithm to check
@return bool True if the algorithm is symmetric, otherwise false
@throws InvalidArgumentException Thrown if the algorithm is not valid | [
"Checks",
"if",
"an",
"algorithm",
"is",
"symmetric"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Authentication/Tokens/Signatures/Algorithms.php#L68-L75 |
opulencephp/Opulence | src/Opulence/Framework/Http/CsrfTokenChecker.php | CsrfTokenChecker.tokenIsValid | public function tokenIsValid(Request $request, ISession $session) : bool
{
if (!$session->has(self::TOKEN_INPUT_NAME)) {
$session->set(self::TOKEN_INPUT_NAME, \bin2hex(\random_bytes(16)));
}
if ($this->tokenShouldNotBeChecked($request)) {
return true;
}
... | php | public function tokenIsValid(Request $request, ISession $session) : bool
{
if (!$session->has(self::TOKEN_INPUT_NAME)) {
$session->set(self::TOKEN_INPUT_NAME, \bin2hex(\random_bytes(16)));
}
if ($this->tokenShouldNotBeChecked($request)) {
return true;
}
... | [
"public",
"function",
"tokenIsValid",
"(",
"Request",
"$",
"request",
",",
"ISession",
"$",
"session",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"session",
"->",
"has",
"(",
"self",
"::",
"TOKEN_INPUT_NAME",
")",
")",
"{",
"$",
"session",
"->",
"set"... | Checks if the token is valid
@param Request $request The current request
@param ISession $session The current session
@return bool True if the token is valid, otherwise false | [
"Checks",
"if",
"the",
"token",
"is",
"valid"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Http/CsrfTokenChecker.php#L32-L60 |
opulencephp/Opulence | src/Opulence/Framework/Http/CsrfTokenChecker.php | CsrfTokenChecker.tokenShouldNotBeChecked | private function tokenShouldNotBeChecked(Request $request) : bool
{
return in_array($request->getMethod(), [RequestMethods::GET, RequestMethods::HEAD, RequestMethods::OPTIONS]);
} | php | private function tokenShouldNotBeChecked(Request $request) : bool
{
return in_array($request->getMethod(), [RequestMethods::GET, RequestMethods::HEAD, RequestMethods::OPTIONS]);
} | [
"private",
"function",
"tokenShouldNotBeChecked",
"(",
"Request",
"$",
"request",
")",
":",
"bool",
"{",
"return",
"in_array",
"(",
"$",
"request",
"->",
"getMethod",
"(",
")",
",",
"[",
"RequestMethods",
"::",
"GET",
",",
"RequestMethods",
"::",
"HEAD",
","... | Gets whether or not the token should even be checked
@param Request $request The current request
@return bool True if the token should be checked, otherwise false | [
"Gets",
"whether",
"or",
"not",
"the",
"token",
"should",
"even",
"be",
"checked"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Http/CsrfTokenChecker.php#L68-L71 |
opulencephp/Opulence | src/Opulence/Orm/DataMappers/SqlDataMapper.php | SqlDataMapper.read | protected function read(string $sql, array $sqlParameters, int $valueType, bool $expectSingleResult = false)
{
try {
$statement = $this->readConnection->prepare($sql);
$statement->bindValues($sqlParameters);
$statement->execute();
if ($expectSingleResult && $... | php | protected function read(string $sql, array $sqlParameters, int $valueType, bool $expectSingleResult = false)
{
try {
$statement = $this->readConnection->prepare($sql);
$statement->bindValues($sqlParameters);
$statement->execute();
if ($expectSingleResult && $... | [
"protected",
"function",
"read",
"(",
"string",
"$",
"sql",
",",
"array",
"$",
"sqlParameters",
",",
"int",
"$",
"valueType",
",",
"bool",
"$",
"expectSingleResult",
"=",
"false",
")",
"{",
"try",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"readConne... | Performs the read query for entity(ies) and returns any results
@param string $sql The SQL query to run
@param array $sqlParameters The list of SQL parameters
@param int $valueType The value type constant designating what kind of data we're expecting to return
@param bool $expectSingleResult True if we're expecting a ... | [
"Performs",
"the",
"read",
"query",
"for",
"entity",
"(",
"ies",
")",
"and",
"returns",
"any",
"results"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Orm/DataMappers/SqlDataMapper.php#L61-L91 |
opulencephp/Opulence | src/Opulence/Databases/Adapters/Pdo/Connection.php | Connection.connect | private function connect()
{
if (!$this->isConnected) {
parent::__construct(
$this->dsn,
$this->server->getUsername(),
$this->server->getPassword(),
$this->driverOptions
);
parent::setAttribute(PDO::ATTR_ERRM... | php | private function connect()
{
if (!$this->isConnected) {
parent::__construct(
$this->dsn,
$this->server->getUsername(),
$this->server->getPassword(),
$this->driverOptions
);
parent::setAttribute(PDO::ATTR_ERRM... | [
"private",
"function",
"connect",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isConnected",
")",
"{",
"parent",
"::",
"__construct",
"(",
"$",
"this",
"->",
"dsn",
",",
"$",
"this",
"->",
"server",
"->",
"getUsername",
"(",
")",
",",
"$",
"t... | Attempts to connect to the server, which is done via lazy-connecting
@throws PDOException Thrown if there was an error connecting to the database | [
"Attempts",
"to",
"connect",
"to",
"the",
"server",
"which",
"is",
"done",
"via",
"lazy",
"-",
"connecting"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Databases/Adapters/Pdo/Connection.php#L235-L252 |
opulencephp/Opulence | src/Opulence/IO/Streams/MultiStream.php | MultiStream.addStream | public function addStream(IStream $stream) : void
{
if (!$stream->isReadable()) {
throw new InvalidArgumentException('Stream must be readable');
}
$this->isSeekable = $this->isSeekable && $stream->isSeekable();
$this->streams[] = $stream;
} | php | public function addStream(IStream $stream) : void
{
if (!$stream->isReadable()) {
throw new InvalidArgumentException('Stream must be readable');
}
$this->isSeekable = $this->isSeekable && $stream->isSeekable();
$this->streams[] = $stream;
} | [
"public",
"function",
"addStream",
"(",
"IStream",
"$",
"stream",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"stream",
"->",
"isReadable",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Stream must be readable'",
")",
";",
"}",
"$"... | Adds a stream to the multi-stream
@param IStream $stream The stream to add
@throws InvalidArgumentException Thrown if the stream is not readable | [
"Adds",
"a",
"stream",
"to",
"the",
"multi",
"-",
"stream"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/IO/Streams/MultiStream.php#L68-L76 |
opulencephp/Opulence | src/Opulence/Authentication/Credentials/Authenticators/UsernamePasswordAuthenticator.php | UsernamePasswordAuthenticator.getSubjectFromUser | protected function getSubjectFromUser(IUser $user, ICredential $credential) : ISubject
{
$userId = $user->getId();
$roles = $this->roleRepository->getRoleNamesForSubject($userId);
return new Subject([new Principal(PrincipalTypes::PRIMARY, $userId, $roles)], [$credential]);
} | php | protected function getSubjectFromUser(IUser $user, ICredential $credential) : ISubject
{
$userId = $user->getId();
$roles = $this->roleRepository->getRoleNamesForSubject($userId);
return new Subject([new Principal(PrincipalTypes::PRIMARY, $userId, $roles)], [$credential]);
} | [
"protected",
"function",
"getSubjectFromUser",
"(",
"IUser",
"$",
"user",
",",
"ICredential",
"$",
"credential",
")",
":",
"ISubject",
"{",
"$",
"userId",
"=",
"$",
"user",
"->",
"getId",
"(",
")",
";",
"$",
"roles",
"=",
"$",
"this",
"->",
"roleReposito... | Gets a subject from a user
@param IUser $user The user
@param ICredential $credential The credential
@return ISubject The subject | [
"Gets",
"a",
"subject",
"from",
"a",
"user"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Authentication/Credentials/Authenticators/UsernamePasswordAuthenticator.php#L86-L92 |
opulencephp/Opulence | src/Opulence/QueryBuilders/InsertQuery.php | InsertQuery.addColumnValues | public function addColumnValues(array $columnNamesToValues) : self
{
$this->addUnnamedPlaceholderValues(array_values($columnNamesToValues));
// The augmenting query doesn't care about the data type, so get rid of it
$columnNamesToValuesWithoutDataTypes = [];
foreach ($columnNamesTo... | php | public function addColumnValues(array $columnNamesToValues) : self
{
$this->addUnnamedPlaceholderValues(array_values($columnNamesToValues));
// The augmenting query doesn't care about the data type, so get rid of it
$columnNamesToValuesWithoutDataTypes = [];
foreach ($columnNamesTo... | [
"public",
"function",
"addColumnValues",
"(",
"array",
"$",
"columnNamesToValues",
")",
":",
"self",
"{",
"$",
"this",
"->",
"addUnnamedPlaceholderValues",
"(",
"array_values",
"(",
"$",
"columnNamesToValues",
")",
")",
";",
"// The augmenting query doesn't care about t... | Adds column values to the query
@param array $columnNamesToValues The mapping of column names to their respective values
Optionally, the values can be contained in an array whose first item is the value and whose second value is
the PDO constant indicating the type of data the value represents
@return self For method ... | [
"Adds",
"column",
"values",
"to",
"the",
"query"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/InsertQuery.php#L42-L60 |
opulencephp/Opulence | src/Opulence/Authentication/Tokens/JsonWebTokens/JwtHeader.php | JwtHeader.add | public function add(string $name, $value)
{
switch ($name) {
case 'alg':
$this->setAlgorithm($value);
break;
default:
$this->headers[$name] = $value;
break;
}
} | php | public function add(string $name, $value)
{
switch ($name) {
case 'alg':
$this->setAlgorithm($value);
break;
default:
$this->headers[$name] = $value;
break;
}
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"name",
")",
"{",
"case",
"'alg'",
":",
"$",
"this",
"->",
"setAlgorithm",
"(",
"$",
"value",
")",
";",
"break",
";",
"default",
":",
"$",
"... | Adds a header
@param string $name The name of the header to add
@param mixed $value The value to add | [
"Adds",
"a",
"header"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Authentication/Tokens/JsonWebTokens/JwtHeader.php#L67-L77 |
opulencephp/Opulence | src/Opulence/Authentication/Tokens/JsonWebTokens/JwtHeader.php | JwtHeader.get | public function get(string $name)
{
if (!array_key_exists($name, $this->headers)) {
return null;
}
return $this->headers[$name];
} | php | public function get(string $name)
{
if (!array_key_exists($name, $this->headers)) {
return null;
}
return $this->headers[$name];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"headers",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"headers",
"[",
"$",... | Gets the value for a header
@param string $name The name of the header to get
@return mixed|null The value of the header if it exists, otherwise null | [
"Gets",
"the",
"value",
"for",
"a",
"header"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Authentication/Tokens/JsonWebTokens/JwtHeader.php#L95-L102 |
opulencephp/Opulence | src/Opulence/Orm/ChangeTracking/ChangeTracker.php | ChangeTracker.hasChangedUsingComparisonFunction | protected function hasChangedUsingComparisonFunction($entity) : bool
{
$objectHashId = spl_object_hash($entity);
$originalData = $this->objectHashIdsToOriginalData[$objectHashId];
return !$this->comparators[get_class($entity)]($originalData, $entity);
} | php | protected function hasChangedUsingComparisonFunction($entity) : bool
{
$objectHashId = spl_object_hash($entity);
$originalData = $this->objectHashIdsToOriginalData[$objectHashId];
return !$this->comparators[get_class($entity)]($originalData, $entity);
} | [
"protected",
"function",
"hasChangedUsingComparisonFunction",
"(",
"$",
"entity",
")",
":",
"bool",
"{",
"$",
"objectHashId",
"=",
"spl_object_hash",
"(",
"$",
"entity",
")",
";",
"$",
"originalData",
"=",
"$",
"this",
"->",
"objectHashIdsToOriginalData",
"[",
"... | Checks to see if an entity has changed using a comparison function
@param object $entity The entity to check for changes
@return bool True if the entity has changed, otherwise false | [
"Checks",
"to",
"see",
"if",
"an",
"entity",
"has",
"changed",
"using",
"a",
"comparison",
"function"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Orm/ChangeTracking/ChangeTracker.php#L91-L97 |
opulencephp/Opulence | src/Opulence/Framework/Events/Bootstrappers/EventDispatcherBootstrapper.php | EventDispatcherBootstrapper.getEventDispatcher | protected function getEventDispatcher(IContainer $container) : IEventDispatcher
{
$eventRegistry = new EventRegistry();
foreach ($this->getEventListenerConfig() as $eventName => $listeners) {
foreach ((array)$listeners as $listener) {
$eventRegistry->registerListener($ev... | php | protected function getEventDispatcher(IContainer $container) : IEventDispatcher
{
$eventRegistry = new EventRegistry();
foreach ($this->getEventListenerConfig() as $eventName => $listeners) {
foreach ((array)$listeners as $listener) {
$eventRegistry->registerListener($ev... | [
"protected",
"function",
"getEventDispatcher",
"(",
"IContainer",
"$",
"container",
")",
":",
"IEventDispatcher",
"{",
"$",
"eventRegistry",
"=",
"new",
"EventRegistry",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getEventListenerConfig",
"(",
")",
"as",
... | Gets the event dispatcher
@param IContainer $container The IoC container
@return IEventDispatcher The event dispatcher | [
"Gets",
"the",
"event",
"dispatcher"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Events/Bootstrappers/EventDispatcherBootstrapper.php#L46-L57 |
opulencephp/Opulence | src/Opulence/Framework/Events/Bootstrappers/EventDispatcherBootstrapper.php | EventDispatcherBootstrapper.getEventListenerCallback | protected function getEventListenerCallback($listenerConfig, IContainer $container) : callable
{
if (is_callable($listenerConfig)) {
return $listenerConfig;
}
if (is_string($listenerConfig)) {
if (strpos($listenerConfig, '@') === false) {
throw new In... | php | protected function getEventListenerCallback($listenerConfig, IContainer $container) : callable
{
if (is_callable($listenerConfig)) {
return $listenerConfig;
}
if (is_string($listenerConfig)) {
if (strpos($listenerConfig, '@') === false) {
throw new In... | [
"protected",
"function",
"getEventListenerCallback",
"(",
"$",
"listenerConfig",
",",
"IContainer",
"$",
"container",
")",
":",
"callable",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"listenerConfig",
")",
")",
"{",
"return",
"$",
"listenerConfig",
";",
"}",
"if... | Gets a callback for an event listener from a config
@param callable|string $listenerConfig The callable or "className@method" string
@param IContainer $container The IoC container
@return callable The event listener callable
@throws InvalidArgumentException Thrown if the listener config was not set up correctly | [
"Gets",
"a",
"callback",
"for",
"an",
"event",
"listener",
"from",
"a",
"config"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Events/Bootstrappers/EventDispatcherBootstrapper.php#L67-L93 |
opulencephp/Opulence | src/Opulence/Authentication/Tokens/JsonWebTokens/SignedJwt.php | SignedJwt.createFromString | public static function createFromString(string $token) : SignedJwt
{
$segments = explode('.', $token);
if (count($segments) !== 3) {
throw new InvalidArgumentException('Token did not contain 3 segments');
}
list($encodedHeader, $encodedPayload, $encodedSignature) = $seg... | php | public static function createFromString(string $token) : SignedJwt
{
$segments = explode('.', $token);
if (count($segments) !== 3) {
throw new InvalidArgumentException('Token did not contain 3 segments');
}
list($encodedHeader, $encodedPayload, $encodedSignature) = $seg... | [
"public",
"static",
"function",
"createFromString",
"(",
"string",
"$",
"token",
")",
":",
"SignedJwt",
"{",
"$",
"segments",
"=",
"explode",
"(",
"'.'",
",",
"$",
"token",
")",
";",
"if",
"(",
"count",
"(",
"$",
"segments",
")",
"!==",
"3",
")",
"{"... | Creates a signed JWT from a raw string
@param string $token The token to create from
@return SignedJwt The signed JSON web token
@throws InvalidArgumentException Thrown if the token was not correctly formatted | [
"Creates",
"a",
"signed",
"JWT",
"from",
"a",
"raw",
"string"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Authentication/Tokens/JsonWebTokens/SignedJwt.php#L42-L77 |
opulencephp/Opulence | src/Opulence/Authentication/Tokens/JsonWebTokens/SignedJwt.php | SignedJwt.createFromUnsignedJwt | public static function createFromUnsignedJwt(UnsignedJwt $unsignedJwt, string $signature) : SignedJwt
{
return new self($unsignedJwt->getHeader(), $unsignedJwt->getPayload(), $signature);
} | php | public static function createFromUnsignedJwt(UnsignedJwt $unsignedJwt, string $signature) : SignedJwt
{
return new self($unsignedJwt->getHeader(), $unsignedJwt->getPayload(), $signature);
} | [
"public",
"static",
"function",
"createFromUnsignedJwt",
"(",
"UnsignedJwt",
"$",
"unsignedJwt",
",",
"string",
"$",
"signature",
")",
":",
"SignedJwt",
"{",
"return",
"new",
"self",
"(",
"$",
"unsignedJwt",
"->",
"getHeader",
"(",
")",
",",
"$",
"unsignedJwt"... | Creates a signed JWT from an unsigned JWT and signature
@param UnsignedJwt $unsignedJwt The unsigned token to create the signed token from
@param string $signature The signature
@return SignedJwt The signed JSON web token | [
"Creates",
"a",
"signed",
"JWT",
"from",
"an",
"unsigned",
"JWT",
"and",
"signature"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Authentication/Tokens/JsonWebTokens/SignedJwt.php#L86-L89 |
opulencephp/Opulence | src/Opulence/Authentication/Tokens/JsonWebTokens/SignedJwt.php | SignedJwt.encode | public function encode() : string
{
$segments = [
$this->header->encode(),
$this->payload->encode(),
self::base64UrlEncode($this->signature)
];
return implode('.', $segments);
} | php | public function encode() : string
{
$segments = [
$this->header->encode(),
$this->payload->encode(),
self::base64UrlEncode($this->signature)
];
return implode('.', $segments);
} | [
"public",
"function",
"encode",
"(",
")",
":",
"string",
"{",
"$",
"segments",
"=",
"[",
"$",
"this",
"->",
"header",
"->",
"encode",
"(",
")",
",",
"$",
"this",
"->",
"payload",
"->",
"encode",
"(",
")",
",",
"self",
"::",
"base64UrlEncode",
"(",
... | Encodes this token as a string
@return string The encoded string | [
"Encodes",
"this",
"token",
"as",
"a",
"string"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Authentication/Tokens/JsonWebTokens/SignedJwt.php#L120-L129 |
opulencephp/Opulence | src/Opulence/QueryBuilders/ConditionalQueryBuilder.php | ConditionalQueryBuilder.addConditionToClause | public function addConditionToClause(array $clauseConditions, string $operation, string ...$conditions) : array
{
foreach ($conditions as $condition) {
$clauseConditions[] = ['operation' => $operation, 'condition' => $condition];
}
return $clauseConditions;
} | php | public function addConditionToClause(array $clauseConditions, string $operation, string ...$conditions) : array
{
foreach ($conditions as $condition) {
$clauseConditions[] = ['operation' => $operation, 'condition' => $condition];
}
return $clauseConditions;
} | [
"public",
"function",
"addConditionToClause",
"(",
"array",
"$",
"clauseConditions",
",",
"string",
"$",
"operation",
",",
"string",
"...",
"$",
"conditions",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"conditions",
"as",
"$",
"condition",
")",
"{",
"$",
... | Adds a condition to a clause
@param array $clauseConditions The list of conditions that already belong to the clause
@param string $operation Either "AND" or "OR", indicating how this condition is being added to the list of conditions
@param string[] $conditions,... A variable list of conditions to be met
@return arra... | [
"Adds",
"a",
"condition",
"to",
"a",
"clause"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/ConditionalQueryBuilder.php#L29-L36 |
opulencephp/Opulence | src/Opulence/QueryBuilders/ConditionalQueryBuilder.php | ConditionalQueryBuilder.andWhere | public function andWhere(string ...$condition) : self
{
$this->whereConditions = $this->addConditionToClause(
$this->whereConditions, 'AND', ...$condition);
return $this;
} | php | public function andWhere(string ...$condition) : self
{
$this->whereConditions = $this->addConditionToClause(
$this->whereConditions, 'AND', ...$condition);
return $this;
} | [
"public",
"function",
"andWhere",
"(",
"string",
"...",
"$",
"condition",
")",
":",
"self",
"{",
"$",
"this",
"->",
"whereConditions",
"=",
"$",
"this",
"->",
"addConditionToClause",
"(",
"$",
"this",
"->",
"whereConditions",
",",
"'AND'",
",",
"...",
"$",... | Adds to a "WHERE" condition that will be "AND"ed with other conditions
@param string[] $condition,... A variable list of conditions to be met
@return self For method chaining | [
"Adds",
"to",
"a",
"WHERE",
"condition",
"that",
"will",
"be",
"AND",
"ed",
"with",
"other",
"conditions"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/ConditionalQueryBuilder.php#L44-L50 |
opulencephp/Opulence | src/Opulence/QueryBuilders/ConditionalQueryBuilder.php | ConditionalQueryBuilder.getClauseConditionSql | public function getClauseConditionSql(string $conditionType, array $clauseConditions) : string
{
if (count($clauseConditions) === 0) {
return '';
}
$sql = ' ' . strtoupper($conditionType);
// This will help us keep track of whether or not we've added at least one clause
... | php | public function getClauseConditionSql(string $conditionType, array $clauseConditions) : string
{
if (count($clauseConditions) === 0) {
return '';
}
$sql = ' ' . strtoupper($conditionType);
// This will help us keep track of whether or not we've added at least one clause
... | [
"public",
"function",
"getClauseConditionSql",
"(",
"string",
"$",
"conditionType",
",",
"array",
"$",
"clauseConditions",
")",
":",
"string",
"{",
"if",
"(",
"count",
"(",
"$",
"clauseConditions",
")",
"===",
"0",
")",
"{",
"return",
"''",
";",
"}",
"$",
... | Gets the SQL that makes up a clause that permits boolean operations ie "AND" and "OR"
@param string $conditionType The name of the condition type ie "WHERE"
@param array $clauseConditions The array of condition data whose SQL we want
@return string The SQL that makes up the input clause(s) | [
"Gets",
"the",
"SQL",
"that",
"makes",
"up",
"a",
"clause",
"that",
"permits",
"boolean",
"operations",
"ie",
"AND",
"and",
"OR"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/ConditionalQueryBuilder.php#L59-L76 |
opulencephp/Opulence | src/Opulence/QueryBuilders/ConditionalQueryBuilder.php | ConditionalQueryBuilder.orWhere | public function orWhere(string ...$condition) : self
{
$this->whereConditions = $this->addConditionToClause(
$this->whereConditions, 'OR', ...$condition);
return $this;
} | php | public function orWhere(string ...$condition) : self
{
$this->whereConditions = $this->addConditionToClause(
$this->whereConditions, 'OR', ...$condition);
return $this;
} | [
"public",
"function",
"orWhere",
"(",
"string",
"...",
"$",
"condition",
")",
":",
"self",
"{",
"$",
"this",
"->",
"whereConditions",
"=",
"$",
"this",
"->",
"addConditionToClause",
"(",
"$",
"this",
"->",
"whereConditions",
",",
"'OR'",
",",
"...",
"$",
... | Adds to a "WHERE" condition that will be "OR"ed with other conditions
@param string[] $condition,... A variable list of conditions to be met
@return self For method chaining | [
"Adds",
"to",
"a",
"WHERE",
"condition",
"that",
"will",
"be",
"OR",
"ed",
"with",
"other",
"conditions"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/ConditionalQueryBuilder.php#L92-L98 |
opulencephp/Opulence | src/Opulence/QueryBuilders/ConditionalQueryBuilder.php | ConditionalQueryBuilder.where | public function where(string ...$condition) : self
{
// We want to wipe out anything already in the condition list
$this->whereConditions = [];
$this->whereConditions = $this->addConditionToClause(
$this->whereConditions, 'AND', ...$condition);
return $this;
} | php | public function where(string ...$condition) : self
{
// We want to wipe out anything already in the condition list
$this->whereConditions = [];
$this->whereConditions = $this->addConditionToClause(
$this->whereConditions, 'AND', ...$condition);
return $this;
} | [
"public",
"function",
"where",
"(",
"string",
"...",
"$",
"condition",
")",
":",
"self",
"{",
"// We want to wipe out anything already in the condition list",
"$",
"this",
"->",
"whereConditions",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"whereConditions",
"=",
"$",... | Starts a "WHERE" condition
Only call this method once per query because it will overwrite any previously-set "WHERE" expressions
@param string[] $condition,... A variable list of conditions to be met
@return self For method chaining | [
"Starts",
"a",
"WHERE",
"condition",
"Only",
"call",
"this",
"method",
"once",
"per",
"query",
"because",
"it",
"will",
"overwrite",
"any",
"previously",
"-",
"set",
"WHERE",
"expressions"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/ConditionalQueryBuilder.php#L107-L115 |
opulencephp/Opulence | src/Opulence/Collections/KeyHasher.php | KeyHasher.getHashKey | public function getHashKey($value) : string
{
if (is_string($value)) {
return "__opulence:s:$value";
}
if (is_int($value)) {
return "__opulence:i:$value";
}
if (is_float($value)) {
return "__opulence:f:$value";
}
if (is_o... | php | public function getHashKey($value) : string
{
if (is_string($value)) {
return "__opulence:s:$value";
}
if (is_int($value)) {
return "__opulence:i:$value";
}
if (is_float($value)) {
return "__opulence:f:$value";
}
if (is_o... | [
"public",
"function",
"getHashKey",
"(",
"$",
"value",
")",
":",
"string",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"\"__opulence:s:$value\"",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"value",
")",
")",
"{",
"return",
... | Gets the hash key for a value
@param string|float|int|object|array|resource $value The value whose hash key we want
@return string The value's hash key
@throws RuntimeException Thrown if the value's hash key could not be calculated | [
"Gets",
"the",
"hash",
"key",
"for",
"a",
"value"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Collections/KeyHasher.php#L29-L65 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Rules.php | Rules.between | public function between($min, $max, bool $isInclusive = true) : self
{
$this->createRule(BetweenRule::class, [$min, $max, $isInclusive]);
return $this;
} | php | public function between($min, $max, bool $isInclusive = true) : self
{
$this->createRule(BetweenRule::class, [$min, $max, $isInclusive]);
return $this;
} | [
"public",
"function",
"between",
"(",
"$",
"min",
",",
"$",
"max",
",",
"bool",
"$",
"isInclusive",
"=",
"true",
")",
":",
"self",
"{",
"$",
"this",
"->",
"createRule",
"(",
"BetweenRule",
"::",
"class",
",",
"[",
"$",
"min",
",",
"$",
"max",
",",
... | Marks a field as having to be between values
@param int|float $min The minimum value to compare against
@param int|float $max The maximum value to compare against
@param bool $isInclusive Whether or not the extremes are inclusive
@return self For method chaining | [
"Marks",
"a",
"field",
"as",
"having",
"to",
"be",
"between",
"values"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Rules.php#L113-L118 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Rules.php | Rules.condition | public function condition($callback) : self
{
if ($this->inCondition) {
throw new LogicException('Cannot nest rule conditions');
}
// Order is important here
$this->createRule(ConditionalRule::class, [$callback]);
$this->inCondition = true;
return $this;... | php | public function condition($callback) : self
{
if ($this->inCondition) {
throw new LogicException('Cannot nest rule conditions');
}
// Order is important here
$this->createRule(ConditionalRule::class, [$callback]);
$this->inCondition = true;
return $this;... | [
"public",
"function",
"condition",
"(",
"$",
"callback",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"inCondition",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Cannot nest rule conditions'",
")",
";",
"}",
"// Order is important here",
"$",
"th... | Specifies conditions that must be met for certain rules to be set
@param callable $callback The callback to evaluate The variable list of rules
It must accept an array of all values
@return self For method chaining
@throws LogicException Thrown if we were already in a condition | [
"Specifies",
"conditions",
"that",
"must",
"be",
"met",
"for",
"certain",
"rules",
"to",
"be",
"set"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Rules.php#L128-L139 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Rules.php | Rules.getErrors | public function getErrors(string $field) : array
{
$compiledErrors = [];
foreach ($this->errorSlugsAndPlaceholders as $errorData) {
$compiledErrors[] = $this->errorTemplateCompiler->compile(
$field,
$this->errorTemplateRegistry->getErrorTemplate($field, $... | php | public function getErrors(string $field) : array
{
$compiledErrors = [];
foreach ($this->errorSlugsAndPlaceholders as $errorData) {
$compiledErrors[] = $this->errorTemplateCompiler->compile(
$field,
$this->errorTemplateRegistry->getErrorTemplate($field, $... | [
"public",
"function",
"getErrors",
"(",
"string",
"$",
"field",
")",
":",
"array",
"{",
"$",
"compiledErrors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"errorSlugsAndPlaceholders",
"as",
"$",
"errorData",
")",
"{",
"$",
"compiledErrors",
"[",... | Gets the error messages
@param string $field The name of the field whose errors we're getting
@return array The list of errors | [
"Gets",
"the",
"error",
"messages"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Rules.php#L210-L223 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Rules.php | Rules.max | public function max($max, bool $isInclusive = true) : self
{
$this->createRule(MaxRule::class, [$max, $isInclusive]);
return $this;
} | php | public function max($max, bool $isInclusive = true) : self
{
$this->createRule(MaxRule::class, [$max, $isInclusive]);
return $this;
} | [
"public",
"function",
"max",
"(",
"$",
"max",
",",
"bool",
"$",
"isInclusive",
"=",
"true",
")",
":",
"self",
"{",
"$",
"this",
"->",
"createRule",
"(",
"MaxRule",
"::",
"class",
",",
"[",
"$",
"max",
",",
"$",
"isInclusive",
"]",
")",
";",
"return... | Marks a field as having a maximum acceptable value
@param int|float $max The maximum value to compare against
@param bool $isInclusive Whether or not the maximum is inclusive
@return self For method chaining | [
"Marks",
"a",
"field",
"as",
"having",
"a",
"maximum",
"acceptable",
"value"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Rules.php#L269-L274 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Rules.php | Rules.min | public function min($min, bool $isInclusive = true) : self
{
$this->createRule(MinRule::class, [$min, $isInclusive]);
return $this;
} | php | public function min($min, bool $isInclusive = true) : self
{
$this->createRule(MinRule::class, [$min, $isInclusive]);
return $this;
} | [
"public",
"function",
"min",
"(",
"$",
"min",
",",
"bool",
"$",
"isInclusive",
"=",
"true",
")",
":",
"self",
"{",
"$",
"this",
"->",
"createRule",
"(",
"MinRule",
"::",
"class",
",",
"[",
"$",
"min",
",",
"$",
"isInclusive",
"]",
")",
";",
"return... | Marks a field as having a minimum acceptable value
@param int|float $min The minimum value to compare against
@param bool $isInclusive Whether or not the minimum is inclusive
@return self For method chaining | [
"Marks",
"a",
"field",
"as",
"having",
"a",
"minimum",
"acceptable",
"value"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Rules.php#L283-L288 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Rules.php | Rules.pass | public function pass($value, array $allValues = [], bool $haltFieldValidationOnFailure = false) : bool
{
$this->errorSlugsAndPlaceholders = [];
$passes = true;
foreach ($this->rules as $rule) {
// Non-required fields do not need to evaluate all rules when empty
if (!... | php | public function pass($value, array $allValues = [], bool $haltFieldValidationOnFailure = false) : bool
{
$this->errorSlugsAndPlaceholders = [];
$passes = true;
foreach ($this->rules as $rule) {
// Non-required fields do not need to evaluate all rules when empty
if (!... | [
"public",
"function",
"pass",
"(",
"$",
"value",
",",
"array",
"$",
"allValues",
"=",
"[",
"]",
",",
"bool",
"$",
"haltFieldValidationOnFailure",
"=",
"false",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"errorSlugsAndPlaceholders",
"=",
"[",
"]",
";",
"$"... | Gets whether or not all the rules pass
@param mixed $value The value to validate
@param array $allValues The list of all values
@param bool $haltFieldValidationOnFailure True if we want to not check any other rules for a field
once one fails, otherwise false
@return bool True if all the rules pass, otherwise false | [
"Gets",
"whether",
"or",
"not",
"all",
"the",
"rules",
"pass"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Rules.php#L324-L357 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Rules.php | Rules.addError | protected function addError(IRule $rule)
{
if ($rule instanceof ConditionalRule) {
$rules = $rule->getRules();
} else {
$rules = [$rule];
}
foreach ($rules as $singleRule) {
$this->errorSlugsAndPlaceholders[] = [
'slug' => $singleR... | php | protected function addError(IRule $rule)
{
if ($rule instanceof ConditionalRule) {
$rules = $rule->getRules();
} else {
$rules = [$rule];
}
foreach ($rules as $singleRule) {
$this->errorSlugsAndPlaceholders[] = [
'slug' => $singleR... | [
"protected",
"function",
"addError",
"(",
"IRule",
"$",
"rule",
")",
"{",
"if",
"(",
"$",
"rule",
"instanceof",
"ConditionalRule",
")",
"{",
"$",
"rules",
"=",
"$",
"rule",
"->",
"getRules",
"(",
")",
";",
"}",
"else",
"{",
"$",
"rules",
"=",
"[",
... | Adds an error
@param IRule $rule The rule that failed | [
"Adds",
"an",
"error"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Rules.php#L390-L404 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Rules.php | Rules.addRule | protected function addRule(IRule $rule)
{
if ($this->inCondition) {
/** @var ConditionalRule $lastRule */
$lastRule = $this->rules[count($this->rules) - 1];
$lastRule->addRule($rule);
} else {
$this->rules[] = $rule;
}
} | php | protected function addRule(IRule $rule)
{
if ($this->inCondition) {
/** @var ConditionalRule $lastRule */
$lastRule = $this->rules[count($this->rules) - 1];
$lastRule->addRule($rule);
} else {
$this->rules[] = $rule;
}
} | [
"protected",
"function",
"addRule",
"(",
"IRule",
"$",
"rule",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"inCondition",
")",
"{",
"/** @var ConditionalRule $lastRule */",
"$",
"lastRule",
"=",
"$",
"this",
"->",
"rules",
"[",
"count",
"(",
"$",
"this",
"->",... | Adds a rule to the list
@param IRule $rule The rule to add | [
"Adds",
"a",
"rule",
"to",
"the",
"list"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Rules.php#L411-L420 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Rules.php | Rules.createRule | protected function createRule(string $className, array $args = [])
{
if (!class_exists($className)) {
throw new InvalidArgumentException("Class \"$className\" does not exist");
}
/** @var IRule|IRuleWithArgs $rule */
$rule = new $className;
if ($rule instanceof ... | php | protected function createRule(string $className, array $args = [])
{
if (!class_exists($className)) {
throw new InvalidArgumentException("Class \"$className\" does not exist");
}
/** @var IRule|IRuleWithArgs $rule */
$rule = new $className;
if ($rule instanceof ... | [
"protected",
"function",
"createRule",
"(",
"string",
"$",
"className",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"className",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Class \\\"... | Adds a rule with the input name and arguments
@param string $className The fully name of the rule class, eg "Opulence\...\RequiredRule"
@param array $args The extra arguments
@throws InvalidArgumentException Thrown if no rule exists with the input name | [
"Adds",
"a",
"rule",
"with",
"the",
"input",
"name",
"and",
"arguments"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Rules.php#L429-L443 |
opulencephp/Opulence | src/Opulence/Debug/Exceptions/Handlers/Http/ExceptionRenderer.php | ExceptionRenderer.getDefaultResponseContent | protected function getDefaultResponseContent(Exception $ex, int $statusCode) : string
{
if ($this->inDevelopmentEnvironment) {
$content = $this->getDevelopmentEnvironmentContent($ex, $statusCode);
} else {
$content = $this->getProductionEnvironmentContent($ex, $statusCode);
... | php | protected function getDefaultResponseContent(Exception $ex, int $statusCode) : string
{
if ($this->inDevelopmentEnvironment) {
$content = $this->getDevelopmentEnvironmentContent($ex, $statusCode);
} else {
$content = $this->getProductionEnvironmentContent($ex, $statusCode);
... | [
"protected",
"function",
"getDefaultResponseContent",
"(",
"Exception",
"$",
"ex",
",",
"int",
"$",
"statusCode",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"inDevelopmentEnvironment",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getDevelop... | Gets the default response content
@param Exception $ex The exception
@param int $statusCode The HTTP status code
@return string The content of the response | [
"Gets",
"the",
"default",
"response",
"content"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Debug/Exceptions/Handlers/Http/ExceptionRenderer.php#L84-L93 |
opulencephp/Opulence | src/Opulence/Debug/Exceptions/Handlers/Http/ExceptionRenderer.php | ExceptionRenderer.getDevelopmentEnvironmentContent | protected function getDevelopmentEnvironmentContent(Exception $ex, int $statusCode) : string
{
ob_start();
if ($statusCode === 503) {
require __DIR__ . "/templates/{$this->getRequestFormat()}/MaintenanceMode.php";
} else {
require __DIR__ . "/templates/{$this->getReq... | php | protected function getDevelopmentEnvironmentContent(Exception $ex, int $statusCode) : string
{
ob_start();
if ($statusCode === 503) {
require __DIR__ . "/templates/{$this->getRequestFormat()}/MaintenanceMode.php";
} else {
require __DIR__ . "/templates/{$this->getReq... | [
"protected",
"function",
"getDevelopmentEnvironmentContent",
"(",
"Exception",
"$",
"ex",
",",
"int",
"$",
"statusCode",
")",
":",
"string",
"{",
"ob_start",
"(",
")",
";",
"if",
"(",
"$",
"statusCode",
"===",
"503",
")",
"{",
"require",
"__DIR__",
".",
"\... | Gets the page contents for the default production exception page
@param Exception $ex The exception
@param int $statusCode The HTTP status code
@return string The contents of the page | [
"Gets",
"the",
"page",
"contents",
"for",
"the",
"default",
"production",
"exception",
"page"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Debug/Exceptions/Handlers/Http/ExceptionRenderer.php#L102-L113 |
opulencephp/Opulence | src/Opulence/Debug/Exceptions/Handlers/Http/ExceptionRenderer.php | ExceptionRenderer.getResponseContent | protected function getResponseContent($ex, int $statusCode, array $headers) : string
{
return $this->getDefaultResponseContent($ex, $statusCode);
} | php | protected function getResponseContent($ex, int $statusCode, array $headers) : string
{
return $this->getDefaultResponseContent($ex, $statusCode);
} | [
"protected",
"function",
"getResponseContent",
"(",
"$",
"ex",
",",
"int",
"$",
"statusCode",
",",
"array",
"$",
"headers",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"getDefaultResponseContent",
"(",
"$",
"ex",
",",
"$",
"statusCode",
")",
";",... | Gets the content for the response
@param Throwable|Exception $ex The exception
@param int $statusCode The HTTP status code
@param array $headers The HTTP headers
@return string The response content | [
"Gets",
"the",
"content",
"for",
"the",
"response"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Debug/Exceptions/Handlers/Http/ExceptionRenderer.php#L157-L160 |
opulencephp/Opulence | src/Opulence/Applications/Application.php | Application.shutDown | public function shutDown(callable $shutdownTask = null)
{
$taskReturnValue = null;
// Don't shut down a shutdown application
if ($this->isRunning) {
try {
$this->taskDispatcher->dispatch(TaskTypes::PRE_SHUTDOWN);
$this->isRunning = false;
... | php | public function shutDown(callable $shutdownTask = null)
{
$taskReturnValue = null;
// Don't shut down a shutdown application
if ($this->isRunning) {
try {
$this->taskDispatcher->dispatch(TaskTypes::PRE_SHUTDOWN);
$this->isRunning = false;
... | [
"public",
"function",
"shutDown",
"(",
"callable",
"$",
"shutdownTask",
"=",
"null",
")",
"{",
"$",
"taskReturnValue",
"=",
"null",
";",
"// Don't shut down a shutdown application",
"if",
"(",
"$",
"this",
"->",
"isRunning",
")",
"{",
"try",
"{",
"$",
"this",
... | Shuts down this application
@param callable $shutdownTask The task to perform on shutdown
@return mixed|null The return value of the task if there was one, otherwise null
@throws Exception Thrown if there was an error shutting down the application
@deprecated 1.1.0 This method will be removed | [
"Shuts",
"down",
"this",
"application"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Applications/Application.php#L69-L92 |
opulencephp/Opulence | src/Opulence/Applications/Application.php | Application.start | public function start(callable $startTask = null)
{
$taskReturnValue = null;
// Don't start a running application
if (!$this->isRunning) {
try {
$this->taskDispatcher->dispatch(TaskTypes::PRE_START);
$this->isRunning = true;
if ($... | php | public function start(callable $startTask = null)
{
$taskReturnValue = null;
// Don't start a running application
if (!$this->isRunning) {
try {
$this->taskDispatcher->dispatch(TaskTypes::PRE_START);
$this->isRunning = true;
if ($... | [
"public",
"function",
"start",
"(",
"callable",
"$",
"startTask",
"=",
"null",
")",
"{",
"$",
"taskReturnValue",
"=",
"null",
";",
"// Don't start a running application",
"if",
"(",
"!",
"$",
"this",
"->",
"isRunning",
")",
"{",
"try",
"{",
"$",
"this",
"-... | Starts this application
@param callable $startTask The task to perform on startup
@return mixed|null The return value of the task if there was one, otherwise null
@throws Exception Thrown if there was a problem starting the application
@deprecated 1.1.0 This method will be removed | [
"Starts",
"this",
"application"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Applications/Application.php#L102-L125 |
opulencephp/Opulence | src/Opulence/QueryBuilders/DeleteQuery.php | DeleteQuery.addUsing | public function addUsing(string ...$expression) : self
{
$this->usingExpressions = array_merge($this->usingExpressions, $expression);
return $this;
} | php | public function addUsing(string ...$expression) : self
{
$this->usingExpressions = array_merge($this->usingExpressions, $expression);
return $this;
} | [
"public",
"function",
"addUsing",
"(",
"string",
"...",
"$",
"expression",
")",
":",
"self",
"{",
"$",
"this",
"->",
"usingExpressions",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"usingExpressions",
",",
"$",
"expression",
")",
";",
"return",
"$",
"this"... | Adds to a "USING" expression
@param string[] $expression,... A variable list of other tables' names to use in the WHERE condition
@return self For method chaining | [
"Adds",
"to",
"a",
"USING",
"expression"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/DeleteQuery.php#L43-L48 |
opulencephp/Opulence | src/Opulence/QueryBuilders/DeleteQuery.php | DeleteQuery.andWhere | public function andWhere(...$conditions) : self
{
$this->conditionalQueryBuilder->andWhere(
...$this->createConditionExpressions($conditions)
);
return $this;
} | php | public function andWhere(...$conditions) : self
{
$this->conditionalQueryBuilder->andWhere(
...$this->createConditionExpressions($conditions)
);
return $this;
} | [
"public",
"function",
"andWhere",
"(",
"...",
"$",
"conditions",
")",
":",
"self",
"{",
"$",
"this",
"->",
"conditionalQueryBuilder",
"->",
"andWhere",
"(",
"...",
"$",
"this",
"->",
"createConditionExpressions",
"(",
"$",
"conditions",
")",
")",
";",
"retur... | Adds to a "WHERE" condition that will be "AND"ed with other conditions
@param array $conditions,... A variable list of conditions to be met
@return self For method chaining | [
"Adds",
"to",
"a",
"WHERE",
"condition",
"that",
"will",
"be",
"AND",
"ed",
"with",
"other",
"conditions"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/DeleteQuery.php#L56-L63 |
opulencephp/Opulence | src/Opulence/QueryBuilders/DeleteQuery.php | DeleteQuery.orWhere | public function orWhere(...$conditions) : self
{
$this->conditionalQueryBuilder->orWhere(
...$this->createConditionExpressions($conditions)
);
return $this;
} | php | public function orWhere(...$conditions) : self
{
$this->conditionalQueryBuilder->orWhere(
...$this->createConditionExpressions($conditions)
);
return $this;
} | [
"public",
"function",
"orWhere",
"(",
"...",
"$",
"conditions",
")",
":",
"self",
"{",
"$",
"this",
"->",
"conditionalQueryBuilder",
"->",
"orWhere",
"(",
"...",
"$",
"this",
"->",
"createConditionExpressions",
"(",
"$",
"conditions",
")",
")",
";",
"return"... | Adds to a "WHERE" condition that will be "OR"ed with other conditions
@param array $conditions,... A variable list of conditions to be met
@return self For method chaining | [
"Adds",
"to",
"a",
"WHERE",
"condition",
"that",
"will",
"be",
"OR",
"ed",
"with",
"other",
"conditions"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/DeleteQuery.php#L89-L96 |
opulencephp/Opulence | src/Opulence/QueryBuilders/DeleteQuery.php | DeleteQuery.where | public function where(...$conditions) : self
{
$this->conditionalQueryBuilder->where(
...$this->createConditionExpressions($conditions)
);
return $this;
} | php | public function where(...$conditions) : self
{
$this->conditionalQueryBuilder->where(
...$this->createConditionExpressions($conditions)
);
return $this;
} | [
"public",
"function",
"where",
"(",
"...",
"$",
"conditions",
")",
":",
"self",
"{",
"$",
"this",
"->",
"conditionalQueryBuilder",
"->",
"where",
"(",
"...",
"$",
"this",
"->",
"createConditionExpressions",
"(",
"$",
"conditions",
")",
")",
";",
"return",
... | Starts a "WHERE" condition
Only call this method once per query because it will overwrite any previously-set "WHERE" expressions
@param array $conditions,... A variable list of conditions to be met
@return self For method chaining | [
"Starts",
"a",
"WHERE",
"condition",
"Only",
"call",
"this",
"method",
"once",
"per",
"query",
"because",
"it",
"will",
"overwrite",
"any",
"previously",
"-",
"set",
"WHERE",
"expressions"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/DeleteQuery.php#L119-L126 |
opulencephp/Opulence | src/Opulence/QueryBuilders/DeleteQuery.php | DeleteQuery.createConditionExpressions | private function createConditionExpressions(array $conditions) : array
{
$conditionExpressions = [];
foreach ($conditions as $condition) {
if ($condition instanceof ICondition) {
$this->addUnnamedPlaceholderValues($condition->getParameters());
$conditionE... | php | private function createConditionExpressions(array $conditions) : array
{
$conditionExpressions = [];
foreach ($conditions as $condition) {
if ($condition instanceof ICondition) {
$this->addUnnamedPlaceholderValues($condition->getParameters());
$conditionE... | [
"private",
"function",
"createConditionExpressions",
"(",
"array",
"$",
"conditions",
")",
":",
"array",
"{",
"$",
"conditionExpressions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"conditions",
"as",
"$",
"condition",
")",
"{",
"if",
"(",
"$",
"condition",
... | Converts a list of condition strings or objects to their string representations
@param array $conditions The list of strings of condition objects to convert
@return array The list of condition expressions | [
"Converts",
"a",
"list",
"of",
"condition",
"strings",
"or",
"objects",
"to",
"their",
"string",
"representations"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/DeleteQuery.php#L134-L150 |
opulencephp/Opulence | src/Opulence/Views/Factories/ViewFactory.php | ViewFactory.runBuilders | protected function runBuilders(string $name, string $resolvedPath, IView $view) : IView
{
$builders = [];
// If there's a builder registered to the same name as the view
if (isset($this->builders[$name])) {
$builders = $this->builders[$name];
} else {
$pathIn... | php | protected function runBuilders(string $name, string $resolvedPath, IView $view) : IView
{
$builders = [];
// If there's a builder registered to the same name as the view
if (isset($this->builders[$name])) {
$builders = $this->builders[$name];
} else {
$pathIn... | [
"protected",
"function",
"runBuilders",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"resolvedPath",
",",
"IView",
"$",
"view",
")",
":",
"IView",
"{",
"$",
"builders",
"=",
"[",
"]",
";",
"// If there's a builder registered to the same name as the view",
"if",... | Runs the builders for a view (if there any)
@param string $name The name of the view file
@param string $resolvedPath The resolved path to the view file
@param IView $view The view to run builders on
@return IView The built view | [
"Runs",
"the",
"builders",
"for",
"a",
"view",
"(",
"if",
"there",
"any",
")"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Views/Factories/ViewFactory.php#L89-L117 |
opulencephp/Opulence | src/Opulence/Routing/Routes/RouteCollection.php | RouteCollection.add | public function add(ParsedRoute $route)
{
foreach ($route->getMethods() as $method) {
$this->routes[$method][] = $route;
if (!empty($route->getName())) {
$this->namedRoutes[$route->getName()] =& $route;
}
}
} | php | public function add(ParsedRoute $route)
{
foreach ($route->getMethods() as $method) {
$this->routes[$method][] = $route;
if (!empty($route->getName())) {
$this->namedRoutes[$route->getName()] =& $route;
}
}
} | [
"public",
"function",
"add",
"(",
"ParsedRoute",
"$",
"route",
")",
"{",
"foreach",
"(",
"$",
"route",
"->",
"getMethods",
"(",
")",
"as",
"$",
"method",
")",
"{",
"$",
"this",
"->",
"routes",
"[",
"$",
"method",
"]",
"[",
"]",
"=",
"$",
"route",
... | Adds a route to the collection
@param ParsedRoute $route The route to add | [
"Adds",
"a",
"route",
"to",
"the",
"collection"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Routing/Routes/RouteCollection.php#L109-L118 |
opulencephp/Opulence | src/Opulence/Routing/Routes/RouteCollection.php | RouteCollection.get | public function get(string $method = null) : array
{
if ($method === null) {
return $this->routes;
} elseif (isset($this->routes[$method])) {
return $this->routes[$method];
} else {
return [];
}
} | php | public function get(string $method = null) : array
{
if ($method === null) {
return $this->routes;
} elseif (isset($this->routes[$method])) {
return $this->routes[$method];
} else {
return [];
}
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"method",
"=",
"null",
")",
":",
"array",
"{",
"if",
"(",
"$",
"method",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"routes",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"this",
"->",
"r... | Gets all the routes
@param string|null $method If specified, the list of routes for that method will be returned
If null, all routes will be returned, keyed by method
@return ParsedRoute[] The list of routes | [
"Gets",
"all",
"the",
"routes"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Routing/Routes/RouteCollection.php#L127-L136 |
opulencephp/Opulence | src/Opulence/QueryBuilders/MySql/InsertQuery.php | InsertQuery.addUpdateColumnValues | public function addUpdateColumnValues(array $columnNamesToValues) : self
{
$this->duplicateKeyUpdateColumnNamesToValues = array_merge(
$this->duplicateKeyUpdateColumnNamesToValues,
$columnNamesToValues
);
return $this;
} | php | public function addUpdateColumnValues(array $columnNamesToValues) : self
{
$this->duplicateKeyUpdateColumnNamesToValues = array_merge(
$this->duplicateKeyUpdateColumnNamesToValues,
$columnNamesToValues
);
return $this;
} | [
"public",
"function",
"addUpdateColumnValues",
"(",
"array",
"$",
"columnNamesToValues",
")",
":",
"self",
"{",
"$",
"this",
"->",
"duplicateKeyUpdateColumnNamesToValues",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"duplicateKeyUpdateColumnNamesToValues",
",",
"$",
"... | Adds columns to update in the case a row already exists in the table
@param array $columnNamesToValues The mapping of column names to their respective values in the case of an
"ON DUPLICATE KEY UPDATE" clause
@return self For method chaining | [
"Adds",
"columns",
"to",
"update",
"in",
"the",
"case",
"a",
"row",
"already",
"exists",
"in",
"the",
"table"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/MySql/InsertQuery.php#L30-L38 |
opulencephp/Opulence | src/Opulence/QueryBuilders/Query.php | Query.addNamedPlaceholderValue | public function addNamedPlaceholderValue(string $placeholderName, $value, int $dataType = PDO::PARAM_STR) : self
{
if ($this->usingUnnamedPlaceholders === true) {
throw new InvalidQueryException('Cannot mix unnamed placeholders with named placeholders');
}
$this->usingUnnamedPla... | php | public function addNamedPlaceholderValue(string $placeholderName, $value, int $dataType = PDO::PARAM_STR) : self
{
if ($this->usingUnnamedPlaceholders === true) {
throw new InvalidQueryException('Cannot mix unnamed placeholders with named placeholders');
}
$this->usingUnnamedPla... | [
"public",
"function",
"addNamedPlaceholderValue",
"(",
"string",
"$",
"placeholderName",
",",
"$",
"value",
",",
"int",
"$",
"dataType",
"=",
"PDO",
"::",
"PARAM_STR",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"usingUnnamedPlaceholders",
"===",
"t... | Adds a named placeholder's value
Note that you cannot use a mix of named and unnamed placeholders in a query
@param string $placeholderName The name of the placeholder (what comes after the ":")
@param mixed $value The value of the placeholder
@param int $dataType The PDO constant that indicates the type of data the v... | [
"Adds",
"a",
"named",
"placeholder",
"s",
"value",
"Note",
"that",
"you",
"cannot",
"use",
"a",
"mix",
"of",
"named",
"and",
"unnamed",
"placeholders",
"in",
"a",
"query"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/Query.php#L52-L62 |
opulencephp/Opulence | src/Opulence/QueryBuilders/Query.php | Query.addNamedPlaceholderValues | public function addNamedPlaceholderValues(array $placeholderNamesToValues) : self
{
foreach ($placeholderNamesToValues as $placeholderName => $value) {
if (is_array($value)) {
if (count($value) !== 2) {
throw new InvalidQueryException('Incorrect number of item... | php | public function addNamedPlaceholderValues(array $placeholderNamesToValues) : self
{
foreach ($placeholderNamesToValues as $placeholderName => $value) {
if (is_array($value)) {
if (count($value) !== 2) {
throw new InvalidQueryException('Incorrect number of item... | [
"public",
"function",
"addNamedPlaceholderValues",
"(",
"array",
"$",
"placeholderNamesToValues",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"placeholderNamesToValues",
"as",
"$",
"placeholderName",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",... | Adds named placeholders' values
Note that you cannot use a mix of named and unnamed placeholders in a query
@param array $placeholderNamesToValues The mapping of placeholder names to their respective values
Optionally, the names can map to an array whose first item is the value and whose second value is the
PDO consta... | [
"Adds",
"named",
"placeholders",
"values",
"Note",
"that",
"you",
"cannot",
"use",
"a",
"mix",
"of",
"named",
"and",
"unnamed",
"placeholders",
"in",
"a",
"query"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/Query.php#L75-L90 |
opulencephp/Opulence | src/Opulence/QueryBuilders/Query.php | Query.addUnnamedPlaceholderValue | public function addUnnamedPlaceholderValue($value, int $dataType = PDO::PARAM_STR) : self
{
if ($this->usingUnnamedPlaceholders === false) {
throw new InvalidQueryException('Cannot mix unnamed placeholders with named placeholders');
}
$this->usingUnnamedPlaceholders = true;
... | php | public function addUnnamedPlaceholderValue($value, int $dataType = PDO::PARAM_STR) : self
{
if ($this->usingUnnamedPlaceholders === false) {
throw new InvalidQueryException('Cannot mix unnamed placeholders with named placeholders');
}
$this->usingUnnamedPlaceholders = true;
... | [
"public",
"function",
"addUnnamedPlaceholderValue",
"(",
"$",
"value",
",",
"int",
"$",
"dataType",
"=",
"PDO",
"::",
"PARAM_STR",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"usingUnnamedPlaceholders",
"===",
"false",
")",
"{",
"throw",
"new",
"I... | Adds an unnamed placeholder's value
Note that you cannot use a mix of named and unnamed placeholders in a query
@param mixed $value
@param int $dataType The PDO constant that indicates the type of data the value represents
@return self For method chaining
@throws InvalidQueryException Thrown if the user mixed unnamed ... | [
"Adds",
"an",
"unnamed",
"placeholder",
"s",
"value",
"Note",
"that",
"you",
"cannot",
"use",
"a",
"mix",
"of",
"named",
"and",
"unnamed",
"placeholders",
"in",
"a",
"query"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/Query.php#L101-L111 |
opulencephp/Opulence | src/Opulence/QueryBuilders/Query.php | Query.addUnnamedPlaceholderValues | public function addUnnamedPlaceholderValues(array $placeholderValues) : self
{
foreach ($placeholderValues as $value) {
if (is_array($value)) {
if (count($value) !== 2) {
throw new InvalidQueryException('Incorrect number of items in value array');
... | php | public function addUnnamedPlaceholderValues(array $placeholderValues) : self
{
foreach ($placeholderValues as $value) {
if (is_array($value)) {
if (count($value) !== 2) {
throw new InvalidQueryException('Incorrect number of items in value array');
... | [
"public",
"function",
"addUnnamedPlaceholderValues",
"(",
"array",
"$",
"placeholderValues",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"placeholderValues",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
... | Adds multiple unnamed placeholders' values
Note that you cannot use a mix of named and unnamed placeholders in a query
@param array $placeholderValues The list of placeholder values
Optionally, each value can be contained in an array whose first item is the value and whose second value is
the PDO constant indicating t... | [
"Adds",
"multiple",
"unnamed",
"placeholders",
"values",
"Note",
"that",
"you",
"cannot",
"use",
"a",
"mix",
"of",
"named",
"and",
"unnamed",
"placeholders",
"in",
"a",
"query"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/Query.php#L124-L139 |
opulencephp/Opulence | src/Opulence/QueryBuilders/Query.php | Query.removeNamedPlaceHolder | public function removeNamedPlaceHolder(string $placeholderName) : self
{
if ($this->usingUnnamedPlaceholders === true) {
throw new InvalidQueryException('Cannot mix unnamed placeholders with named placeholders');
}
unset($this->parameters[$placeholderName]);
return $thi... | php | public function removeNamedPlaceHolder(string $placeholderName) : self
{
if ($this->usingUnnamedPlaceholders === true) {
throw new InvalidQueryException('Cannot mix unnamed placeholders with named placeholders');
}
unset($this->parameters[$placeholderName]);
return $thi... | [
"public",
"function",
"removeNamedPlaceHolder",
"(",
"string",
"$",
"placeholderName",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"usingUnnamedPlaceholders",
"===",
"true",
")",
"{",
"throw",
"new",
"InvalidQueryException",
"(",
"'Cannot mix unnamed placeh... | Removes a named placeholder from the query
@param string $placeholderName The name of the placeholder to remove
@return self For method chaining
@throws InvalidQueryException Thrown if the user mixed unnamed placeholders with named placeholders | [
"Removes",
"a",
"named",
"placeholder",
"from",
"the",
"query"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/Query.php#L158-L167 |
opulencephp/Opulence | src/Opulence/QueryBuilders/Query.php | Query.removeUnnamedPlaceHolder | public function removeUnnamedPlaceHolder(int $placeholderIndex) : self
{
if ($this->usingUnnamedPlaceholders === false) {
throw new InvalidQueryException('Cannot mix unnamed placeholders with named placeholders');
}
unset($this->parameters[$placeholderIndex]);
// Re-inde... | php | public function removeUnnamedPlaceHolder(int $placeholderIndex) : self
{
if ($this->usingUnnamedPlaceholders === false) {
throw new InvalidQueryException('Cannot mix unnamed placeholders with named placeholders');
}
unset($this->parameters[$placeholderIndex]);
// Re-inde... | [
"public",
"function",
"removeUnnamedPlaceHolder",
"(",
"int",
"$",
"placeholderIndex",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"usingUnnamedPlaceholders",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidQueryException",
"(",
"'Cannot mix unnamed place... | Removes an unnamed placeholder from the query
@param int $placeholderIndex The index of the placeholder in the parameters to remove
@return self For method chaining
@throws InvalidQueryException Thrown if the user mixed unnamed placeholders with named placeholders | [
"Removes",
"an",
"unnamed",
"placeholder",
"from",
"the",
"query"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/Query.php#L176-L187 |
opulencephp/Opulence | src/Opulence/QueryBuilders/Query.php | Query.setTable | protected function setTable(string $tableName, string $tableAlias = '')
{
$this->tableName = $tableName;
$this->tableAlias = $tableAlias;
} | php | protected function setTable(string $tableName, string $tableAlias = '')
{
$this->tableName = $tableName;
$this->tableAlias = $tableAlias;
} | [
"protected",
"function",
"setTable",
"(",
"string",
"$",
"tableName",
",",
"string",
"$",
"tableAlias",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"tableName",
"=",
"$",
"tableName",
";",
"$",
"this",
"->",
"tableAlias",
"=",
"$",
"tableAlias",
";",
"}"
] | Sets the table we're querying
@param string $tableName The name of the table we're querying
@param string $tableAlias The table alias | [
"Sets",
"the",
"table",
"we",
"re",
"querying"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/Query.php#L195-L199 |
opulencephp/Opulence | src/Opulence/Routing/Routes/CompiledRoute.php | CompiledRoute.getPathVar | public function getPathVar(string $name)
{
if (isset($this->pathVars[$name])) {
return $this->pathVars[$name];
}
return null;
} | php | public function getPathVar(string $name)
{
if (isset($this->pathVars[$name])) {
return $this->pathVars[$name];
}
return null;
} | [
"public",
"function",
"getPathVar",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"pathVars",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"pathVars",
"[",
"$",
"name",
"]",
";",
"}",
"ret... | Gets the value of a path variable
@param string $name The name of the variable to get
@return mixed|null The value of the variable if it exists, otherwise null | [
"Gets",
"the",
"value",
"of",
"a",
"path",
"variable"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Routing/Routes/CompiledRoute.php#L45-L52 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Errors/ErrorTemplateRegistry.php | ErrorTemplateRegistry.getErrorTemplate | public function getErrorTemplate(string $field, string $ruleSlug) : string
{
if (isset($this->fieldTemplates[$field][$ruleSlug])) {
return $this->fieldTemplates[$field][$ruleSlug];
}
if (isset($this->globalTemplates[$ruleSlug])) {
return $this->globalTemplates[$ruleS... | php | public function getErrorTemplate(string $field, string $ruleSlug) : string
{
if (isset($this->fieldTemplates[$field][$ruleSlug])) {
return $this->fieldTemplates[$field][$ruleSlug];
}
if (isset($this->globalTemplates[$ruleSlug])) {
return $this->globalTemplates[$ruleS... | [
"public",
"function",
"getErrorTemplate",
"(",
"string",
"$",
"field",
",",
"string",
"$",
"ruleSlug",
")",
":",
"string",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fieldTemplates",
"[",
"$",
"field",
"]",
"[",
"$",
"ruleSlug",
"]",
")",
")",
... | Gets the error template for a field and rule
@param string $field The field whose template we want
@param string $ruleSlug The rule slug whose template we want
@return string The error template | [
"Gets",
"the",
"error",
"template",
"for",
"a",
"field",
"and",
"rule"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Errors/ErrorTemplateRegistry.php#L32-L43 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Errors/ErrorTemplateRegistry.php | ErrorTemplateRegistry.registerErrorTemplatesFromConfig | public function registerErrorTemplatesFromConfig(array $config)
{
foreach ($config as $key => $template) {
if (trim($key) === '') {
throw new InvalidArgumentException('Error template config key cannot be empty');
}
if (mb_strpos($key, '.') === false) {
... | php | public function registerErrorTemplatesFromConfig(array $config)
{
foreach ($config as $key => $template) {
if (trim($key) === '') {
throw new InvalidArgumentException('Error template config key cannot be empty');
}
if (mb_strpos($key, '.') === false) {
... | [
"public",
"function",
"registerErrorTemplatesFromConfig",
"(",
"array",
"$",
"config",
")",
"{",
"foreach",
"(",
"$",
"config",
"as",
"$",
"key",
"=>",
"$",
"template",
")",
"{",
"if",
"(",
"trim",
"(",
"$",
"key",
")",
"===",
"''",
")",
"{",
"throw",
... | Registers error templates from a config array
@param array $config The mapping of rules to error templates
Global error templates should be formatted "{slug}" => "{template}"
Field error templates should be formatted "{field}.{slug}" => "{template}"
@throws InvalidArgumentException Thrown if the config was invalid | [
"Registers",
"error",
"templates",
"from",
"a",
"config",
"array"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Errors/ErrorTemplateRegistry.php#L53-L72 |
opulencephp/Opulence | src/Opulence/Validation/Rules/Errors/ErrorTemplateRegistry.php | ErrorTemplateRegistry.registerFieldErrorTemplate | public function registerFieldErrorTemplate(string $field, string $ruleSlug, string $template)
{
if (!isset($this->fieldTemplates[$field])) {
$this->fieldTemplates[$field] = [];
}
$this->fieldTemplates[$field][$ruleSlug] = $template;
} | php | public function registerFieldErrorTemplate(string $field, string $ruleSlug, string $template)
{
if (!isset($this->fieldTemplates[$field])) {
$this->fieldTemplates[$field] = [];
}
$this->fieldTemplates[$field][$ruleSlug] = $template;
} | [
"public",
"function",
"registerFieldErrorTemplate",
"(",
"string",
"$",
"field",
",",
"string",
"$",
"ruleSlug",
",",
"string",
"$",
"template",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fieldTemplates",
"[",
"$",
"field",
"]",
")",
")"... | Registers an error template for a specific field and rule
@param string $field The field whose template we're registering
@param string $ruleSlug The rule slug whose template we're registering
@param string $template The template to register | [
"Registers",
"an",
"error",
"template",
"for",
"a",
"specific",
"field",
"and",
"rule"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/Errors/ErrorTemplateRegistry.php#L81-L88 |
opulencephp/Opulence | src/Opulence/Views/Compilers/Fortune/DirectiveTranspilerRegistrant.php | DirectiveTranspilerRegistrant.registerDirectiveTranspilers | public function registerDirectiveTranspilers(ITranspiler $transpiler)
{
$transpiler->registerDirectiveTranspiler('else', function () {
return '<?php else: ?>';
});
$transpiler->registerDirectiveTranspiler('elseif', function ($expression) {
return '<?php elseif' . $exp... | php | public function registerDirectiveTranspilers(ITranspiler $transpiler)
{
$transpiler->registerDirectiveTranspiler('else', function () {
return '<?php else: ?>';
});
$transpiler->registerDirectiveTranspiler('elseif', function ($expression) {
return '<?php elseif' . $exp... | [
"public",
"function",
"registerDirectiveTranspilers",
"(",
"ITranspiler",
"$",
"transpiler",
")",
"{",
"$",
"transpiler",
"->",
"registerDirectiveTranspiler",
"(",
"'else'",
",",
"function",
"(",
")",
"{",
"return",
"'<?php else: ?>'",
";",
"}",
")",
";",
"$",
"... | Registers the Fortune directive transpilers
@param ITranspiler $transpiler The transpiler to register to | [
"Registers",
"the",
"Fortune",
"directive",
"transpilers"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Views/Compilers/Fortune/DirectiveTranspilerRegistrant.php#L23-L126 |
opulencephp/Opulence | src/Opulence/Orm/DataMappers/CachedSqlDataMapper.php | CachedSqlDataMapper.read | protected function read(
string $funcName,
array $getFuncArgs = [],
bool $addDataToCacheOnMiss = true
) {
// Always attempt to retrieve from cache first
$data = $this->cacheDataMapper->$funcName(...$getFuncArgs);
/**
* If an entity wasn't returned or the lis... | php | protected function read(
string $funcName,
array $getFuncArgs = [],
bool $addDataToCacheOnMiss = true
) {
// Always attempt to retrieve from cache first
$data = $this->cacheDataMapper->$funcName(...$getFuncArgs);
/**
* If an entity wasn't returned or the lis... | [
"protected",
"function",
"read",
"(",
"string",
"$",
"funcName",
",",
"array",
"$",
"getFuncArgs",
"=",
"[",
"]",
",",
"bool",
"$",
"addDataToCacheOnMiss",
"=",
"true",
")",
"{",
"// Always attempt to retrieve from cache first",
"$",
"data",
"=",
"$",
"this",
... | Attempts to retrieve an entity(ies) from the cache data mapper before resorting to an SQL database
@param string $funcName The name of the method we want to call on our data mappers
@param array $getFuncArgs The array of function arguments to pass in to our entity retrieval functions
@param bool $addDataToCacheOnMiss ... | [
"Attempts",
"to",
"retrieve",
"an",
"entity",
"(",
"ies",
")",
"from",
"the",
"cache",
"data",
"mapper",
"before",
"resorting",
"to",
"an",
"SQL",
"database"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Orm/DataMappers/CachedSqlDataMapper.php#L197-L230 |
opulencephp/Opulence | src/Opulence/Orm/DataMappers/CachedSqlDataMapper.php | CachedSqlDataMapper.compareCacheAndSqlEntities | private function compareCacheAndSqlEntities(bool $doRefresh) : array
{
// If there was an issue grabbing all entities in cache, null will be returned
$unkeyedCacheEntities = $this->cacheDataMapper->getAll();
if ($unkeyedCacheEntities === null) {
$unkeyedCacheEntities = [];
... | php | private function compareCacheAndSqlEntities(bool $doRefresh) : array
{
// If there was an issue grabbing all entities in cache, null will be returned
$unkeyedCacheEntities = $this->cacheDataMapper->getAll();
if ($unkeyedCacheEntities === null) {
$unkeyedCacheEntities = [];
... | [
"private",
"function",
"compareCacheAndSqlEntities",
"(",
"bool",
"$",
"doRefresh",
")",
":",
"array",
"{",
"// If there was an issue grabbing all entities in cache, null will be returned",
"$",
"unkeyedCacheEntities",
"=",
"$",
"this",
"->",
"cacheDataMapper",
"->",
"getAll"... | Does the comparison of entities in cache to entities in the SQL database
Also performs refresh if the user chooses to do so
@param bool $doRefresh Whether or not to refresh any unsynced entities
@return object[] The list of entities that were not already synced
The "missing" list contains the entities that were not in... | [
"Does",
"the",
"comparison",
"of",
"entities",
"in",
"cache",
"to",
"entities",
"in",
"the",
"SQL",
"database",
"Also",
"performs",
"refresh",
"if",
"the",
"user",
"chooses",
"to",
"do",
"so"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Orm/DataMappers/CachedSqlDataMapper.php#L273-L330 |
opulencephp/Opulence | src/Opulence/Orm/DataMappers/CachedSqlDataMapper.php | CachedSqlDataMapper.keyEntityArray | private function keyEntityArray(array $entities) : array
{
$keyedArray = [];
foreach ($entities as $entity) {
$keyedArray[$this->idAccessorRegistry->getEntityId($entity)] = $entity;
}
return $keyedArray;
} | php | private function keyEntityArray(array $entities) : array
{
$keyedArray = [];
foreach ($entities as $entity) {
$keyedArray[$this->idAccessorRegistry->getEntityId($entity)] = $entity;
}
return $keyedArray;
} | [
"private",
"function",
"keyEntityArray",
"(",
"array",
"$",
"entities",
")",
":",
"array",
"{",
"$",
"keyedArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"entities",
"as",
"$",
"entity",
")",
"{",
"$",
"keyedArray",
"[",
"$",
"this",
"->",
"idAccesso... | Converts a list of entities to a keyed array of those entities
The keys are the entity Ids
@param object[] $entities The list of entities
@return object[] The keyed array | [
"Converts",
"a",
"list",
"of",
"entities",
"to",
"a",
"keyed",
"array",
"of",
"those",
"entities",
"The",
"keys",
"are",
"the",
"entity",
"Ids"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Orm/DataMappers/CachedSqlDataMapper.php#L339-L348 |
opulencephp/Opulence | src/Opulence/Framework/Console/Commands/MakeCommand.php | MakeCommand.compile | protected function compile(string $templateContents, string $fullyQualifiedClassName) : string
{
$explodedClass = explode('\\', $fullyQualifiedClassName);
$namespace = implode('\\', array_slice($explodedClass, 0, -1));
$className = end($explodedClass);
$compiledTemplate = str_replace... | php | protected function compile(string $templateContents, string $fullyQualifiedClassName) : string
{
$explodedClass = explode('\\', $fullyQualifiedClassName);
$namespace = implode('\\', array_slice($explodedClass, 0, -1));
$className = end($explodedClass);
$compiledTemplate = str_replace... | [
"protected",
"function",
"compile",
"(",
"string",
"$",
"templateContents",
",",
"string",
"$",
"fullyQualifiedClassName",
")",
":",
"string",
"{",
"$",
"explodedClass",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"fullyQualifiedClassName",
")",
";",
"$",
"namespac... | Compiles a template
@param string $templateContents The template to compile
@param string $fullyQualifiedClassName The fully-qualified class name
@return string the compiled template | [
"Compiles",
"a",
"template"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Console/Commands/MakeCommand.php#L62-L71 |
opulencephp/Opulence | src/Opulence/Framework/Console/Commands/MakeCommand.php | MakeCommand.makeDirectories | protected function makeDirectories(string $path)
{
$directoryName = dirname($path);
if (!$this->fileSystem->isDirectory($directoryName)) {
$this->fileSystem->makeDirectory($directoryName, 0777, true);
}
} | php | protected function makeDirectories(string $path)
{
$directoryName = dirname($path);
if (!$this->fileSystem->isDirectory($directoryName)) {
$this->fileSystem->makeDirectory($directoryName, 0777, true);
}
} | [
"protected",
"function",
"makeDirectories",
"(",
"string",
"$",
"path",
")",
"{",
"$",
"directoryName",
"=",
"dirname",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"fileSystem",
"->",
"isDirectory",
"(",
"$",
"directoryName",
")",
")",... | Makes the necessary directories for a class
@param string $path The fully-qualified class name | [
"Makes",
"the",
"necessary",
"directories",
"for",
"a",
"class"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Console/Commands/MakeCommand.php#L130-L137 |
opulencephp/Opulence | src/Opulence/Databases/Adapters/Pdo/Statement.php | Statement.bindValues | public function bindValues(array $values)
{
$isAssociativeArray = count(array_filter(array_keys($values), 'is_string')) > 0;
foreach ($values as $parameterName => $value) {
if (!is_array($value)) {
$value = [$value, PDO::PARAM_STR];
}
// If this ... | php | public function bindValues(array $values)
{
$isAssociativeArray = count(array_filter(array_keys($values), 'is_string')) > 0;
foreach ($values as $parameterName => $value) {
if (!is_array($value)) {
$value = [$value, PDO::PARAM_STR];
}
// If this ... | [
"public",
"function",
"bindValues",
"(",
"array",
"$",
"values",
")",
"{",
"$",
"isAssociativeArray",
"=",
"count",
"(",
"array_filter",
"(",
"array_keys",
"(",
"$",
"values",
")",
",",
"'is_string'",
")",
")",
">",
"0",
";",
"foreach",
"(",
"$",
"values... | Binds a list of values to the statement
@param array $values The mapping of parameter name to a value or to an array
If mapping to an array, the first item should be the value and the second should be the data type constant
@return bool True if successful, otherwise false | [
"Binds",
"a",
"list",
"of",
"values",
"to",
"the",
"statement"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Databases/Adapters/Pdo/Statement.php#L53-L73 |
opulencephp/Opulence | src/Opulence/Framework/Databases/Bootstrappers/MigrationBootstrapper.php | MigrationBootstrapper.getExecutedMigrationRepository | protected function getExecutedMigrationRepository(IContainer $container) : IExecutedMigrationRepository
{
$driverClass = getenv('DB_DRIVER') ?: PostgreSqlDriver::class;
switch ($driverClass) {
case MySqlDriver::class:
$queryBuilder = new MySqlQueryBuilder();
... | php | protected function getExecutedMigrationRepository(IContainer $container) : IExecutedMigrationRepository
{
$driverClass = getenv('DB_DRIVER') ?: PostgreSqlDriver::class;
switch ($driverClass) {
case MySqlDriver::class:
$queryBuilder = new MySqlQueryBuilder();
... | [
"protected",
"function",
"getExecutedMigrationRepository",
"(",
"IContainer",
"$",
"container",
")",
":",
"IExecutedMigrationRepository",
"{",
"$",
"driverClass",
"=",
"getenv",
"(",
"'DB_DRIVER'",
")",
"?",
":",
"PostgreSqlDriver",
"::",
"class",
";",
"switch",
"("... | Gets the executed migration repository to use in the migrator
@param IContainer $container The IoC container
@return IExecutedMigrationRepository The executed migration repository
@throws RuntimeException Thrown if there was an error resolving the query builder | [
"Gets",
"the",
"executed",
"migration",
"repository",
"to",
"use",
"in",
"the",
"migrator"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Databases/Bootstrappers/MigrationBootstrapper.php#L67-L94 |
opulencephp/Opulence | src/Opulence/Framework/Databases/Migrations/SqlExecutedMigrationRepository.php | SqlExecutedMigrationRepository.createTableIfDoesNotExist | protected function createTableIfDoesNotExist() : void
{
/**
* Note: This is a somewhat hacky way to determine which database driver we're using
* Ideally, in the future, the query builder will be able to create tables for us
* Until then, we'll infer the database driver from the q... | php | protected function createTableIfDoesNotExist() : void
{
/**
* Note: This is a somewhat hacky way to determine which database driver we're using
* Ideally, in the future, the query builder will be able to create tables for us
* Until then, we'll infer the database driver from the q... | [
"protected",
"function",
"createTableIfDoesNotExist",
"(",
")",
":",
"void",
"{",
"/**\n * Note: This is a somewhat hacky way to determine which database driver we're using\n * Ideally, in the future, the query builder will be able to create tables for us\n * Until then, we'l... | Creates the table that the migrations are stored in
@throws RuntimeException Thrown if the query builder wasn't a MySQL or PostgreSQL query builder | [
"Creates",
"the",
"table",
"that",
"the",
"migrations",
"are",
"stored",
"in"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Databases/Migrations/SqlExecutedMigrationRepository.php#L128-L152 |
opulencephp/Opulence | src/Opulence/Console/Responses/Formatters/CommandFormatter.php | CommandFormatter.format | public function format(ICommand $command) : string
{
$text = $command->getName() . ' ';
// Output the options
foreach ($command->getOptions() as $option) {
$text .= $this->formatOption($option) . ' ';
}
/** @var Argument[] $requiredArguments */
$required... | php | public function format(ICommand $command) : string
{
$text = $command->getName() . ' ';
// Output the options
foreach ($command->getOptions() as $option) {
$text .= $this->formatOption($option) . ' ';
}
/** @var Argument[] $requiredArguments */
$required... | [
"public",
"function",
"format",
"(",
"ICommand",
"$",
"command",
")",
":",
"string",
"{",
"$",
"text",
"=",
"$",
"command",
"->",
"getName",
"(",
")",
".",
"' '",
";",
"// Output the options",
"foreach",
"(",
"$",
"command",
"->",
"getOptions",
"(",
")",... | Gets the command as text
@param ICommand $command The command to convert
@return string The command as text | [
"Gets",
"the",
"command",
"as",
"text"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Console/Responses/Formatters/CommandFormatter.php#L28-L73 |
opulencephp/Opulence | src/Opulence/Console/Responses/Formatters/CommandFormatter.php | CommandFormatter.formatArrayArgument | private function formatArrayArgument(Argument $argument) : string
{
$arrayArgumentTextOne = $argument->getName() . '1';
$arrayArgumentTextN = $argument->getName() . 'N';
if ($argument->isOptional()) {
$arrayArgumentTextOne = "[$arrayArgumentTextOne]";
$arrayArgumentT... | php | private function formatArrayArgument(Argument $argument) : string
{
$arrayArgumentTextOne = $argument->getName() . '1';
$arrayArgumentTextN = $argument->getName() . 'N';
if ($argument->isOptional()) {
$arrayArgumentTextOne = "[$arrayArgumentTextOne]";
$arrayArgumentT... | [
"private",
"function",
"formatArrayArgument",
"(",
"Argument",
"$",
"argument",
")",
":",
"string",
"{",
"$",
"arrayArgumentTextOne",
"=",
"$",
"argument",
"->",
"getName",
"(",
")",
".",
"'1'",
";",
"$",
"arrayArgumentTextN",
"=",
"$",
"argument",
"->",
"ge... | Formats an array argument
@param Argument $argument The argument to format
@return string The formatted array argument | [
"Formats",
"an",
"array",
"argument"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Console/Responses/Formatters/CommandFormatter.php#L81-L92 |
opulencephp/Opulence | src/Opulence/Console/Responses/Formatters/CommandFormatter.php | CommandFormatter.formatOption | private function formatOption(Option $option) : string
{
$text = "[--{$option->getName()}";
if ($option->valueIsOptional()) {
$text .= '=' . $option->getDefaultValue();
}
if ($option->getShortName() !== null) {
$text .= "|-{$option->getShortName()}";
... | php | private function formatOption(Option $option) : string
{
$text = "[--{$option->getName()}";
if ($option->valueIsOptional()) {
$text .= '=' . $option->getDefaultValue();
}
if ($option->getShortName() !== null) {
$text .= "|-{$option->getShortName()}";
... | [
"private",
"function",
"formatOption",
"(",
"Option",
"$",
"option",
")",
":",
"string",
"{",
"$",
"text",
"=",
"\"[--{$option->getName()}\"",
";",
"if",
"(",
"$",
"option",
"->",
"valueIsOptional",
"(",
")",
")",
"{",
"$",
"text",
".=",
"'='",
".",
"$",... | Formats an option
@param Option $option The option to format
@return string The formatted option | [
"Formats",
"an",
"option"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Console/Responses/Formatters/CommandFormatter.php#L100-L115 |
opulencephp/Opulence | src/Opulence/Routing/Dispatchers/RouteDispatcher.php | RouteDispatcher.callController | private function callController($controller, CompiledRoute $route) : Response
{
if (is_callable($controller)) {
try {
$reflection = new ReflectionFunction($controller);
} catch (\ReflectionException $e) {
throw new RouteException("Function {$controller... | php | private function callController($controller, CompiledRoute $route) : Response
{
if (is_callable($controller)) {
try {
$reflection = new ReflectionFunction($controller);
} catch (\ReflectionException $e) {
throw new RouteException("Function {$controller... | [
"private",
"function",
"callController",
"(",
"$",
"controller",
",",
"CompiledRoute",
"$",
"route",
")",
":",
"Response",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"controller",
")",
")",
"{",
"try",
"{",
"$",
"reflection",
"=",
"new",
"ReflectionFunction",
... | Calls the method on the input controller
@param Controller|Closure|mixed $controller The instance of the controller to call
@param CompiledRoute $route The route being dispatched
@return Response Returns the value from the controller method
@throws RouteException Thrown if the method could not be called on the control... | [
"Calls",
"the",
"method",
"on",
"the",
"input",
"controller"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Routing/Dispatchers/RouteDispatcher.php#L75-L122 |
opulencephp/Opulence | src/Opulence/Routing/Dispatchers/RouteDispatcher.php | RouteDispatcher.resolveController | private function resolveController(string $controllerName, Request $request)
{
if (!class_exists($controllerName)) {
throw new RouteException("Controller class $controllerName does not exist");
}
$controller = $this->dependencyResolver->resolve($controllerName);
if ($co... | php | private function resolveController(string $controllerName, Request $request)
{
if (!class_exists($controllerName)) {
throw new RouteException("Controller class $controllerName does not exist");
}
$controller = $this->dependencyResolver->resolve($controllerName);
if ($co... | [
"private",
"function",
"resolveController",
"(",
"string",
"$",
"controllerName",
",",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"controllerName",
")",
")",
"{",
"throw",
"new",
"RouteException",
"(",
"\"Controller class $con... | Creates an instance of the input controller
@param string $controllerName The fully-qualified name of the controller class to instantiate
@param Request $request The request that's being routed
@return Controller|mixed The instantiated controller
@throws RouteException Thrown if the controller could not be instantiate... | [
"Creates",
"an",
"instance",
"of",
"the",
"input",
"controller"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Routing/Dispatchers/RouteDispatcher.php#L132-L161 |
opulencephp/Opulence | src/Opulence/Routing/Dispatchers/RouteDispatcher.php | RouteDispatcher.resolveControllerParameters | private function resolveControllerParameters(
array $reflectionParameters,
array $pathVars,
CompiledRoute $route,
bool $acceptObjectParameters
) : array {
$resolvedParameters = [];
// Match the route variables to the method parameters
foreach ($reflectionPara... | php | private function resolveControllerParameters(
array $reflectionParameters,
array $pathVars,
CompiledRoute $route,
bool $acceptObjectParameters
) : array {
$resolvedParameters = [];
// Match the route variables to the method parameters
foreach ($reflectionPara... | [
"private",
"function",
"resolveControllerParameters",
"(",
"array",
"$",
"reflectionParameters",
",",
"array",
"$",
"pathVars",
",",
"CompiledRoute",
"$",
"route",
",",
"bool",
"$",
"acceptObjectParameters",
")",
":",
"array",
"{",
"$",
"resolvedParameters",
"=",
... | Gets the resolved parameters for a controller
@param ReflectionParameter[] $reflectionParameters The reflection parameters
@param array $pathVars The route path variables
@param CompiledRoute $route The route whose parameters we're resolving
@param bool $acceptObjectParameters Whether or not we'll accept objects as pa... | [
"Gets",
"the",
"resolved",
"parameters",
"for",
"a",
"controller"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Routing/Dispatchers/RouteDispatcher.php#L173-L201 |
opulencephp/Opulence | src/Opulence/Routing/Dispatchers/RouteDispatcher.php | RouteDispatcher.resolveMiddleware | private function resolveMiddleware(array $middleware) : array
{
$resolvedMiddleware = [];
foreach ($middleware as $singleMiddleware) {
if ($singleMiddleware instanceof MiddlewareParameters) {
/** @var MiddlewareParameters $singleMiddleware */
/** @var Par... | php | private function resolveMiddleware(array $middleware) : array
{
$resolvedMiddleware = [];
foreach ($middleware as $singleMiddleware) {
if ($singleMiddleware instanceof MiddlewareParameters) {
/** @var MiddlewareParameters $singleMiddleware */
/** @var Par... | [
"private",
"function",
"resolveMiddleware",
"(",
"array",
"$",
"middleware",
")",
":",
"array",
"{",
"$",
"resolvedMiddleware",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"middleware",
"as",
"$",
"singleMiddleware",
")",
"{",
"if",
"(",
"$",
"singleMiddleware"... | Resolves the list of middleware
@param array $middleware The middleware to resolve
@return IMiddleware[] The list of resolved middleware | [
"Resolves",
"the",
"list",
"of",
"middleware"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Routing/Dispatchers/RouteDispatcher.php#L209-L228 |
opulencephp/Opulence | src/Opulence/Views/Caching/FileCache.php | FileCache.getCompiledViewPaths | private function getCompiledViewPaths(string $path) : array
{
if (!is_dir($path)) {
return [];
}
$files = [];
$iter = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIte... | php | private function getCompiledViewPaths(string $path) : array
{
if (!is_dir($path)) {
return [];
}
$files = [];
$iter = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIte... | [
"private",
"function",
"getCompiledViewPaths",
"(",
"string",
"$",
"path",
")",
":",
"array",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"files",
"=",
"[",
"]",
";",
"$",
"iter",
"=",
"new",... | Gets a list of view file paths that appear
@param string $path The path to search
@return array The list of view paths | [
"Gets",
"a",
"list",
"of",
"view",
"file",
"paths",
"that",
"appear"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Views/Caching/FileCache.php#L173-L194 |
opulencephp/Opulence | src/Opulence/Views/Caching/FileCache.php | FileCache.getViewPath | private function getViewPath(IView $view, bool $checkVars) : string
{
$data = ['u' => $view->getContents()];
if ($checkVars) {
$data['v'] = $view->getVars();
}
return $this->path . '/' . md5(http_build_query($data));
} | php | private function getViewPath(IView $view, bool $checkVars) : string
{
$data = ['u' => $view->getContents()];
if ($checkVars) {
$data['v'] = $view->getVars();
}
return $this->path . '/' . md5(http_build_query($data));
} | [
"private",
"function",
"getViewPath",
"(",
"IView",
"$",
"view",
",",
"bool",
"$",
"checkVars",
")",
":",
"string",
"{",
"$",
"data",
"=",
"[",
"'u'",
"=>",
"$",
"view",
"->",
"getContents",
"(",
")",
"]",
";",
"if",
"(",
"$",
"checkVars",
")",
"{"... | Gets path to cached view
@param IView $view The view whose cached file path we want
@param bool $checkVars Whether or not we want to also check for variable value equivalence when looking up cached views
@return string The path to the cached view | [
"Gets",
"path",
"to",
"cached",
"view"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Views/Caching/FileCache.php#L203-L212 |
opulencephp/Opulence | src/Opulence/Views/Caching/FileCache.php | FileCache.isExpired | private function isExpired(string $viewPath) : bool
{
$lastModified = DateTime::createFromFormat('U', filemtime($viewPath));
return $lastModified < new DateTime('-' . $this->lifetime . ' seconds');
} | php | private function isExpired(string $viewPath) : bool
{
$lastModified = DateTime::createFromFormat('U', filemtime($viewPath));
return $lastModified < new DateTime('-' . $this->lifetime . ' seconds');
} | [
"private",
"function",
"isExpired",
"(",
"string",
"$",
"viewPath",
")",
":",
"bool",
"{",
"$",
"lastModified",
"=",
"DateTime",
"::",
"createFromFormat",
"(",
"'U'",
",",
"filemtime",
"(",
"$",
"viewPath",
")",
")",
";",
"return",
"$",
"lastModified",
"<"... | Checks whether or not a view path is expired
@param string $viewPath The view path to check
@return bool True if the path is expired, otherwise false | [
"Checks",
"whether",
"or",
"not",
"a",
"view",
"path",
"is",
"expired"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Views/Caching/FileCache.php#L220-L225 |
opulencephp/Opulence | src/Opulence/Http/Headers.php | Headers.add | public function add(string $name, $values, bool $shouldReplace = true)
{
$this->set($name, $values, $shouldReplace);
} | php | public function add(string $name, $values, bool $shouldReplace = true)
{
$this->set($name, $values, $shouldReplace);
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"name",
",",
"$",
"values",
",",
"bool",
"$",
"shouldReplace",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"name",
",",
"$",
"values",
",",
"$",
"shouldReplace",
")",
";",
"}"
] | Headers are allowed to have multiple values, so we must add support for that
@inheritdoc
@param string|array $values The value or values
@param bool $shouldReplace Whether or not to replace the value | [
"Headers",
"are",
"allowed",
"to",
"have",
"multiple",
"values",
"so",
"we",
"must",
"add",
"support",
"for",
"that"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Http/Headers.php#L46-L49 |
opulencephp/Opulence | src/Opulence/Http/Headers.php | Headers.set | public function set(string $name, $values, bool $shouldReplace = true)
{
$name = $this->normalizeName($name);
$values = (array)$values;
if ($shouldReplace || !$this->has($name)) {
parent::set($name, $values);
} else {
parent::set($name, array_merge($this->val... | php | public function set(string $name, $values, bool $shouldReplace = true)
{
$name = $this->normalizeName($name);
$values = (array)$values;
if ($shouldReplace || !$this->has($name)) {
parent::set($name, $values);
} else {
parent::set($name, array_merge($this->val... | [
"public",
"function",
"set",
"(",
"string",
"$",
"name",
",",
"$",
"values",
",",
"bool",
"$",
"shouldReplace",
"=",
"true",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"normalizeName",
"(",
"$",
"name",
")",
";",
"$",
"values",
"=",
"(",
"array... | Headers are allowed to have multiple values, so we must add support for that
@inheritdoc
@param string|array $values The value or values
@param bool $shouldReplace Whether or not to replace the value | [
"Headers",
"are",
"allowed",
"to",
"have",
"multiple",
"values",
"so",
"we",
"must",
"add",
"support",
"for",
"that"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Http/Headers.php#L93-L103 |
opulencephp/Opulence | src/Opulence/Console/Commands/AboutCommand.php | AboutCommand.getCommandText | private function getCommandText() : string
{
if (count($this->commandCollection->getAll()) === 0) {
return ' <info>No commands</info>';
}
/**
* Sorts the commands by name
* Uncategorized (commands without ":" in their names) always come first
*
... | php | private function getCommandText() : string
{
if (count($this->commandCollection->getAll()) === 0) {
return ' <info>No commands</info>';
}
/**
* Sorts the commands by name
* Uncategorized (commands without ":" in their names) always come first
*
... | [
"private",
"function",
"getCommandText",
"(",
")",
":",
"string",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"commandCollection",
"->",
"getAll",
"(",
")",
")",
"===",
"0",
")",
"{",
"return",
"' <info>No commands</info>'",
";",
"}",
"/**\n * ... | Converts commands to text
@return string The commands as text | [
"Converts",
"commands",
"to",
"text"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Console/Commands/AboutCommand.php#L74-L142 |
opulencephp/Opulence | src/Opulence/Framework/Sessions/Http/Middleware/Session.php | Session.startSession | protected function startSession(Request $request)
{
$this->gc();
$this->session->setId($request->getCookies()->get($this->session->getName()));
$this->sessionHandler->open(null, $this->session->getName());
$sessionVars = @unserialize($this->sessionHandler->read($this->session->getId(... | php | protected function startSession(Request $request)
{
$this->gc();
$this->session->setId($request->getCookies()->get($this->session->getName()));
$this->sessionHandler->open(null, $this->session->getName());
$sessionVars = @unserialize($this->sessionHandler->read($this->session->getId(... | [
"protected",
"function",
"startSession",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"gc",
"(",
")",
";",
"$",
"this",
"->",
"session",
"->",
"setId",
"(",
"$",
"request",
"->",
"getCookies",
"(",
")",
"->",
"get",
"(",
"$",
"this",
... | Starts the session
@param Request $request The current request | [
"Starts",
"the",
"session"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Sessions/Http/Middleware/Session.php#L86-L98 |
opulencephp/Opulence | src/Opulence/Framework/Sessions/Http/Middleware/Session.php | Session.writeSession | protected function writeSession(Response $response)
{
$this->session->ageFlashData();
$this->sessionHandler->write($this->session->getId(), serialize($this->session->getAll()));
$this->writeToResponse($response);
} | php | protected function writeSession(Response $response)
{
$this->session->ageFlashData();
$this->sessionHandler->write($this->session->getId(), serialize($this->session->getAll()));
$this->writeToResponse($response);
} | [
"protected",
"function",
"writeSession",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"session",
"->",
"ageFlashData",
"(",
")",
";",
"$",
"this",
"->",
"sessionHandler",
"->",
"write",
"(",
"$",
"this",
"->",
"session",
"->",
"getId",
... | Writes the session data to the response
@param Response $response The response | [
"Writes",
"the",
"session",
"data",
"to",
"the",
"response"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Framework/Sessions/Http/Middleware/Session.php#L105-L110 |
opulencephp/Opulence | src/Opulence/Validation/Rules/RuleExtensionRegistry.php | RuleExtensionRegistry.getRule | public function getRule(string $ruleName) : IRule
{
if (!$this->hasRule($ruleName)) {
throw new InvalidArgumentException("No rule extension with name \"$ruleName\" found");
}
return $this->extensions[$ruleName];
} | php | public function getRule(string $ruleName) : IRule
{
if (!$this->hasRule($ruleName)) {
throw new InvalidArgumentException("No rule extension with name \"$ruleName\" found");
}
return $this->extensions[$ruleName];
} | [
"public",
"function",
"getRule",
"(",
"string",
"$",
"ruleName",
")",
":",
"IRule",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRule",
"(",
"$",
"ruleName",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"No rule extension with name \\\"$rul... | Gets the rule extension with the input name
@param string $ruleName The name of the rule
@return IRule The rule extension
@throws InvalidArgumentException Thrown if no extension is registered with the name | [
"Gets",
"the",
"rule",
"extension",
"with",
"the",
"input",
"name"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/RuleExtensionRegistry.php#L30-L37 |
opulencephp/Opulence | src/Opulence/Validation/Rules/RuleExtensionRegistry.php | RuleExtensionRegistry.registerRuleExtension | public function registerRuleExtension($rule, string $slug = '')
{
if ($rule instanceof IRule) {
$slug = $rule->getSlug();
}
if (is_callable($rule)) {
$callback = $rule;
$rule = new CallbackRule();
$rule->setArgs([$callback]);
}
... | php | public function registerRuleExtension($rule, string $slug = '')
{
if ($rule instanceof IRule) {
$slug = $rule->getSlug();
}
if (is_callable($rule)) {
$callback = $rule;
$rule = new CallbackRule();
$rule->setArgs([$callback]);
}
... | [
"public",
"function",
"registerRuleExtension",
"(",
"$",
"rule",
",",
"string",
"$",
"slug",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"rule",
"instanceof",
"IRule",
")",
"{",
"$",
"slug",
"=",
"$",
"rule",
"->",
"getSlug",
"(",
")",
";",
"}",
"if",
"("... | Registers a rule extension
@param IRule|callable $rule Either the rule object or callback (that accepts a value and list of all values) and
returns true if the rule passes, otherwise false
@param string $slug The slug name of the rule (only used if the rule is a callback)
@throws InvalidArgumentException Thrown if the... | [
"Registers",
"a",
"rule",
"extension"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Validation/Rules/RuleExtensionRegistry.php#L58-L75 |
opulencephp/Opulence | src/Opulence/Ioc/Container.php | Container.addBinding | protected function addBinding(string $interface, IBinding $binding)
{
if (!isset($this->bindings[$this->currentTarget])) {
$this->bindings[$this->currentTarget] = [];
}
$this->bindings[$this->currentTarget][$interface] = $binding;
} | php | protected function addBinding(string $interface, IBinding $binding)
{
if (!isset($this->bindings[$this->currentTarget])) {
$this->bindings[$this->currentTarget] = [];
}
$this->bindings[$this->currentTarget][$interface] = $binding;
} | [
"protected",
"function",
"addBinding",
"(",
"string",
"$",
"interface",
",",
"IBinding",
"$",
"binding",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"bindings",
"[",
"$",
"this",
"->",
"currentTarget",
"]",
")",
")",
"{",
"$",
"this",
... | Adds a binding to an interface
@param string $interface The interface to bind to
@param IBinding $binding The binding to add | [
"Adds",
"a",
"binding",
"to",
"an",
"interface"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Ioc/Container.php#L204-L211 |
opulencephp/Opulence | src/Opulence/Ioc/Container.php | Container.getBinding | protected function getBinding(string $interface)
{
// If there's a targeted binding, use it
if ($this->currentTarget !== self::$emptyTarget && isset($this->bindings[$this->currentTarget][$interface])) {
return $this->bindings[$this->currentTarget][$interface];
}
// If th... | php | protected function getBinding(string $interface)
{
// If there's a targeted binding, use it
if ($this->currentTarget !== self::$emptyTarget && isset($this->bindings[$this->currentTarget][$interface])) {
return $this->bindings[$this->currentTarget][$interface];
}
// If th... | [
"protected",
"function",
"getBinding",
"(",
"string",
"$",
"interface",
")",
"{",
"// If there's a targeted binding, use it",
"if",
"(",
"$",
"this",
"->",
"currentTarget",
"!==",
"self",
"::",
"$",
"emptyTarget",
"&&",
"isset",
"(",
"$",
"this",
"->",
"bindings... | Gets a binding for an interface
@param string $interface The interface whose binding we want
@return IBinding|null The binding if one exists, otherwise null | [
"Gets",
"a",
"binding",
"for",
"an",
"interface"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Ioc/Container.php#L219-L232 |
opulencephp/Opulence | src/Opulence/Ioc/Container.php | Container.hasTargetedBinding | protected function hasTargetedBinding(string $interface, string $target = null) : bool
{
return isset($this->bindings[$target][$interface]);
} | php | protected function hasTargetedBinding(string $interface, string $target = null) : bool
{
return isset($this->bindings[$target][$interface]);
} | [
"protected",
"function",
"hasTargetedBinding",
"(",
"string",
"$",
"interface",
",",
"string",
"$",
"target",
"=",
"null",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"bindings",
"[",
"$",
"target",
"]",
"[",
"$",
"interface",
"]",
... | Gets whether or not a targeted binding exists
@param string $interface The interface to check
@param string|null $target The target whose bindings we're checking
@return bool True if the targeted binding exists, otherwise false | [
"Gets",
"whether",
"or",
"not",
"a",
"targeted",
"binding",
"exists"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Ioc/Container.php#L241-L244 |
opulencephp/Opulence | src/Opulence/Ioc/Container.php | Container.resolveClass | protected function resolveClass(string $class, array $primitives = [])
{
try {
if (isset($this->constructorReflectionCache[$class])) {
list($constructor, $parameters) = $this->constructorReflectionCache[$class];
} else {
$reflectionClass = new Reflecti... | php | protected function resolveClass(string $class, array $primitives = [])
{
try {
if (isset($this->constructorReflectionCache[$class])) {
list($constructor, $parameters) = $this->constructorReflectionCache[$class];
} else {
$reflectionClass = new Reflecti... | [
"protected",
"function",
"resolveClass",
"(",
"string",
"$",
"class",
",",
"array",
"$",
"primitives",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"constructorReflectionCache",
"[",
"$",
"class",
"]",
")",
")",
"{",... | Resolves a class
@param string $class The class name to resolve
@param array $primitives The list of constructor primitives
@return object The resolved class
@throws IocException Thrown if the class could not be resolved | [
"Resolves",
"a",
"class"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Ioc/Container.php#L254-L287 |
opulencephp/Opulence | src/Opulence/Ioc/Container.php | Container.resolveParameters | protected function resolveParameters(
$class,
array $unresolvedParameters,
array $primitives
) : array {
$resolvedParameters = [];
foreach ($unresolvedParameters as $parameter) {
$resolvedParameter = null;
if ($parameter->getClass() === null) {
... | php | protected function resolveParameters(
$class,
array $unresolvedParameters,
array $primitives
) : array {
$resolvedParameters = [];
foreach ($unresolvedParameters as $parameter) {
$resolvedParameter = null;
if ($parameter->getClass() === null) {
... | [
"protected",
"function",
"resolveParameters",
"(",
"$",
"class",
",",
"array",
"$",
"unresolvedParameters",
",",
"array",
"$",
"primitives",
")",
":",
"array",
"{",
"$",
"resolvedParameters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"unresolvedParameters",
"as... | Resolves a list of parameters for a function call
@param string|null $class The name of the class whose parameters we're resolving
@param ReflectionParameter[] $unresolvedParameters The list of unresolved parameters
@param array $primitives The list of primitive values
@return array The list of parameters with all the... | [
"Resolves",
"a",
"list",
"of",
"parameters",
"for",
"a",
"function",
"call"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Ioc/Container.php#L298-L333 |
opulencephp/Opulence | src/Opulence/Ioc/Container.php | Container.resolvePrimitive | protected function resolvePrimitive(ReflectionParameter $parameter, array &$primitives)
{
if (count($primitives) > 0) {
// Grab the next primitive
return array_shift($primitives);
}
if ($parameter->isDefaultValueAvailable()) {
// No value was found, so us... | php | protected function resolvePrimitive(ReflectionParameter $parameter, array &$primitives)
{
if (count($primitives) > 0) {
// Grab the next primitive
return array_shift($primitives);
}
if ($parameter->isDefaultValueAvailable()) {
// No value was found, so us... | [
"protected",
"function",
"resolvePrimitive",
"(",
"ReflectionParameter",
"$",
"parameter",
",",
"array",
"&",
"$",
"primitives",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"primitives",
")",
">",
"0",
")",
"{",
"// Grab the next primitive",
"return",
"array_shift",... | Resolves a primitive parameter
@param ReflectionParameter $parameter The primitive parameter to resolve
@param array $primitives The list of primitive values
@return mixed The resolved primitive
@throws IocException Thrown if there was a problem resolving the primitive | [
"Resolves",
"a",
"primitive",
"parameter"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/Ioc/Container.php#L343-L360 |
opulencephp/Opulence | src/Opulence/QueryBuilders/SelectQuery.php | SelectQuery.addGroupBy | public function addGroupBy(string ...$expression) : self
{
$this->groupByClauses = array_merge($this->groupByClauses, $expression);
return $this;
} | php | public function addGroupBy(string ...$expression) : self
{
$this->groupByClauses = array_merge($this->groupByClauses, $expression);
return $this;
} | [
"public",
"function",
"addGroupBy",
"(",
"string",
"...",
"$",
"expression",
")",
":",
"self",
"{",
"$",
"this",
"->",
"groupByClauses",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"groupByClauses",
",",
"$",
"expression",
")",
";",
"return",
"$",
"this",
... | Adds to a "GROUP BY" clause
@param string[] $expression,... A variable list of expressions of what to group by
@return self For method chaining | [
"Adds",
"to",
"a",
"GROUP",
"BY",
"clause"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/SelectQuery.php#L53-L58 |
opulencephp/Opulence | src/Opulence/QueryBuilders/SelectQuery.php | SelectQuery.addOrderBy | public function addOrderBy(string ...$expression) : self
{
$this->orderBy = array_merge($this->orderBy, $expression);
return $this;
} | php | public function addOrderBy(string ...$expression) : self
{
$this->orderBy = array_merge($this->orderBy, $expression);
return $this;
} | [
"public",
"function",
"addOrderBy",
"(",
"string",
"...",
"$",
"expression",
")",
":",
"self",
"{",
"$",
"this",
"->",
"orderBy",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"orderBy",
",",
"$",
"expression",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Adds to a "ORDER BY" clause
@param string[] $expression,... A variable list of expressions to order by
@return self For method chaining | [
"Adds",
"to",
"a",
"ORDER",
"BY",
"clause"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/SelectQuery.php#L66-L71 |
opulencephp/Opulence | src/Opulence/QueryBuilders/SelectQuery.php | SelectQuery.addSelectExpression | public function addSelectExpression(string ...$expression) : self
{
$this->selectExpressions = array_merge($this->selectExpressions, $expression);
return $this;
} | php | public function addSelectExpression(string ...$expression) : self
{
$this->selectExpressions = array_merge($this->selectExpressions, $expression);
return $this;
} | [
"public",
"function",
"addSelectExpression",
"(",
"string",
"...",
"$",
"expression",
")",
":",
"self",
"{",
"$",
"this",
"->",
"selectExpressions",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"selectExpressions",
",",
"$",
"expression",
")",
";",
"return",
... | Adds more select expressions
@param string[] $expression,... A variable list of select expressions
@return self For method chaining | [
"Adds",
"more",
"select",
"expressions"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/SelectQuery.php#L79-L84 |
opulencephp/Opulence | src/Opulence/QueryBuilders/SelectQuery.php | SelectQuery.andHaving | public function andHaving(...$conditions) : self
{
$this->havingConditions = $this->conditionalQueryBuilder->addConditionToClause(
$this->havingConditions, 'AND', ...$this->createConditionExpressions($conditions)
);
return $this;
} | php | public function andHaving(...$conditions) : self
{
$this->havingConditions = $this->conditionalQueryBuilder->addConditionToClause(
$this->havingConditions, 'AND', ...$this->createConditionExpressions($conditions)
);
return $this;
} | [
"public",
"function",
"andHaving",
"(",
"...",
"$",
"conditions",
")",
":",
"self",
"{",
"$",
"this",
"->",
"havingConditions",
"=",
"$",
"this",
"->",
"conditionalQueryBuilder",
"->",
"addConditionToClause",
"(",
"$",
"this",
"->",
"havingConditions",
",",
"'... | Adds to a "HAVING" condition that will be "AND"ed with other conditions
@param array $conditions,... A variable list of conditions to be met
@return self For method chaining | [
"Adds",
"to",
"a",
"HAVING",
"condition",
"that",
"will",
"be",
"AND",
"ed",
"with",
"other",
"conditions"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/SelectQuery.php#L92-L99 |
opulencephp/Opulence | src/Opulence/QueryBuilders/SelectQuery.php | SelectQuery.from | public function from(string $tableName, string $tableAlias = '') : self
{
$this->setTable($tableName, $tableAlias);
return $this;
} | php | public function from(string $tableName, string $tableAlias = '') : self
{
$this->setTable($tableName, $tableAlias);
return $this;
} | [
"public",
"function",
"from",
"(",
"string",
"$",
"tableName",
",",
"string",
"$",
"tableAlias",
"=",
"''",
")",
":",
"self",
"{",
"$",
"this",
"->",
"setTable",
"(",
"$",
"tableName",
",",
"$",
"tableAlias",
")",
";",
"return",
"$",
"this",
";",
"}"... | Specifies which table we're selecting from
@param string $tableName The name of the table we're selecting from
@param string $tableAlias The alias of the table name
@return self For method chaining | [
"Specifies",
"which",
"table",
"we",
"re",
"selecting",
"from"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/SelectQuery.php#L123-L128 |
opulencephp/Opulence | src/Opulence/QueryBuilders/SelectQuery.php | SelectQuery.having | public function having(...$conditions) : self
{
// We want to wipe out anything already in the condition list
$this->havingConditions = [];
$this->havingConditions = $this->conditionalQueryBuilder->addConditionToClause(
$this->havingConditions, 'AND', ...$this->createConditionExp... | php | public function having(...$conditions) : self
{
// We want to wipe out anything already in the condition list
$this->havingConditions = [];
$this->havingConditions = $this->conditionalQueryBuilder->addConditionToClause(
$this->havingConditions, 'AND', ...$this->createConditionExp... | [
"public",
"function",
"having",
"(",
"...",
"$",
"conditions",
")",
":",
"self",
"{",
"// We want to wipe out anything already in the condition list",
"$",
"this",
"->",
"havingConditions",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"havingConditions",
"=",
"$",
"this... | Starts a "HAVING" condition
Only call this method once per query because it will overwrite any previously-set "HAVING" expressions
@param array $conditions,... A variable list of conditions to be met
@return self For method chaining | [
"Starts",
"a",
"HAVING",
"condition",
"Only",
"call",
"this",
"method",
"once",
"per",
"query",
"because",
"it",
"will",
"overwrite",
"any",
"previously",
"-",
"set",
"HAVING",
"expressions"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/SelectQuery.php#L199-L208 |
opulencephp/Opulence | src/Opulence/QueryBuilders/SelectQuery.php | SelectQuery.innerJoin | public function innerJoin(string $tableName, string $tableAlias, string $condition) : self
{
$this->joins['inner'][] = ['tableName' => $tableName, 'tableAlias' => $tableAlias, 'condition' => $condition];
return $this;
} | php | public function innerJoin(string $tableName, string $tableAlias, string $condition) : self
{
$this->joins['inner'][] = ['tableName' => $tableName, 'tableAlias' => $tableAlias, 'condition' => $condition];
return $this;
} | [
"public",
"function",
"innerJoin",
"(",
"string",
"$",
"tableName",
",",
"string",
"$",
"tableAlias",
",",
"string",
"$",
"condition",
")",
":",
"self",
"{",
"$",
"this",
"->",
"joins",
"[",
"'inner'",
"]",
"[",
"]",
"=",
"[",
"'tableName'",
"=>",
"$",... | Adds a inner join to the query
@param string $tableName The name of the table we're joining
@param string $tableAlias The alias of the table name
@param string $condition The "ON" portion of the join
@return self For method chaining | [
"Adds",
"a",
"inner",
"join",
"to",
"the",
"query"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/SelectQuery.php#L218-L223 |
opulencephp/Opulence | src/Opulence/QueryBuilders/SelectQuery.php | SelectQuery.join | public function join(string $tableName, string $tableAlias, string $condition) : self
{
return $this->innerJoin($tableName, $tableAlias, $condition);
} | php | public function join(string $tableName, string $tableAlias, string $condition) : self
{
return $this->innerJoin($tableName, $tableAlias, $condition);
} | [
"public",
"function",
"join",
"(",
"string",
"$",
"tableName",
",",
"string",
"$",
"tableAlias",
",",
"string",
"$",
"condition",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"innerJoin",
"(",
"$",
"tableName",
",",
"$",
"tableAlias",
",",
"$",
... | Adds a join to the query
This is the same thing as an inner join
@param string $tableName The name of the table we're joining
@param string $tableAlias The alias of the table name
@param string $condition The "ON" portion of the join
@return self For method chaining | [
"Adds",
"a",
"join",
"to",
"the",
"query",
"This",
"is",
"the",
"same",
"thing",
"as",
"an",
"inner",
"join"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/SelectQuery.php#L234-L237 |
opulencephp/Opulence | src/Opulence/QueryBuilders/SelectQuery.php | SelectQuery.leftJoin | public function leftJoin(string $tableName, string $tableAlias, string $condition) : self
{
$this->joins['left'][] = ['tableName' => $tableName, 'tableAlias' => $tableAlias, 'condition' => $condition];
return $this;
} | php | public function leftJoin(string $tableName, string $tableAlias, string $condition) : self
{
$this->joins['left'][] = ['tableName' => $tableName, 'tableAlias' => $tableAlias, 'condition' => $condition];
return $this;
} | [
"public",
"function",
"leftJoin",
"(",
"string",
"$",
"tableName",
",",
"string",
"$",
"tableAlias",
",",
"string",
"$",
"condition",
")",
":",
"self",
"{",
"$",
"this",
"->",
"joins",
"[",
"'left'",
"]",
"[",
"]",
"=",
"[",
"'tableName'",
"=>",
"$",
... | Adds a left join to the query
@param string $tableName The name of the table we're joining
@param string $tableAlias The alias of the table name
@param string $condition The "ON" portion of the join
@return self For method chaining | [
"Adds",
"a",
"left",
"join",
"to",
"the",
"query"
] | train | https://github.com/opulencephp/Opulence/blob/27c86747f893a78ab0bc9b8a90aae3cad6e7afb5/src/Opulence/QueryBuilders/SelectQuery.php#L247-L252 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.