id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
43,300 | rips/php-connector | src/Requests/ApplicationRequests.php | ApplicationRequests.uploads | public function uploads()
{
if (is_null($this->uploadRequests)) {
$this->uploadRequests = new UploadRequests($this->client);
}
return $this->uploadRequests;
} | php | public function uploads()
{
if (is_null($this->uploadRequests)) {
$this->uploadRequests = new UploadRequests($this->client);
}
return $this->uploadRequests;
} | [
"public",
"function",
"uploads",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"uploadRequests",
")",
")",
"{",
"$",
"this",
"->",
"uploadRequests",
"=",
"new",
"UploadRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
"return",... | Upload requests accessor
@return UploadRequests | [
"Upload",
"requests",
"accessor"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/ApplicationRequests.php#L194-L201 |
43,301 | rips/php-connector | src/Requests/OAuth2Requests.php | OAuth2Requests.clients | public function clients()
{
if (is_null($this->clientRequests)) {
$this->clientRequests = new ClientRequests($this->client);
}
return $this->clientRequests;
} | php | public function clients()
{
if (is_null($this->clientRequests)) {
$this->clientRequests = new ClientRequests($this->client);
}
return $this->clientRequests;
} | [
"public",
"function",
"clients",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"clientRequests",
")",
")",
"{",
"$",
"this",
"->",
"clientRequests",
"=",
"new",
"ClientRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
"return",... | Client request accessor
@return ClientRequests | [
"Client",
"request",
"accessor"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/OAuth2Requests.php#L25-L32 |
43,302 | rips/php-connector | src/Requests/OAuth2Requests.php | OAuth2Requests.accessTokens | public function accessTokens()
{
if (is_null($this->accessTokenRequests)) {
$this->accessTokenRequests = new AccessTokenRequest($this->client);
}
return $this->accessTokenRequests;
} | php | public function accessTokens()
{
if (is_null($this->accessTokenRequests)) {
$this->accessTokenRequests = new AccessTokenRequest($this->client);
}
return $this->accessTokenRequests;
} | [
"public",
"function",
"accessTokens",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"accessTokenRequests",
")",
")",
"{",
"$",
"this",
"->",
"accessTokenRequests",
"=",
"new",
"AccessTokenRequest",
"(",
"$",
"this",
"->",
"client",
")",
";",... | Access token request accessor
@return AccessTokenRequest | [
"Access",
"token",
"request",
"accessor"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/OAuth2Requests.php#L39-L46 |
43,303 | rips/php-connector | src/Requests/Application/Scan/IssueRequests.php | IssueRequests.comments | public function comments()
{
if (is_null($this->commentRequests)) {
$this->commentRequests = new CommentRequests($this->client);
}
return $this->commentRequests;
} | php | public function comments()
{
if (is_null($this->commentRequests)) {
$this->commentRequests = new CommentRequests($this->client);
}
return $this->commentRequests;
} | [
"public",
"function",
"comments",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"commentRequests",
")",
")",
"{",
"$",
"this",
"->",
"commentRequests",
"=",
"new",
"CommentRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
"retu... | Accessor for comment requests
@return CommentRequests | [
"Accessor",
"for",
"comment",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/Scan/IssueRequests.php#L151-L158 |
43,304 | rips/php-connector | src/Requests/Application/Scan/IssueRequests.php | IssueRequests.contexts | public function contexts()
{
if (is_null($this->contextRequests)) {
$this->contextRequests = new ContextRequests($this->client);
}
return $this->contextRequests;
} | php | public function contexts()
{
if (is_null($this->contextRequests)) {
$this->contextRequests = new ContextRequests($this->client);
}
return $this->contextRequests;
} | [
"public",
"function",
"contexts",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"contextRequests",
")",
")",
"{",
"$",
"this",
"->",
"contextRequests",
"=",
"new",
"ContextRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
"retu... | Accessor for context requests
@return ContextRequests | [
"Accessor",
"for",
"context",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/Scan/IssueRequests.php#L165-L172 |
43,305 | rips/php-connector | src/Requests/Application/Scan/IssueRequests.php | IssueRequests.origins | public function origins()
{
if (is_null($this->originRequests)) {
$this->originRequests = new OriginRequests($this->client);
}
return $this->originRequests;
} | php | public function origins()
{
if (is_null($this->originRequests)) {
$this->originRequests = new OriginRequests($this->client);
}
return $this->originRequests;
} | [
"public",
"function",
"origins",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"originRequests",
")",
")",
"{",
"$",
"this",
"->",
"originRequests",
"=",
"new",
"OriginRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
"return",... | Origin requests accessor
@return OriginRequests | [
"Origin",
"requests",
"accessor"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/Scan/IssueRequests.php#L179-L186 |
43,306 | rips/php-connector | src/Requests/Application/Scan/IssueRequests.php | IssueRequests.reviews | public function reviews()
{
if (is_null($this->reviewRequests)) {
$this->reviewRequests = new ReviewRequests($this->client);
}
return $this->reviewRequests;
} | php | public function reviews()
{
if (is_null($this->reviewRequests)) {
$this->reviewRequests = new ReviewRequests($this->client);
}
return $this->reviewRequests;
} | [
"public",
"function",
"reviews",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"reviewRequests",
")",
")",
"{",
"$",
"this",
"->",
"reviewRequests",
"=",
"new",
"ReviewRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
"return",... | Accessor for review requests
@return ReviewRequests | [
"Accessor",
"for",
"review",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/Scan/IssueRequests.php#L193-L200 |
43,307 | rips/php-connector | src/Requests/Application/Scan/IssueRequests.php | IssueRequests.summaries | public function summaries()
{
if (is_null($this->summaryRequests)) {
$this->summaryRequests = new SummaryRequests($this->client);
}
return $this->summaryRequests;
} | php | public function summaries()
{
if (is_null($this->summaryRequests)) {
$this->summaryRequests = new SummaryRequests($this->client);
}
return $this->summaryRequests;
} | [
"public",
"function",
"summaries",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"summaryRequests",
")",
")",
"{",
"$",
"this",
"->",
"summaryRequests",
"=",
"new",
"SummaryRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
"ret... | Accessor for summary requests
@return SummaryRequests | [
"Accessor",
"for",
"summary",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/Scan/IssueRequests.php#L207-L214 |
43,308 | rips/php-connector | src/Requests/Application/Scan/IssueRequests.php | IssueRequests.patches | public function patches()
{
if (is_null($this->patchRequests)) {
$this->patchRequests = new PatchRequests($this->client);
}
return $this->patchRequests;
} | php | public function patches()
{
if (is_null($this->patchRequests)) {
$this->patchRequests = new PatchRequests($this->client);
}
return $this->patchRequests;
} | [
"public",
"function",
"patches",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"patchRequests",
")",
")",
"{",
"$",
"this",
"->",
"patchRequests",
"=",
"new",
"PatchRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
"return",
... | Accessor for patch requests
@return PatchRequests | [
"Accessor",
"for",
"patch",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/Scan/IssueRequests.php#L221-L228 |
43,309 | rips/php-connector | src/Requests/Application/Scan/LibraryRequests.php | LibraryRequests.deleteAll | public function deleteAll($appId, $scanId, array $queryParams = [])
{
$response = $this->client->delete($this->uri($appId, $scanId), [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function deleteAll($appId, $scanId, array $queryParams = [])
{
$response = $this->client->delete($this->uri($appId, $scanId), [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"deleteAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"delete",
"(",
"$",
"this",
"->",
"uri",
"(",
"$",
"appId"... | Delete all libraries
@param int $appId
@param int $scanId
@param array $queryParams
@return Response | [
"Delete",
"all",
"libraries"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/Scan/LibraryRequests.php#L108-L115 |
43,310 | rips/php-connector | src/Requests/Application/Scan/LibraryRequests.php | LibraryRequests.deleteById | public function deleteById($appId, $scanId, $libraryId, array $queryParams = [])
{
if (is_null($appId) || is_null($scanId) || is_null($libraryId)) {
throw new LibException('appId, scanId, or libraryId is null');
}
$response = $this->client->delete($this->uri($appId, $scanId, $libraryId), [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function deleteById($appId, $scanId, $libraryId, array $queryParams = [])
{
if (is_null($appId) || is_null($scanId) || is_null($libraryId)) {
throw new LibException('appId, scanId, or libraryId is null');
}
$response = $this->client->delete($this->uri($appId, $scanId, $libraryId), [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"deleteById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"libraryId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"appId",
")",
"||",
"is_null",
"(",
"$",
"scanId",
")",
"||... | Delete a library by id
@param int $appId
@param int $scanId
@param int $libraryId
@param array $queryParams
@return Response | [
"Delete",
"a",
"library",
"by",
"id"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/Scan/LibraryRequests.php#L126-L137 |
43,311 | rips/php-connector | src/API.php | API.initialize | public function initialize($email, $password, array $clientConfig = [])
{
$mergedConfig = array_merge(
$this->clientConfig,
$clientConfig,
[
'headers' => [
'User-Agent' => "RIPS-API-Connector/{$this->version}",
],
],
[
'headers' => $this->getAuthHeaders($email, $password, $clientConfig)
]
);
$client = new Client($mergedConfig);
$this->callbacks = new CallbackRequests($client);
$this->applications = new ApplicationRequests($client);
$this->licenses = new LicenseRequests($client);
$this->logs = new LogRequests($client);
$this->orgs = new OrgRequests($client);
$this->quotas = new QuotaRequests($client);
$this->settings = new SettingRequests($client);
$this->sources = new SourceRequests($client);
$this->status = new StatusRequests($client);
$this->teams = new TeamRequests($client);
$this->users = new UserRequests($client);
$this->oauth2 = new OAuth2Requests($client);
$this->activities = new ActivityRequests($client);
$this->maintenance = new MaintenanceRequests($client);
$this->languages = new LanguageRequests($client);
$this->systems = new SystemRequests($client);
} | php | public function initialize($email, $password, array $clientConfig = [])
{
$mergedConfig = array_merge(
$this->clientConfig,
$clientConfig,
[
'headers' => [
'User-Agent' => "RIPS-API-Connector/{$this->version}",
],
],
[
'headers' => $this->getAuthHeaders($email, $password, $clientConfig)
]
);
$client = new Client($mergedConfig);
$this->callbacks = new CallbackRequests($client);
$this->applications = new ApplicationRequests($client);
$this->licenses = new LicenseRequests($client);
$this->logs = new LogRequests($client);
$this->orgs = new OrgRequests($client);
$this->quotas = new QuotaRequests($client);
$this->settings = new SettingRequests($client);
$this->sources = new SourceRequests($client);
$this->status = new StatusRequests($client);
$this->teams = new TeamRequests($client);
$this->users = new UserRequests($client);
$this->oauth2 = new OAuth2Requests($client);
$this->activities = new ActivityRequests($client);
$this->maintenance = new MaintenanceRequests($client);
$this->languages = new LanguageRequests($client);
$this->systems = new SystemRequests($client);
} | [
"public",
"function",
"initialize",
"(",
"$",
"email",
",",
"$",
"password",
",",
"array",
"$",
"clientConfig",
"=",
"[",
"]",
")",
"{",
"$",
"mergedConfig",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"clientConfig",
",",
"$",
"clientConfig",
",",
"[",
... | Initialize new API
Separation from the constructor is required because in some cases the information are not yet known when
the object is constructed.
@param string $email
@param string $password
@param array $clientConfig
@throws Exception | [
"Initialize",
"new",
"API",
"Separation",
"from",
"the",
"constructor",
"is",
"required",
"because",
"in",
"some",
"cases",
"the",
"information",
"are",
"not",
"yet",
"known",
"when",
"the",
"object",
"is",
"constructed",
"."
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/API.php#L147-L179 |
43,312 | rips/php-connector | src/API.php | API.getAuthHeaders | private function getAuthHeaders($email, $password, $clientConfig)
{
if (!$email || !$password) {
return [];
}
if (!isset($clientConfig['oauth2']['enabled']) || !$clientConfig['oauth2']['enabled']) {
return [
'X-API-Email-Enc' => base64_encode($email),
'X-API-Password-Enc' => base64_encode($password),
'X-API-Email' => $email,
'X-API-Password' => $password
];
}
$oauth2Config = $clientConfig['oauth2'];
$accessToken = array_key_exists('access_token', $oauth2Config) ? $oauth2Config["access_token"] : "";
if (empty($accessToken)) {
$accessToken = $this->getAccessToken($email, $password, $clientConfig);
}
if (!$accessToken) {
throw new Exception('Cannot find/create valid token');
}
return [
'Authorization' => "Bearer {$accessToken}"
];
} | php | private function getAuthHeaders($email, $password, $clientConfig)
{
if (!$email || !$password) {
return [];
}
if (!isset($clientConfig['oauth2']['enabled']) || !$clientConfig['oauth2']['enabled']) {
return [
'X-API-Email-Enc' => base64_encode($email),
'X-API-Password-Enc' => base64_encode($password),
'X-API-Email' => $email,
'X-API-Password' => $password
];
}
$oauth2Config = $clientConfig['oauth2'];
$accessToken = array_key_exists('access_token', $oauth2Config) ? $oauth2Config["access_token"] : "";
if (empty($accessToken)) {
$accessToken = $this->getAccessToken($email, $password, $clientConfig);
}
if (!$accessToken) {
throw new Exception('Cannot find/create valid token');
}
return [
'Authorization' => "Bearer {$accessToken}"
];
} | [
"private",
"function",
"getAuthHeaders",
"(",
"$",
"email",
",",
"$",
"password",
",",
"$",
"clientConfig",
")",
"{",
"if",
"(",
"!",
"$",
"email",
"||",
"!",
"$",
"password",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
... | Get the authentication headers
@param string $email
@param string $password
@param array $clientConfig
@return array
@throws Exception | [
"Get",
"the",
"authentication",
"headers"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/API.php#L200-L228 |
43,313 | rips/php-connector | src/API.php | API.getAccessToken | private function getAccessToken($email, $password, $clientConfig)
{
$oauth2Config = $clientConfig['oauth2'];
$accessToken = null;
// If there is a token file, try to read it and test the found token
try {
$filePath = array_key_exists('token_file_path', $oauth2Config) && !empty($oauth2Config['token_file_path'])
? $oauth2Config['token_file_path'] : '';
if (file_exists($filePath)) {
$data = file_get_contents($filePath);
if (!empty($data)) {
$decodedData = json_decode($data);
$accessToken = $decodedData->access_token;
return $accessToken;
}
}
} catch (\Exception $e) {
}
return $this->createAccessToken($email, $password, $clientConfig);
} | php | private function getAccessToken($email, $password, $clientConfig)
{
$oauth2Config = $clientConfig['oauth2'];
$accessToken = null;
// If there is a token file, try to read it and test the found token
try {
$filePath = array_key_exists('token_file_path', $oauth2Config) && !empty($oauth2Config['token_file_path'])
? $oauth2Config['token_file_path'] : '';
if (file_exists($filePath)) {
$data = file_get_contents($filePath);
if (!empty($data)) {
$decodedData = json_decode($data);
$accessToken = $decodedData->access_token;
return $accessToken;
}
}
} catch (\Exception $e) {
}
return $this->createAccessToken($email, $password, $clientConfig);
} | [
"private",
"function",
"getAccessToken",
"(",
"$",
"email",
",",
"$",
"password",
",",
"$",
"clientConfig",
")",
"{",
"$",
"oauth2Config",
"=",
"$",
"clientConfig",
"[",
"'oauth2'",
"]",
";",
"$",
"accessToken",
"=",
"null",
";",
"// If there is a token file, ... | Gets an access token either from config, from disk or by requesting a new one
@param $email
@param $password
@param $clientConfig
@return string|null
@throws Exception | [
"Gets",
"an",
"access",
"token",
"either",
"from",
"config",
"from",
"disk",
"or",
"by",
"requesting",
"a",
"new",
"one"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/API.php#L239-L263 |
43,314 | rips/php-connector | src/API.php | API.createAccessToken | private function createAccessToken($email, $password, $clientConfig)
{
$oauth2Config = $clientConfig['oauth2'];
if (!array_key_exists('client_id', $oauth2Config)) {
throw new Exception('Cannot create new oauth token without client id');
}
$mergedConfig = array_merge($this->clientConfig, $clientConfig, [
'headers' => [
'User-Agent' => "RIPS-API-Connector/{$this->version}",
],
RequestOptions::JSON => [
'grant_type' => 'password',
'client_id' => $oauth2Config['client_id'],
'username' => $email,
'password' => $password
]
]);
$request = new AccessTokenRequest(new Client($mergedConfig));
$tokens = $request->getTokens()->getDecodedData();
if (isset($oauth2Config['store_token']) && $oauth2Config['store_token'] === true) {
if (!array_key_exists('token_file_path', $oauth2Config) || empty($oauth2Config['token_file_path'])) {
throw new Exception('Token path is needed to store token');
}
$filePath = $oauth2Config['token_file_path'];
file_put_contents($filePath, json_encode($tokens));
}
return $tokens->access_token;
} | php | private function createAccessToken($email, $password, $clientConfig)
{
$oauth2Config = $clientConfig['oauth2'];
if (!array_key_exists('client_id', $oauth2Config)) {
throw new Exception('Cannot create new oauth token without client id');
}
$mergedConfig = array_merge($this->clientConfig, $clientConfig, [
'headers' => [
'User-Agent' => "RIPS-API-Connector/{$this->version}",
],
RequestOptions::JSON => [
'grant_type' => 'password',
'client_id' => $oauth2Config['client_id'],
'username' => $email,
'password' => $password
]
]);
$request = new AccessTokenRequest(new Client($mergedConfig));
$tokens = $request->getTokens()->getDecodedData();
if (isset($oauth2Config['store_token']) && $oauth2Config['store_token'] === true) {
if (!array_key_exists('token_file_path', $oauth2Config) || empty($oauth2Config['token_file_path'])) {
throw new Exception('Token path is needed to store token');
}
$filePath = $oauth2Config['token_file_path'];
file_put_contents($filePath, json_encode($tokens));
}
return $tokens->access_token;
} | [
"private",
"function",
"createAccessToken",
"(",
"$",
"email",
",",
"$",
"password",
",",
"$",
"clientConfig",
")",
"{",
"$",
"oauth2Config",
"=",
"$",
"clientConfig",
"[",
"'oauth2'",
"]",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"'client_id'",
",",
... | Creates an access token by requesting it from the server
@param $email
@param $password
@param $clientConfig
@return string
@throws Exception | [
"Creates",
"an",
"access",
"token",
"by",
"requesting",
"it",
"from",
"the",
"server"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/API.php#L274-L305 |
43,315 | rips/php-connector | src/Requests/System/LdapRequests.php | LdapRequests.get | public function get(array $queryParams = [])
{
$response = $this->client->get("{$this->uri()}", [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function get(array $queryParams = [])
{
$response = $this->client->get("{$this->uri()}", [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"get",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"\"{$this->uri()}\"",
",",
"[",
"'query'",
"=>",
"$",
"queryParams",
",",
"]",
")",
";",
"ret... | Get a scan by application ID and scan ID
@param array $queryParams
@return Response | [
"Get",
"a",
"scan",
"by",
"application",
"ID",
"and",
"scan",
"ID"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/System/LdapRequests.php#L27-L34 |
43,316 | rips/php-connector | src/Requests/System/LdapRequests.php | LdapRequests.sync | public function sync(array $queryParams = [])
{
$response = $this->client->post("{$this->uri()}/sync", [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function sync(array $queryParams = [])
{
$response = $this->client->post("{$this->uri()}/sync", [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"sync",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"\"{$this->uri()}/sync\"",
",",
"[",
"'query'",
"=>",
"$",
"queryParams",
",",
"]",
")",
";",... | Force LDAP synchronization
@param array $queryParams
@return Response | [
"Force",
"LDAP",
"synchronization"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/System/LdapRequests.php#L59-L66 |
43,317 | rips/php-connector | src/Requests/UserRequests.php | UserRequests.reset | public function reset(array $input, array $queryParams = [])
{
$response = $this->client->post("{$this->uri()}/reset/ui", [
RequestOptions::JSON => ['reset' => $input],
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function reset(array $input, array $queryParams = [])
{
$response = $this->client->post("{$this->uri()}/reset/ui", [
RequestOptions::JSON => ['reset' => $input],
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"reset",
"(",
"array",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"\"{$this->uri()}/reset/ui\"",
",",
"[",
"RequestOptions",
"::",
"... | Request a reset e-mail
@param array $input
@param array $queryParams
@return Response | [
"Request",
"a",
"reset",
"e",
"-",
"mail"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/UserRequests.php#L147-L155 |
43,318 | rips/php-connector | src/Requests/OAuth2/AccessTokenRequest.php | AccessTokenRequest.getTokens | public function getTokens()
{
$response = $this->client->post($this->uri());
return $this->handleResponse($response);
} | php | public function getTokens()
{
$response = $this->client->post($this->uri());
return $this->handleResponse($response);
} | [
"public",
"function",
"getTokens",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"$",
"this",
"->",
"uri",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"handleResponse",
"(",
"$",
"response",
")",
";",
"}"... | Get status info for the current session and API env
@return Response | [
"Get",
"status",
"info",
"for",
"the",
"current",
"session",
"and",
"API",
"env"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/OAuth2/AccessTokenRequest.php#L25-L30 |
43,319 | rips/php-connector | src/Requests/SettingRequests.php | SettingRequests.getByKey | public function getByKey($key, array $queryParams = [])
{
$response = $this->client->get($this->uri($key), [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function getByKey($key, array $queryParams = [])
{
$response = $this->client->get($this->uri($key), [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"getByKey",
"(",
"$",
"key",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"$",
"this",
"->",
"uri",
"(",
"$",
"key",
")",
",",
"[",
"'query'"... | Get a setting by key
@param string $key
@param array $queryParams
@return Response | [
"Get",
"a",
"setting",
"by",
"key"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/SettingRequests.php#L43-L50 |
43,320 | rips/php-connector | src/Requests/SettingRequests.php | SettingRequests.createOrUpdate | public function createOrUpdate($key, array $input, array $queryParams = [])
{
$response = $this->client->put($this->uri($key), [
RequestOptions::JSON => ['setting' => $input],
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function createOrUpdate($key, array $input, array $queryParams = [])
{
$response = $this->client->put($this->uri($key), [
RequestOptions::JSON => ['setting' => $input],
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"createOrUpdate",
"(",
"$",
"key",
",",
"array",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"put",
"(",
"$",
"this",
"->",
"uri",
"(",
"$",... | Create or update a setting
@param string $key
@param array $input
@param array $queryParams
@return Response | [
"Create",
"or",
"update",
"a",
"setting"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/SettingRequests.php#L60-L68 |
43,321 | rips/php-connector | src/Requests/SettingRequests.php | SettingRequests.deleteByKey | public function deleteByKey($key, array $queryParams = [])
{
$response = $this->client->delete($this->uri($key), [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function deleteByKey($key, array $queryParams = [])
{
$response = $this->client->delete($this->uri($key), [
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"deleteByKey",
"(",
"$",
"key",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"delete",
"(",
"$",
"this",
"->",
"uri",
"(",
"$",
"key",
")",
",",
"[",
"'q... | Delete setting by key
@param string $key
@param array $queryParams
@return Response | [
"Delete",
"setting",
"by",
"key"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/SettingRequests.php#L92-L99 |
43,322 | rips/php-connector | src/Requests/SystemRequests.php | SystemRequests.ldap | public function ldap()
{
if (is_null($this->ldapRequests)) {
$this->ldapRequests = new System\LdapRequests($this->client);
}
return $this->ldapRequests;
} | php | public function ldap()
{
if (is_null($this->ldapRequests)) {
$this->ldapRequests = new System\LdapRequests($this->client);
}
return $this->ldapRequests;
} | [
"public",
"function",
"ldap",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"ldapRequests",
")",
")",
"{",
"$",
"this",
"->",
"ldapRequests",
"=",
"new",
"System",
"\\",
"LdapRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
... | LDAP requests accessor
@return System\LdapRequests | [
"LDAP",
"requests",
"accessor"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/SystemRequests.php#L17-L24 |
43,323 | rips/php-connector | src/Requests/Application/ProfileRequests.php | ProfileRequests.uri | protected function uri($appId = null, $profileId = null, $clone = false)
{
if (is_null($appId)) {
return '/applications/profiles/all';
}
if (is_null($profileId)) {
return "/applications/{$appId}/profiles";
}
if (!$clone) {
return "/applications/{$appId}/profiles/{$profileId}";
}
return "/applications/{$appId}/profiles/{$profileId}/clone";
} | php | protected function uri($appId = null, $profileId = null, $clone = false)
{
if (is_null($appId)) {
return '/applications/profiles/all';
}
if (is_null($profileId)) {
return "/applications/{$appId}/profiles";
}
if (!$clone) {
return "/applications/{$appId}/profiles/{$profileId}";
}
return "/applications/{$appId}/profiles/{$profileId}/clone";
} | [
"protected",
"function",
"uri",
"(",
"$",
"appId",
"=",
"null",
",",
"$",
"profileId",
"=",
"null",
",",
"$",
"clone",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"appId",
")",
")",
"{",
"return",
"'/applications/profiles/all'",
";",
"}",
... | Build the URI for the requests
@param int $appId
@param int $profileId
@param bool $clone
@return string | [
"Build",
"the",
"URI",
"for",
"the",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/ProfileRequests.php#L68-L83 |
43,324 | rips/php-connector | src/Requests/Application/ProfileRequests.php | ProfileRequests.cloneById | public function cloneById($appId, $profileId, $input, array $queryParams = [])
{
$response = $this->client->post($this->uri($appId, $profileId, true), [
RequestOptions::JSON => ['profile' => $input],
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function cloneById($appId, $profileId, $input, array $queryParams = [])
{
$response = $this->client->post($this->uri($appId, $profileId, true), [
RequestOptions::JSON => ['profile' => $input],
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"cloneById",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"$",
"this",
"->",
"uri... | Clone a existing profile
@param int $appId
@param int $profileId
@param array $input
@param array $queryParams
@return Response | [
"Clone",
"a",
"existing",
"profile"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/ProfileRequests.php#L145-L153 |
43,325 | rips/php-connector | src/Requests/Application/ProfileRequests.php | ProfileRequests.update | public function update($appId, $profileId, array $input, array $queryParams = [])
{
$response = $this->client->patch($this->uri($appId, $profileId), [
RequestOptions::JSON => ['profile' => $input],
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | php | public function update($appId, $profileId, array $input, array $queryParams = [])
{
$response = $this->client->patch($this->uri($appId, $profileId), [
RequestOptions::JSON => ['profile' => $input],
'query' => $queryParams,
]);
return $this->handleResponse($response);
} | [
"public",
"function",
"update",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"array",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"patch",
"(",
"$",
"this",
"->... | Update an existing profile
@param int $appId
@param int $profileId
@param array $input
@param array $queryParams
@return Response | [
"Update",
"an",
"existing",
"profile"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/ProfileRequests.php#L164-L172 |
43,326 | rips/php-connector | src/Requests/Application/ProfileRequests.php | ProfileRequests.ignoredCodes | public function ignoredCodes()
{
if (is_null($this->ignoredCodeRequests)) {
$this->ignoredCodeRequests = new IgnoredCodeRequests($this->client);
}
return $this->ignoredCodeRequests;
} | php | public function ignoredCodes()
{
if (is_null($this->ignoredCodeRequests)) {
$this->ignoredCodeRequests = new IgnoredCodeRequests($this->client);
}
return $this->ignoredCodeRequests;
} | [
"public",
"function",
"ignoredCodes",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"ignoredCodeRequests",
")",
")",
"{",
"$",
"this",
"->",
"ignoredCodeRequests",
"=",
"new",
"IgnoredCodeRequests",
"(",
"$",
"this",
"->",
"client",
")",
";"... | Accessor to ignored code requests
@return IgnoredCodeRequests | [
"Accessor",
"to",
"ignored",
"code",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/ProfileRequests.php#L216-L223 |
43,327 | rips/php-connector | src/Requests/Application/ProfileRequests.php | ProfileRequests.ignoredLocations | public function ignoredLocations()
{
if (is_null($this->ignoredLocationRequests)) {
$this->ignoredLocationRequests = new IgnoredLocationRequests($this->client);
}
return $this->ignoredLocationRequests;
} | php | public function ignoredLocations()
{
if (is_null($this->ignoredLocationRequests)) {
$this->ignoredLocationRequests = new IgnoredLocationRequests($this->client);
}
return $this->ignoredLocationRequests;
} | [
"public",
"function",
"ignoredLocations",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"ignoredLocationRequests",
")",
")",
"{",
"$",
"this",
"->",
"ignoredLocationRequests",
"=",
"new",
"IgnoredLocationRequests",
"(",
"$",
"this",
"->",
"clien... | Accessor to ignored location requests
@return IgnoredLocationRequests | [
"Accessor",
"to",
"ignored",
"location",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/ProfileRequests.php#L230-L237 |
43,328 | rips/php-connector | src/Requests/Application/ProfileRequests.php | ProfileRequests.sanitizers | public function sanitizers()
{
if (is_null($this->sanitizerRequests)) {
$this->sanitizerRequests = new SanitizerRequests($this->client);
}
return $this->sanitizerRequests;
} | php | public function sanitizers()
{
if (is_null($this->sanitizerRequests)) {
$this->sanitizerRequests = new SanitizerRequests($this->client);
}
return $this->sanitizerRequests;
} | [
"public",
"function",
"sanitizers",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"sanitizerRequests",
")",
")",
"{",
"$",
"this",
"->",
"sanitizerRequests",
"=",
"new",
"SanitizerRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",... | Accessor to sanitizer requests
@return SanitizerRequests | [
"Accessor",
"to",
"sanitizer",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/ProfileRequests.php#L244-L251 |
43,329 | rips/php-connector | src/Requests/Application/ProfileRequests.php | ProfileRequests.settings | public function settings()
{
if (is_null($this->settingRequests)) {
$this->settingRequests = new SettingRequests($this->client);
}
return $this->settingRequests;
} | php | public function settings()
{
if (is_null($this->settingRequests)) {
$this->settingRequests = new SettingRequests($this->client);
}
return $this->settingRequests;
} | [
"public",
"function",
"settings",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"settingRequests",
")",
")",
"{",
"$",
"this",
"->",
"settingRequests",
"=",
"new",
"SettingRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",
"retu... | Accessor to setting requests
@return SettingRequests | [
"Accessor",
"to",
"setting",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/ProfileRequests.php#L258-L265 |
43,330 | rips/php-connector | src/Requests/Application/ProfileRequests.php | ProfileRequests.validators | public function validators()
{
if (is_null($this->validatorRequests)) {
$this->validatorRequests = new ValidatorRequests($this->client);
}
return $this->validatorRequests;
} | php | public function validators()
{
if (is_null($this->validatorRequests)) {
$this->validatorRequests = new ValidatorRequests($this->client);
}
return $this->validatorRequests;
} | [
"public",
"function",
"validators",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"validatorRequests",
")",
")",
"{",
"$",
"this",
"->",
"validatorRequests",
"=",
"new",
"ValidatorRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
"}",... | Accessor to validator requests
@return ValidatorRequests | [
"Accessor",
"to",
"validator",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/ProfileRequests.php#L300-L307 |
43,331 | rips/php-connector | src/Requests/Application/ProfileRequests.php | ProfileRequests.controllers | public function controllers()
{
if (is_null($this->controllerRequests)) {
$this->controllerRequests = new ControllerRequests($this->client);
}
return $this->controllerRequests;
} | php | public function controllers()
{
if (is_null($this->controllerRequests)) {
$this->controllerRequests = new ControllerRequests($this->client);
}
return $this->controllerRequests;
} | [
"public",
"function",
"controllers",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"controllerRequests",
")",
")",
"{",
"$",
"this",
"->",
"controllerRequests",
"=",
"new",
"ControllerRequests",
"(",
"$",
"this",
"->",
"client",
")",
";",
... | Accessor to controller requests
@return ControllerRequests | [
"Accessor",
"to",
"controller",
"requests"
] | 8a6cbd600ca164f4f65248dad8d6af7a579cc2d9 | https://github.com/rips/php-connector/blob/8a6cbd600ca164f4f65248dad8d6af7a579cc2d9/src/Requests/Application/ProfileRequests.php#L314-L321 |
43,332 | silverstripe/cwp-core | src/Control/InitialisationMiddleware.php | InitialisationMiddleware.configureEgressProxy | protected function configureEgressProxy()
{
if (!Environment::getEnv('SS_OUTBOUND_PROXY')
|| !Environment::getEnv('SS_OUTBOUND_PROXY_PORT')
) {
return;
}
$proxy = Environment::getEnv('SS_OUTBOUND_PROXY');
$proxyPort = Environment::getEnv('SS_OUTBOUND_PROXY_PORT');
/*
* This sets the environment variables so they are available in
* external calls executed by exec() such as curl.
* Environment::setEnv() would only availabe in context of SilverStripe.
* Environment::getEnv() will fallback to getenv() and will therefore
* fetch the variables
*/
putenv('http_proxy=' . $proxy . ':' . $proxyPort);
putenv('https_proxy=' . $proxy . ':' . $proxyPort);
} | php | protected function configureEgressProxy()
{
if (!Environment::getEnv('SS_OUTBOUND_PROXY')
|| !Environment::getEnv('SS_OUTBOUND_PROXY_PORT')
) {
return;
}
$proxy = Environment::getEnv('SS_OUTBOUND_PROXY');
$proxyPort = Environment::getEnv('SS_OUTBOUND_PROXY_PORT');
/*
* This sets the environment variables so they are available in
* external calls executed by exec() such as curl.
* Environment::setEnv() would only availabe in context of SilverStripe.
* Environment::getEnv() will fallback to getenv() and will therefore
* fetch the variables
*/
putenv('http_proxy=' . $proxy . ':' . $proxyPort);
putenv('https_proxy=' . $proxy . ':' . $proxyPort);
} | [
"protected",
"function",
"configureEgressProxy",
"(",
")",
"{",
"if",
"(",
"!",
"Environment",
"::",
"getEnv",
"(",
"'SS_OUTBOUND_PROXY'",
")",
"||",
"!",
"Environment",
"::",
"getEnv",
"(",
"'SS_OUTBOUND_PROXY_PORT'",
")",
")",
"{",
"return",
";",
"}",
"$",
... | If the outbound egress proxy details have been defined in environment variables, configure the proxy
variables that are used to configure it. | [
"If",
"the",
"outbound",
"egress",
"proxy",
"details",
"have",
"been",
"defined",
"in",
"environment",
"variables",
"configure",
"the",
"proxy",
"variables",
"that",
"are",
"used",
"to",
"configure",
"it",
"."
] | fee3f1abbc6f5464e85a7d6af3b30dab02053829 | https://github.com/silverstripe/cwp-core/blob/fee3f1abbc6f5464e85a7d6af3b30dab02053829/src/Control/InitialisationMiddleware.php#L72-L92 |
43,333 | silverstripe/cwp-core | src/Control/InitialisationMiddleware.php | InitialisationMiddleware.configureProxyDomainExclusions | protected function configureProxyDomainExclusions()
{
$noProxy = $this->config()->get('egress_proxy_exclude_domains');
if (empty($noProxy)) {
return;
}
if (!is_array($noProxy)) {
$noProxy = [$noProxy];
}
// Merge with exsiting if needed.
if (Environment::getEnv('NO_PROXY')) {
$noProxy = array_merge(explode(',', Environment::getEnv('NO_PROXY')), $noProxy);
}
/*
* Set the environment varial for NO_PROXY the same way the
* proxy variables are set above
*/
putenv('NO_PROXY=' . implode(',', array_unique($noProxy)));
} | php | protected function configureProxyDomainExclusions()
{
$noProxy = $this->config()->get('egress_proxy_exclude_domains');
if (empty($noProxy)) {
return;
}
if (!is_array($noProxy)) {
$noProxy = [$noProxy];
}
// Merge with exsiting if needed.
if (Environment::getEnv('NO_PROXY')) {
$noProxy = array_merge(explode(',', Environment::getEnv('NO_PROXY')), $noProxy);
}
/*
* Set the environment varial for NO_PROXY the same way the
* proxy variables are set above
*/
putenv('NO_PROXY=' . implode(',', array_unique($noProxy)));
} | [
"protected",
"function",
"configureProxyDomainExclusions",
"(",
")",
"{",
"$",
"noProxy",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'egress_proxy_exclude_domains'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"noProxy",
")",
")",
"{",
"ret... | Configure any domains that should be excluded from egress proxy rules and provide them to the environment | [
"Configure",
"any",
"domains",
"that",
"should",
"be",
"excluded",
"from",
"egress",
"proxy",
"rules",
"and",
"provide",
"them",
"to",
"the",
"environment"
] | fee3f1abbc6f5464e85a7d6af3b30dab02053829 | https://github.com/silverstripe/cwp-core/blob/fee3f1abbc6f5464e85a7d6af3b30dab02053829/src/Control/InitialisationMiddleware.php#L97-L118 |
43,334 | silverstripe/cwp-core | src/Control/CwpBasicAuthMiddleware.php | CwpBasicAuthMiddleware.ipMatchesWhitelist | protected function ipMatchesWhitelist()
{
$whitelist = $this->getWhitelistedIps();
// Continue if no whitelist is defined
if (empty($whitelist)) {
return false;
}
$userIp = $_SERVER['REMOTE_ADDR'];
if (in_array($userIp, $whitelist)) {
return true;
}
return false;
} | php | protected function ipMatchesWhitelist()
{
$whitelist = $this->getWhitelistedIps();
// Continue if no whitelist is defined
if (empty($whitelist)) {
return false;
}
$userIp = $_SERVER['REMOTE_ADDR'];
if (in_array($userIp, $whitelist)) {
return true;
}
return false;
} | [
"protected",
"function",
"ipMatchesWhitelist",
"(",
")",
"{",
"$",
"whitelist",
"=",
"$",
"this",
"->",
"getWhitelistedIps",
"(",
")",
";",
"// Continue if no whitelist is defined",
"if",
"(",
"empty",
"(",
"$",
"whitelist",
")",
")",
"{",
"return",
"false",
"... | Check whether the current user's IP address is in the IP whitelist
@return bool | [
"Check",
"whether",
"the",
"current",
"user",
"s",
"IP",
"address",
"is",
"in",
"the",
"IP",
"whitelist"
] | fee3f1abbc6f5464e85a7d6af3b30dab02053829 | https://github.com/silverstripe/cwp-core/blob/fee3f1abbc6f5464e85a7d6af3b30dab02053829/src/Control/CwpBasicAuthMiddleware.php#L74-L88 |
43,335 | silverstripe/cwp-core | src/Feed/CwpAtomFeed.php | CwpAtomFeed.outputToBrowser | public function outputToBrowser()
{
$output = parent::outputToBrowser();
$response = Controller::curr()->getResponse();
$response->addHeader("Content-Type", "application/atom+xml");
return $output;
} | php | public function outputToBrowser()
{
$output = parent::outputToBrowser();
$response = Controller::curr()->getResponse();
$response->addHeader("Content-Type", "application/atom+xml");
return $output;
} | [
"public",
"function",
"outputToBrowser",
"(",
")",
"{",
"$",
"output",
"=",
"parent",
"::",
"outputToBrowser",
"(",
")",
";",
"$",
"response",
"=",
"Controller",
"::",
"curr",
"(",
")",
"->",
"getResponse",
"(",
")",
";",
"$",
"response",
"->",
"addHeade... | Output the feed to the browser
@return DBHTMLText | [
"Output",
"the",
"feed",
"to",
"the",
"browser"
] | fee3f1abbc6f5464e85a7d6af3b30dab02053829 | https://github.com/silverstripe/cwp-core/blob/fee3f1abbc6f5464e85a7d6af3b30dab02053829/src/Feed/CwpAtomFeed.php#L66-L73 |
43,336 | silverstripe/vendor-plugin | src/VendorPlugin.php | VendorPlugin.getLibrary | public function getLibrary(PackageEvent $event)
{
// Ensure package is the valid type
$package = $this->getOperationPackage($event);
if (!$package) {
return null;
}
// Get appropriate installer and query install path
$installer = $event->getComposer()->getInstallationManager()->getInstaller($package->getType());
$path = $installer->getInstallPath($package);
// Build module
return new Library($this->getProjectPath(), $path);
} | php | public function getLibrary(PackageEvent $event)
{
// Ensure package is the valid type
$package = $this->getOperationPackage($event);
if (!$package) {
return null;
}
// Get appropriate installer and query install path
$installer = $event->getComposer()->getInstallationManager()->getInstaller($package->getType());
$path = $installer->getInstallPath($package);
// Build module
return new Library($this->getProjectPath(), $path);
} | [
"public",
"function",
"getLibrary",
"(",
"PackageEvent",
"$",
"event",
")",
"{",
"// Ensure package is the valid type",
"$",
"package",
"=",
"$",
"this",
"->",
"getOperationPackage",
"(",
"$",
"event",
")",
";",
"if",
"(",
"!",
"$",
"package",
")",
"{",
"ret... | Gets library being installed
@param PackageEvent $event
@return Library|null | [
"Gets",
"library",
"being",
"installed"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/VendorPlugin.php#L114-L128 |
43,337 | silverstripe/vendor-plugin | src/VendorPlugin.php | VendorPlugin.installRootPackage | public function installRootPackage(Event $event)
{
// Build library in base path
$basePath = $this->getProjectPath();
$library = new Library($basePath, $basePath);
// Pass to library installer
$this->installLibrary($event->getIO(), $library);
} | php | public function installRootPackage(Event $event)
{
// Build library in base path
$basePath = $this->getProjectPath();
$library = new Library($basePath, $basePath);
// Pass to library installer
$this->installLibrary($event->getIO(), $library);
} | [
"public",
"function",
"installRootPackage",
"(",
"Event",
"$",
"event",
")",
"{",
"// Build library in base path",
"$",
"basePath",
"=",
"$",
"this",
"->",
"getProjectPath",
"(",
")",
";",
"$",
"library",
"=",
"new",
"Library",
"(",
"$",
"basePath",
",",
"$"... | Install resources from the root package
@param Event $event | [
"Install",
"resources",
"from",
"the",
"root",
"package"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/VendorPlugin.php#L152-L160 |
43,338 | silverstripe/vendor-plugin | src/VendorPlugin.php | VendorPlugin.installLibrary | protected function installLibrary(IOInterface $IO, Library $library)
{
if (!$library || !$library->requiresExpose()) {
return;
}
// Create exposure task
$task = new VendorExposeTask(
$this->getProjectPath(),
$this->filesystem,
$library->getBasePublicPath()
);
$task->process($IO, [$library]);
} | php | protected function installLibrary(IOInterface $IO, Library $library)
{
if (!$library || !$library->requiresExpose()) {
return;
}
// Create exposure task
$task = new VendorExposeTask(
$this->getProjectPath(),
$this->filesystem,
$library->getBasePublicPath()
);
$task->process($IO, [$library]);
} | [
"protected",
"function",
"installLibrary",
"(",
"IOInterface",
"$",
"IO",
",",
"Library",
"$",
"library",
")",
"{",
"if",
"(",
"!",
"$",
"library",
"||",
"!",
"$",
"library",
"->",
"requiresExpose",
"(",
")",
")",
"{",
"return",
";",
"}",
"// Create expo... | Expose the given Library object
@param IOInterface $IO
@param Library $library | [
"Expose",
"the",
"given",
"Library",
"object"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/VendorPlugin.php#L237-L250 |
43,339 | silverstripe/vendor-plugin | src/VendorModule.php | VendorModule.getModulePath | public function getModulePath($base = self::DEFAULT_SOURCE)
{
if ($base === self::DEFAULT_TARGET) {
return $this->getPublicPath();
} else {
return $this->getPath();
}
} | php | public function getModulePath($base = self::DEFAULT_SOURCE)
{
if ($base === self::DEFAULT_TARGET) {
return $this->getPublicPath();
} else {
return $this->getPath();
}
} | [
"public",
"function",
"getModulePath",
"(",
"$",
"base",
"=",
"self",
"::",
"DEFAULT_SOURCE",
")",
"{",
"if",
"(",
"$",
"base",
"===",
"self",
"::",
"DEFAULT_TARGET",
")",
"{",
"return",
"$",
"this",
"->",
"getPublicPath",
"(",
")",
";",
"}",
"else",
"... | Get full path to the root install for this project
@deprecated 1.3..2.0 use getPath() instead
@param string $base Rewrite root (or 'vendor' for actual module path)
@return string Path for this module | [
"Get",
"full",
"path",
"to",
"the",
"root",
"install",
"for",
"this",
"project"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/VendorModule.php#L45-L52 |
43,340 | silverstripe/vendor-plugin | src/Library.php | Library.getName | public function getName()
{
if ($this->name) {
return $this->name;
}
// Get from composer
$json = $this->getJson();
if (isset($json['name'])) {
$this->name = $json['name'];
}
return $this->name;
} | php | public function getName()
{
if ($this->name) {
return $this->name;
}
// Get from composer
$json = $this->getJson();
if (isset($json['name'])) {
$this->name = $json['name'];
}
return $this->name;
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"name",
")",
"{",
"return",
"$",
"this",
"->",
"name",
";",
"}",
"// Get from composer",
"$",
"json",
"=",
"$",
"this",
"->",
"getJson",
"(",
")",
";",
"if",
"(",
"isset"... | Get module name
@return string | [
"Get",
"module",
"name"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/Library.php#L66-L77 |
43,341 | silverstripe/vendor-plugin | src/Library.php | Library.getBasePublicPath | public function getBasePublicPath()
{
$projectPath = $this->getBasePath();
$publicPath = $this->publicPathExists()
? Util::joinPaths($projectPath, self::PUBLIC_PATH, self::RESOURCES_PATH)
: Util::joinPaths($projectPath, self::RESOURCES_PATH);
return $publicPath;
} | php | public function getBasePublicPath()
{
$projectPath = $this->getBasePath();
$publicPath = $this->publicPathExists()
? Util::joinPaths($projectPath, self::PUBLIC_PATH, self::RESOURCES_PATH)
: Util::joinPaths($projectPath, self::RESOURCES_PATH);
return $publicPath;
} | [
"public",
"function",
"getBasePublicPath",
"(",
")",
"{",
"$",
"projectPath",
"=",
"$",
"this",
"->",
"getBasePath",
"(",
")",
";",
"$",
"publicPath",
"=",
"$",
"this",
"->",
"publicPathExists",
"(",
")",
"?",
"Util",
"::",
"joinPaths",
"(",
"$",
"projec... | Get base path to expose all libraries to
@return string Path with no trailing slash E.g. /var/www/public/resources | [
"Get",
"base",
"path",
"to",
"expose",
"all",
"libraries",
"to"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/Library.php#L109-L116 |
43,342 | silverstripe/vendor-plugin | src/Library.php | Library.getPublicPath | public function getPublicPath()
{
$relativePath = $this->getRelativePath();
// 4.0 compatibility: If there is no public folder, and this is a vendor path,
// remove the leading `vendor` from the destination
if (!$this->publicPathExists() && $this->installedIntoVendor()) {
$relativePath = substr($relativePath, strlen('vendor/'));
}
return Util::joinPaths($this->getBasePublicPath(), $relativePath);
} | php | public function getPublicPath()
{
$relativePath = $this->getRelativePath();
// 4.0 compatibility: If there is no public folder, and this is a vendor path,
// remove the leading `vendor` from the destination
if (!$this->publicPathExists() && $this->installedIntoVendor()) {
$relativePath = substr($relativePath, strlen('vendor/'));
}
return Util::joinPaths($this->getBasePublicPath(), $relativePath);
} | [
"public",
"function",
"getPublicPath",
"(",
")",
"{",
"$",
"relativePath",
"=",
"$",
"this",
"->",
"getRelativePath",
"(",
")",
";",
"// 4.0 compatibility: If there is no public folder, and this is a vendor path,",
"// remove the leading `vendor` from the destination",
"if",
"(... | Get base path to map resources for this module
@return string Path with trimmed slashes. E.g. /var/www/public/resources/vendor/silverstripe/module | [
"Get",
"base",
"path",
"to",
"map",
"resources",
"for",
"this",
"module"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/Library.php#L145-L156 |
43,343 | silverstripe/vendor-plugin | src/Library.php | Library.getJson | protected function getJson()
{
if ($this->json) {
return $this->json;
}
$composer = Util::joinPaths($this->getPath(), 'composer.json');
$file = new JsonFile($composer);
$this->json = $file->read();
return $this->json;
} | php | protected function getJson()
{
if ($this->json) {
return $this->json;
}
$composer = Util::joinPaths($this->getPath(), 'composer.json');
$file = new JsonFile($composer);
$this->json = $file->read();
return $this->json;
} | [
"protected",
"function",
"getJson",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"json",
")",
"{",
"return",
"$",
"this",
"->",
"json",
";",
"}",
"$",
"composer",
"=",
"Util",
"::",
"joinPaths",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"... | Get json content for this module from composer.json
@return array | [
"Get",
"json",
"content",
"for",
"this",
"module",
"from",
"composer",
".",
"json"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/Library.php#L170-L179 |
43,344 | silverstripe/vendor-plugin | src/Library.php | Library.exposePaths | public function exposePaths(ExposeMethod $method)
{
// No-op if exposure not necessary for this configuration
if (!$this->requiresExpose()) {
return;
}
$folders = $this->getExposedFolders();
$sourcePath = $this->getPath();
$targetPath = $this->getPublicPath();
foreach ($folders as $folder) {
// Get paths for this folder and delegate to expose method
$folderSourcePath = Util::joinPaths($sourcePath, $folder);
$folderTargetPath = Util::joinPaths($targetPath, $folder);
$method->exposeDirectory($folderSourcePath, $folderTargetPath);
}
} | php | public function exposePaths(ExposeMethod $method)
{
// No-op if exposure not necessary for this configuration
if (!$this->requiresExpose()) {
return;
}
$folders = $this->getExposedFolders();
$sourcePath = $this->getPath();
$targetPath = $this->getPublicPath();
foreach ($folders as $folder) {
// Get paths for this folder and delegate to expose method
$folderSourcePath = Util::joinPaths($sourcePath, $folder);
$folderTargetPath = Util::joinPaths($targetPath, $folder);
$method->exposeDirectory($folderSourcePath, $folderTargetPath);
}
} | [
"public",
"function",
"exposePaths",
"(",
"ExposeMethod",
"$",
"method",
")",
"{",
"// No-op if exposure not necessary for this configuration",
"if",
"(",
"!",
"$",
"this",
"->",
"requiresExpose",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"folders",
"=",
"$",... | Expose all web accessible paths for this module
@param ExposeMethod $method | [
"Expose",
"all",
"web",
"accessible",
"paths",
"for",
"this",
"module"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/Library.php#L203-L218 |
43,345 | silverstripe/vendor-plugin | src/Library.php | Library.validateFolder | protected function validateFolder($exposeFolder)
{
if (strstr($exposeFolder, '.')) {
return false;
}
if (strpos($exposeFolder, '/') === 0) {
return false;
}
if (strpos($exposeFolder, '\\') === 0) {
return false;
}
return true;
} | php | protected function validateFolder($exposeFolder)
{
if (strstr($exposeFolder, '.')) {
return false;
}
if (strpos($exposeFolder, '/') === 0) {
return false;
}
if (strpos($exposeFolder, '\\') === 0) {
return false;
}
return true;
} | [
"protected",
"function",
"validateFolder",
"(",
"$",
"exposeFolder",
")",
"{",
"if",
"(",
"strstr",
"(",
"$",
"exposeFolder",
",",
"'.'",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"exposeFolder",
",",
"'/'",
")",
"===",... | Validate the given folder is allowed
@param string $exposeFolder Relative folder name to check
@return bool | [
"Validate",
"the",
"given",
"folder",
"is",
"allowed"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/Library.php#L250-L262 |
43,346 | silverstripe/vendor-plugin | src/Console/VendorExposeCommand.php | VendorExposeCommand.getAllLibraries | protected function getAllLibraries()
{
$modules = [];
$basePath = $this->getProjectPath();
// Get all modules
foreach ($this->getModulePaths() as $modulePath) {
// Filter by non-composer folders
$composerPath = Util::joinPaths($modulePath, 'composer.json');
if (!file_exists($composerPath)) {
continue;
}
// Ensure this library should be exposed, and has at least one folder
$module = new Library($basePath, $modulePath);
if (!$module->requiresExpose() || !$module->getExposedFolders()) {
continue;
}
// Save this module
$modules[] = $module;
}
return $modules;
} | php | protected function getAllLibraries()
{
$modules = [];
$basePath = $this->getProjectPath();
// Get all modules
foreach ($this->getModulePaths() as $modulePath) {
// Filter by non-composer folders
$composerPath = Util::joinPaths($modulePath, 'composer.json');
if (!file_exists($composerPath)) {
continue;
}
// Ensure this library should be exposed, and has at least one folder
$module = new Library($basePath, $modulePath);
if (!$module->requiresExpose() || !$module->getExposedFolders()) {
continue;
}
// Save this module
$modules[] = $module;
}
return $modules;
} | [
"protected",
"function",
"getAllLibraries",
"(",
")",
"{",
"$",
"modules",
"=",
"[",
"]",
";",
"$",
"basePath",
"=",
"$",
"this",
"->",
"getProjectPath",
"(",
")",
";",
"// Get all modules",
"foreach",
"(",
"$",
"this",
"->",
"getModulePaths",
"(",
")",
... | Get all libraries
@return Library[] | [
"Get",
"all",
"libraries"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/Console/VendorExposeCommand.php#L63-L86 |
43,347 | silverstripe/vendor-plugin | src/Console/VendorExposeCommand.php | VendorExposeCommand.isPathModule | protected function isPathModule($path)
{
return file_exists(Util::joinPaths($path, '_config'))
|| file_exists(Util::joinPaths($path, '_config.php'));
} | php | protected function isPathModule($path)
{
return file_exists(Util::joinPaths($path, '_config'))
|| file_exists(Util::joinPaths($path, '_config.php'));
} | [
"protected",
"function",
"isPathModule",
"(",
"$",
"path",
")",
"{",
"return",
"file_exists",
"(",
"Util",
"::",
"joinPaths",
"(",
"$",
"path",
",",
"'_config'",
")",
")",
"||",
"file_exists",
"(",
"Util",
"::",
"joinPaths",
"(",
"$",
"path",
",",
"'_con... | Check if the given path is a silverstripe module
@param string $path
@return bool | [
"Check",
"if",
"the",
"given",
"path",
"is",
"a",
"silverstripe",
"module"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/Console/VendorExposeCommand.php#L145-L149 |
43,348 | silverstripe/vendor-plugin | src/VendorExposeTask.php | VendorExposeTask.process | public function process(IOInterface $io, array $libraries, $methodKey = null)
{
// No-op
if (empty($libraries)) {
return;
}
// Setup root folder
$this->setupResources($io);
// Get or choose method
if (!$methodKey) {
$methodKey = $this->getMethodKey();
}
$method = $this->getMethod($methodKey);
// Update all modules
foreach ($libraries as $module) {
// Skip this module if no exposure required
if (!$module->requiresExpose()) {
continue;
}
$name = $module->getName();
$type = $module->getType();
$io->write(
"Exposing web directories for {$type} <info>{$name}</info> with method <info>{$methodKey}</info>:"
);
foreach ($module->getExposedFolders() as $folder) {
$io->write(" - <info>$folder</info>");
}
// Expose web dirs with given method
$module->exposePaths($method);
}
// On success, write `.method` token to persist for subsequent updates
$this->saveMethodKey($methodKey);
} | php | public function process(IOInterface $io, array $libraries, $methodKey = null)
{
// No-op
if (empty($libraries)) {
return;
}
// Setup root folder
$this->setupResources($io);
// Get or choose method
if (!$methodKey) {
$methodKey = $this->getMethodKey();
}
$method = $this->getMethod($methodKey);
// Update all modules
foreach ($libraries as $module) {
// Skip this module if no exposure required
if (!$module->requiresExpose()) {
continue;
}
$name = $module->getName();
$type = $module->getType();
$io->write(
"Exposing web directories for {$type} <info>{$name}</info> with method <info>{$methodKey}</info>:"
);
foreach ($module->getExposedFolders() as $folder) {
$io->write(" - <info>$folder</info>");
}
// Expose web dirs with given method
$module->exposePaths($method);
}
// On success, write `.method` token to persist for subsequent updates
$this->saveMethodKey($methodKey);
} | [
"public",
"function",
"process",
"(",
"IOInterface",
"$",
"io",
",",
"array",
"$",
"libraries",
",",
"$",
"methodKey",
"=",
"null",
")",
"{",
"// No-op",
"if",
"(",
"empty",
"(",
"$",
"libraries",
")",
")",
"{",
"return",
";",
"}",
"// Setup root folder"... | Expose all modules with the given method
@param IOInterface $io
@param Library[] $libraries
@param string $methodKey Method key, or null to auto-detect from environment | [
"Expose",
"all",
"modules",
"with",
"the",
"given",
"method"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/VendorExposeTask.php#L62-L99 |
43,349 | silverstripe/vendor-plugin | src/VendorExposeTask.php | VendorExposeTask.setupResources | protected function setupResources(IOInterface $io)
{
// Setup root dir
$resourcesPath = $this->getResourcesPath();
$this->filesystem->ensureDirectoryExists($resourcesPath);
// Copy missing resources
$files = new DirectoryIterator(__DIR__.'/../resources');
foreach ($files as $file) {
$targetPath = $resourcesPath . DIRECTORY_SEPARATOR . $file->getFilename();
if ($file->isFile() && !file_exists($targetPath)) {
$name = $file->getFilename();
$io->write("Writing <info>{$name}</info> to resources folder");
copy($file->getPathname(), $targetPath);
}
}
} | php | protected function setupResources(IOInterface $io)
{
// Setup root dir
$resourcesPath = $this->getResourcesPath();
$this->filesystem->ensureDirectoryExists($resourcesPath);
// Copy missing resources
$files = new DirectoryIterator(__DIR__.'/../resources');
foreach ($files as $file) {
$targetPath = $resourcesPath . DIRECTORY_SEPARATOR . $file->getFilename();
if ($file->isFile() && !file_exists($targetPath)) {
$name = $file->getFilename();
$io->write("Writing <info>{$name}</info> to resources folder");
copy($file->getPathname(), $targetPath);
}
}
} | [
"protected",
"function",
"setupResources",
"(",
"IOInterface",
"$",
"io",
")",
"{",
"// Setup root dir",
"$",
"resourcesPath",
"=",
"$",
"this",
"->",
"getResourcesPath",
"(",
")",
";",
"$",
"this",
"->",
"filesystem",
"->",
"ensureDirectoryExists",
"(",
"$",
... | Ensure the resources folder is safely created and protected from index.php in root
@param IOInterface $io | [
"Ensure",
"the",
"resources",
"folder",
"is",
"safely",
"created",
"and",
"protected",
"from",
"index",
".",
"php",
"in",
"root"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/VendorExposeTask.php#L107-L123 |
43,350 | silverstripe/vendor-plugin | src/VendorExposeTask.php | VendorExposeTask.getMethod | protected function getMethod($key)
{
switch ($key) {
case CopyMethod::NAME:
return new CopyMethod();
case SymlinkMethod::NAME:
return new SymlinkMethod();
case JunctionMethod::NAME:
return new JunctionMethod();
case VendorPlugin::METHOD_NONE:
// 'none' is forced to an empty chain
return new ChainedMethod([]);
case VendorPlugin::METHOD_AUTO:
// Default to safe-failover method
if (Platform::isWindows()) {
// Use junctions on windows environment
return new ChainedMethod(new JunctionMethod(), new CopyMethod());
} else {
// Use symlink on non-windows environments
return new ChainedMethod(new SymlinkMethod(), new CopyMethod());
}
default:
throw new InvalidArgumentException("Invalid method: {$key}");
}
} | php | protected function getMethod($key)
{
switch ($key) {
case CopyMethod::NAME:
return new CopyMethod();
case SymlinkMethod::NAME:
return new SymlinkMethod();
case JunctionMethod::NAME:
return new JunctionMethod();
case VendorPlugin::METHOD_NONE:
// 'none' is forced to an empty chain
return new ChainedMethod([]);
case VendorPlugin::METHOD_AUTO:
// Default to safe-failover method
if (Platform::isWindows()) {
// Use junctions on windows environment
return new ChainedMethod(new JunctionMethod(), new CopyMethod());
} else {
// Use symlink on non-windows environments
return new ChainedMethod(new SymlinkMethod(), new CopyMethod());
}
default:
throw new InvalidArgumentException("Invalid method: {$key}");
}
} | [
"protected",
"function",
"getMethod",
"(",
"$",
"key",
")",
"{",
"switch",
"(",
"$",
"key",
")",
"{",
"case",
"CopyMethod",
"::",
"NAME",
":",
"return",
"new",
"CopyMethod",
"(",
")",
";",
"case",
"SymlinkMethod",
"::",
"NAME",
":",
"return",
"new",
"S... | Get named method instance
@param string $key Key of method to use
@return ExposeMethod | [
"Get",
"named",
"method",
"instance"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/VendorExposeTask.php#L131-L155 |
43,351 | silverstripe/vendor-plugin | src/VendorExposeTask.php | VendorExposeTask.getMethodKey | protected function getMethodKey()
{
// Switch if `resources/.method` contains a file
$methodFilePath = $this->getMethodFilePath();
if (file_exists($methodFilePath) && is_readable($methodFilePath)) {
return trim(file_get_contents($methodFilePath));
}
// Switch based on SS_VENDOR_METHOD arg
$method = getenv(VendorPlugin::METHOD_ENV);
if ($method) {
return $method;
}
// Default method
return VendorPlugin::METHOD_DEFAULT;
} | php | protected function getMethodKey()
{
// Switch if `resources/.method` contains a file
$methodFilePath = $this->getMethodFilePath();
if (file_exists($methodFilePath) && is_readable($methodFilePath)) {
return trim(file_get_contents($methodFilePath));
}
// Switch based on SS_VENDOR_METHOD arg
$method = getenv(VendorPlugin::METHOD_ENV);
if ($method) {
return $method;
}
// Default method
return VendorPlugin::METHOD_DEFAULT;
} | [
"protected",
"function",
"getMethodKey",
"(",
")",
"{",
"// Switch if `resources/.method` contains a file",
"$",
"methodFilePath",
"=",
"$",
"this",
"->",
"getMethodFilePath",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"methodFilePath",
")",
"&&",
"is_readab... | Get 'key' of method to use
@return string | [
"Get",
"key",
"of",
"method",
"to",
"use"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/VendorExposeTask.php#L162-L178 |
43,352 | silverstripe/vendor-plugin | src/Methods/ChainedMethod.php | ChainedMethod.exposeDirectory | public function exposeDirectory($source, $target)
{
$lastException = null;
foreach ($this->failovers as $failover) {
try {
$failover->exposeDirectory($source, $target);
return; // Return on first success
} catch (RuntimeException $lastException) {
}
}
if ($lastException) {
throw $lastException;
}
} | php | public function exposeDirectory($source, $target)
{
$lastException = null;
foreach ($this->failovers as $failover) {
try {
$failover->exposeDirectory($source, $target);
return; // Return on first success
} catch (RuntimeException $lastException) {
}
}
if ($lastException) {
throw $lastException;
}
} | [
"public",
"function",
"exposeDirectory",
"(",
"$",
"source",
",",
"$",
"target",
")",
"{",
"$",
"lastException",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"failovers",
"as",
"$",
"failover",
")",
"{",
"try",
"{",
"$",
"failover",
"->",
"expo... | Exposes the directory with the given paths
@param string $source Full filesystem path to file source
@param string $target Full filesystem path to the target directory
@throws RuntimeException If could not be exposed | [
"Exposes",
"the",
"directory",
"with",
"the",
"given",
"paths"
] | 87769ad5770921428e74cc7de6ba4f217399b005 | https://github.com/silverstripe/vendor-plugin/blob/87769ad5770921428e74cc7de6ba4f217399b005/src/Methods/ChainedMethod.php#L33-L46 |
43,353 | php-http/mock-client | src/Client.php | Client.on | public function on(RequestMatcher $requestMatcher, $result)
{
$callable = null;
switch (true) {
case is_callable($result):
$callable = $result;
break;
case $result instanceof ResponseInterface:
$callable = function () use ($result) {
return $result;
};
break;
case $result instanceof \Exception:
$callable = function () use ($result) {
throw $result;
};
break;
default:
throw new \InvalidArgumentException('Result must be either a response, an exception, or a callable');
}
$this->conditionalResults[] = [
'matcher' => $requestMatcher,
'callable' => $callable,
];
} | php | public function on(RequestMatcher $requestMatcher, $result)
{
$callable = null;
switch (true) {
case is_callable($result):
$callable = $result;
break;
case $result instanceof ResponseInterface:
$callable = function () use ($result) {
return $result;
};
break;
case $result instanceof \Exception:
$callable = function () use ($result) {
throw $result;
};
break;
default:
throw new \InvalidArgumentException('Result must be either a response, an exception, or a callable');
}
$this->conditionalResults[] = [
'matcher' => $requestMatcher,
'callable' => $callable,
];
} | [
"public",
"function",
"on",
"(",
"RequestMatcher",
"$",
"requestMatcher",
",",
"$",
"result",
")",
"{",
"$",
"callable",
"=",
"null",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"is_callable",
"(",
"$",
"result",
")",
":",
"$",
"callable",
"=",
"$",
... | Adds an exception to be thrown or response to be returned if the request
matcher matches.
For more complex logic, pass a callable as $result. The method is given
the request and MUST either return a ResponseInterface or throw an
exception that implements the PSR-18 / HTTPlug exception interface.
@param ResponseInterface|Exception|ClientExceptionInterface|callable $result | [
"Adds",
"an",
"exception",
"to",
"be",
"thrown",
"or",
"response",
"to",
"be",
"returned",
"if",
"the",
"request",
"matcher",
"matches",
"."
] | d364c4a2847229dd37237d0083887889d3bd8564 | https://github.com/php-http/mock-client/blob/d364c4a2847229dd37237d0083887889d3bd8564/src/Client.php#L123-L151 |
43,354 | php-http/mock-client | src/Client.php | Client.addException | public function addException(\Exception $exception)
{
if (!$exception instanceof Exception) {
@trigger_error('Clients may only throw exceptions of type '.Exception::class.'. Setting an exception of class '.get_class($exception).' will not be possible anymore in the future', E_USER_DEPRECATED);
}
$this->exceptions[] = $exception;
} | php | public function addException(\Exception $exception)
{
if (!$exception instanceof Exception) {
@trigger_error('Clients may only throw exceptions of type '.Exception::class.'. Setting an exception of class '.get_class($exception).' will not be possible anymore in the future', E_USER_DEPRECATED);
}
$this->exceptions[] = $exception;
} | [
"public",
"function",
"addException",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"if",
"(",
"!",
"$",
"exception",
"instanceof",
"Exception",
")",
"{",
"@",
"trigger_error",
"(",
"'Clients may only throw exceptions of type '",
".",
"Exception",
"::",
"cla... | Adds an exception that will be thrown. | [
"Adds",
"an",
"exception",
"that",
"will",
"be",
"thrown",
"."
] | d364c4a2847229dd37237d0083887889d3bd8564 | https://github.com/php-http/mock-client/blob/d364c4a2847229dd37237d0083887889d3bd8564/src/Client.php#L156-L162 |
43,355 | php-http/mock-client | src/Client.php | Client.setDefaultException | public function setDefaultException(\Exception $defaultException = null)
{
if (!$defaultException instanceof Exception) {
@trigger_error('Clients may only throw exceptions of type '.Exception::class.'. Setting an exception of class '.get_class($defaultException).' will not be possible anymore in the future', E_USER_DEPRECATED);
}
$this->defaultException = $defaultException;
} | php | public function setDefaultException(\Exception $defaultException = null)
{
if (!$defaultException instanceof Exception) {
@trigger_error('Clients may only throw exceptions of type '.Exception::class.'. Setting an exception of class '.get_class($defaultException).' will not be possible anymore in the future', E_USER_DEPRECATED);
}
$this->defaultException = $defaultException;
} | [
"public",
"function",
"setDefaultException",
"(",
"\\",
"Exception",
"$",
"defaultException",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"defaultException",
"instanceof",
"Exception",
")",
"{",
"@",
"trigger_error",
"(",
"'Clients may only throw exceptions of type '"... | Sets the default exception to throw when the list of added exceptions and responses is exhausted.
If both a default exception and a default response are set, the exception will be thrown. | [
"Sets",
"the",
"default",
"exception",
"to",
"throw",
"when",
"the",
"list",
"of",
"added",
"exceptions",
"and",
"responses",
"is",
"exhausted",
"."
] | d364c4a2847229dd37237d0083887889d3bd8564 | https://github.com/php-http/mock-client/blob/d364c4a2847229dd37237d0083887889d3bd8564/src/Client.php#L169-L175 |
43,356 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.getConfigurationBuilder | protected function getConfigurationBuilder()
{
return Builder::create()
->enableTags()
->enableCategories()
->enableLimit()
->enablePagination()
->enablePresentAs()
->setDeepLink('articles/{locale}/edit:{id}/details')
->enableSorting(
[
['column' => 'published', 'title' => 'sulu_article.smart-content.published'],
['column' => 'authored', 'title' => 'sulu_article.smart-content.authored'],
['column' => 'created', 'title' => 'sulu_article.smart-content.created'],
['column' => 'title', 'title' => 'sulu_article.smart-content.title'],
['column' => 'author_full_name', 'title' => 'sulu_article.smart-content.author-full-name'],
]
);
} | php | protected function getConfigurationBuilder()
{
return Builder::create()
->enableTags()
->enableCategories()
->enableLimit()
->enablePagination()
->enablePresentAs()
->setDeepLink('articles/{locale}/edit:{id}/details')
->enableSorting(
[
['column' => 'published', 'title' => 'sulu_article.smart-content.published'],
['column' => 'authored', 'title' => 'sulu_article.smart-content.authored'],
['column' => 'created', 'title' => 'sulu_article.smart-content.created'],
['column' => 'title', 'title' => 'sulu_article.smart-content.title'],
['column' => 'author_full_name', 'title' => 'sulu_article.smart-content.author-full-name'],
]
);
} | [
"protected",
"function",
"getConfigurationBuilder",
"(",
")",
"{",
"return",
"Builder",
"::",
"create",
"(",
")",
"->",
"enableTags",
"(",
")",
"->",
"enableCategories",
"(",
")",
"->",
"enableLimit",
"(",
")",
"->",
"enablePagination",
"(",
")",
"->",
"enab... | Create new configuration-builder.
@return BuilderInterface | [
"Create",
"new",
"configuration",
"-",
"builder",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L113-L131 |
43,357 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.getSearchResult | private function getSearchResult(array $filters, $limit, $page, $pageSize, $locale, $webspaceKey)
{
$repository = $this->searchManager->getRepository($this->articleDocumentClass);
$search = $this->createSearch($repository->createSearch(), $filters, $locale);
if (!$search) {
return new \ArrayIterator([]);
}
$this->addPagination($search, $pageSize, $page, $limit);
if (array_key_exists('sortBy', $filters) && is_array($filters['sortBy'])) {
$sortMethod = array_key_exists('sortMethod', $filters) ? $filters['sortMethod'] : 'asc';
$this->appendSortBy($filters['sortBy'], $sortMethod, $search);
}
if ($webspaceKey) {
$webspaceQuery = new BoolQuery();
// check for mainWebspace
$webspaceQuery->add(new TermQuery('main_webspace', $webspaceKey), BoolQuery::SHOULD);
// check for additionalWebspaces
$webspaceQuery->add(new TermQuery('additional_webspaces', $webspaceKey), BoolQuery::SHOULD);
$search->addQuery($webspaceQuery);
}
return $repository->findDocuments($search);
} | php | private function getSearchResult(array $filters, $limit, $page, $pageSize, $locale, $webspaceKey)
{
$repository = $this->searchManager->getRepository($this->articleDocumentClass);
$search = $this->createSearch($repository->createSearch(), $filters, $locale);
if (!$search) {
return new \ArrayIterator([]);
}
$this->addPagination($search, $pageSize, $page, $limit);
if (array_key_exists('sortBy', $filters) && is_array($filters['sortBy'])) {
$sortMethod = array_key_exists('sortMethod', $filters) ? $filters['sortMethod'] : 'asc';
$this->appendSortBy($filters['sortBy'], $sortMethod, $search);
}
if ($webspaceKey) {
$webspaceQuery = new BoolQuery();
// check for mainWebspace
$webspaceQuery->add(new TermQuery('main_webspace', $webspaceKey), BoolQuery::SHOULD);
// check for additionalWebspaces
$webspaceQuery->add(new TermQuery('additional_webspaces', $webspaceKey), BoolQuery::SHOULD);
$search->addQuery($webspaceQuery);
}
return $repository->findDocuments($search);
} | [
"private",
"function",
"getSearchResult",
"(",
"array",
"$",
"filters",
",",
"$",
"limit",
",",
"$",
"page",
",",
"$",
"pageSize",
",",
"$",
"locale",
",",
"$",
"webspaceKey",
")",
"{",
"$",
"repository",
"=",
"$",
"this",
"->",
"searchManager",
"->",
... | Creates search for filters and returns search-result.
@param array $filters
@param int $limit
@param int $page
@param int $pageSize
@param string $locale
@param null|string $webspaceKey
@return \Countable | [
"Creates",
"search",
"for",
"filters",
"and",
"returns",
"search",
"-",
"result",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L265-L293 |
43,358 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.createSearch | protected function createSearch(Search $search, array $filters, $locale)
{
if (0 < count($filters['excluded'])) {
foreach ($filters['excluded'] as $uuid) {
$search->addQuery(new TermQuery('uuid', $uuid), BoolQuery::MUST_NOT);
}
}
$query = new BoolQuery();
$queriesCount = 0;
$operator = $this->getFilter($filters, 'tagOperator', 'or');
$this->addBoolQuery('tags', $filters, 'excerpt.tags.id', $operator, $query, $queriesCount);
$operator = $this->getFilter($filters, 'websiteTagsOperator', 'or');
$this->addBoolQuery('websiteTags', $filters, 'excerpt.tags.id', $operator, $query, $queriesCount);
$operator = $this->getFilter($filters, 'categoryOperator', 'or');
$this->addBoolQuery('categories', $filters, 'excerpt.categories.id', $operator, $query, $queriesCount);
$operator = $this->getFilter($filters, 'websiteCategoriesOperator', 'or');
$this->addBoolQuery('websiteCategories', $filters, 'excerpt.categories.id', $operator, $query, $queriesCount);
if (null !== $locale) {
$search->addQuery(new TermQuery('locale', $locale));
}
if (array_key_exists('types', $filters) && $filters['types']) {
$typesQuery = new BoolQuery();
foreach ($filters['types'] as $typeFilter) {
$typesQuery->add(new TermQuery('type', $typeFilter), BoolQuery::SHOULD);
}
$search->addQuery($typesQuery);
}
if (array_key_exists('structureTypes', $filters) && $filters['structureTypes']) {
$strTypesQuery = new BoolQuery();
foreach ($filters['structureTypes'] as $filter) {
$strTypesQuery->add(new TermQuery('structure_type', $filter), BoolQuery::SHOULD);
}
$search->addQuery($strTypesQuery);
}
if (0 === $queriesCount) {
$search->addQuery(new MatchAllQuery(), BoolQuery::MUST);
} else {
$search->addQuery($query, BoolQuery::MUST);
}
return $search;
} | php | protected function createSearch(Search $search, array $filters, $locale)
{
if (0 < count($filters['excluded'])) {
foreach ($filters['excluded'] as $uuid) {
$search->addQuery(new TermQuery('uuid', $uuid), BoolQuery::MUST_NOT);
}
}
$query = new BoolQuery();
$queriesCount = 0;
$operator = $this->getFilter($filters, 'tagOperator', 'or');
$this->addBoolQuery('tags', $filters, 'excerpt.tags.id', $operator, $query, $queriesCount);
$operator = $this->getFilter($filters, 'websiteTagsOperator', 'or');
$this->addBoolQuery('websiteTags', $filters, 'excerpt.tags.id', $operator, $query, $queriesCount);
$operator = $this->getFilter($filters, 'categoryOperator', 'or');
$this->addBoolQuery('categories', $filters, 'excerpt.categories.id', $operator, $query, $queriesCount);
$operator = $this->getFilter($filters, 'websiteCategoriesOperator', 'or');
$this->addBoolQuery('websiteCategories', $filters, 'excerpt.categories.id', $operator, $query, $queriesCount);
if (null !== $locale) {
$search->addQuery(new TermQuery('locale', $locale));
}
if (array_key_exists('types', $filters) && $filters['types']) {
$typesQuery = new BoolQuery();
foreach ($filters['types'] as $typeFilter) {
$typesQuery->add(new TermQuery('type', $typeFilter), BoolQuery::SHOULD);
}
$search->addQuery($typesQuery);
}
if (array_key_exists('structureTypes', $filters) && $filters['structureTypes']) {
$strTypesQuery = new BoolQuery();
foreach ($filters['structureTypes'] as $filter) {
$strTypesQuery->add(new TermQuery('structure_type', $filter), BoolQuery::SHOULD);
}
$search->addQuery($strTypesQuery);
}
if (0 === $queriesCount) {
$search->addQuery(new MatchAllQuery(), BoolQuery::MUST);
} else {
$search->addQuery($query, BoolQuery::MUST);
}
return $search;
} | [
"protected",
"function",
"createSearch",
"(",
"Search",
"$",
"search",
",",
"array",
"$",
"filters",
",",
"$",
"locale",
")",
"{",
"if",
"(",
"0",
"<",
"count",
"(",
"$",
"filters",
"[",
"'excluded'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"filters... | Initialize search with neccesary queries.
@param Search $search
@param array $filters
@param string $locale
@return Search | [
"Initialize",
"search",
"with",
"neccesary",
"queries",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L304-L352 |
43,359 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.getTypesProperty | private function getTypesProperty($propertyParameter)
{
$filterTypes = [];
if (array_key_exists('types', $propertyParameter)
&& null !== ($types = explode(',', $propertyParameter['types']->getValue()))
) {
foreach ($types as $type) {
$filterTypes[] = $type;
}
}
return $filterTypes;
} | php | private function getTypesProperty($propertyParameter)
{
$filterTypes = [];
if (array_key_exists('types', $propertyParameter)
&& null !== ($types = explode(',', $propertyParameter['types']->getValue()))
) {
foreach ($types as $type) {
$filterTypes[] = $type;
}
}
return $filterTypes;
} | [
"private",
"function",
"getTypesProperty",
"(",
"$",
"propertyParameter",
")",
"{",
"$",
"filterTypes",
"=",
"[",
"]",
";",
"if",
"(",
"array_key_exists",
"(",
"'types'",
",",
"$",
"propertyParameter",
")",
"&&",
"null",
"!==",
"(",
"$",
"types",
"=",
"exp... | Returns array with all types defined in property parameter.
@param array $propertyParameter
@return array | [
"Returns",
"array",
"with",
"all",
"types",
"defined",
"in",
"property",
"parameter",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L361-L374 |
43,360 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.getExcludedFilter | private function getExcludedFilter(array $filters, array $propertyParameter)
{
$excluded = array_key_exists('excluded', $filters) ? $filters['excluded'] : [];
if (array_key_exists('exclude_duplicates', $propertyParameter)
&& $propertyParameter['exclude_duplicates']->getValue()
) {
$excluded = array_merge($excluded, $this->referenceStore->getAll());
}
return $excluded;
} | php | private function getExcludedFilter(array $filters, array $propertyParameter)
{
$excluded = array_key_exists('excluded', $filters) ? $filters['excluded'] : [];
if (array_key_exists('exclude_duplicates', $propertyParameter)
&& $propertyParameter['exclude_duplicates']->getValue()
) {
$excluded = array_merge($excluded, $this->referenceStore->getAll());
}
return $excluded;
} | [
"private",
"function",
"getExcludedFilter",
"(",
"array",
"$",
"filters",
",",
"array",
"$",
"propertyParameter",
")",
"{",
"$",
"excluded",
"=",
"array_key_exists",
"(",
"'excluded'",
",",
"$",
"filters",
")",
"?",
"$",
"filters",
"[",
"'excluded'",
"]",
":... | Returns excluded articles.
@param array $filters
@param PropertyParameter[] $propertyParameter
@return array | [
"Returns",
"excluded",
"articles",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L406-L416 |
43,361 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.addPagination | private function addPagination(Search $search, $pageSize, $page, $limit)
{
$offset = 0;
if ($pageSize) {
$pageSize = intval($pageSize);
$offset = ($page - 1) * $pageSize;
}
if (null === $limit) {
$limit = $this->defaultLimit;
}
if (null === $pageSize || $offset + $pageSize > $limit) {
$pageSize = $limit - $offset;
if ($pageSize < 0) {
$pageSize = 0;
}
}
$search->setFrom($offset);
$search->setSize($pageSize);
} | php | private function addPagination(Search $search, $pageSize, $page, $limit)
{
$offset = 0;
if ($pageSize) {
$pageSize = intval($pageSize);
$offset = ($page - 1) * $pageSize;
}
if (null === $limit) {
$limit = $this->defaultLimit;
}
if (null === $pageSize || $offset + $pageSize > $limit) {
$pageSize = $limit - $offset;
if ($pageSize < 0) {
$pageSize = 0;
}
}
$search->setFrom($offset);
$search->setSize($pageSize);
} | [
"private",
"function",
"addPagination",
"(",
"Search",
"$",
"search",
",",
"$",
"pageSize",
",",
"$",
"page",
",",
"$",
"limit",
")",
"{",
"$",
"offset",
"=",
"0",
";",
"if",
"(",
"$",
"pageSize",
")",
"{",
"$",
"pageSize",
"=",
"intval",
"(",
"$",... | Add the pagination to given query.
@param Search $search
@param int $pageSize
@param int $page
@param int $limit | [
"Add",
"the",
"pagination",
"to",
"given",
"query",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L442-L464 |
43,362 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.addBoolQuery | private function addBoolQuery($filterName, array $filters, $field, $operator, BoolQuery $query, &$queriesCount)
{
if (0 !== count($tags = $this->getFilter($filters, $filterName, []))) {
++$queriesCount;
$query->add($this->getBoolQuery($field, $tags, $operator));
}
} | php | private function addBoolQuery($filterName, array $filters, $field, $operator, BoolQuery $query, &$queriesCount)
{
if (0 !== count($tags = $this->getFilter($filters, $filterName, []))) {
++$queriesCount;
$query->add($this->getBoolQuery($field, $tags, $operator));
}
} | [
"private",
"function",
"addBoolQuery",
"(",
"$",
"filterName",
",",
"array",
"$",
"filters",
",",
"$",
"field",
",",
"$",
"operator",
",",
"BoolQuery",
"$",
"query",
",",
"&",
"$",
"queriesCount",
")",
"{",
"if",
"(",
"0",
"!==",
"count",
"(",
"$",
"... | Add a boolean-query if filter exists.
@param string $filterName
@param array $filters
@param string $field
@param string $operator
@param BoolQuery $query
@param int $queriesCount | [
"Add",
"a",
"boolean",
"-",
"query",
"if",
"filter",
"exists",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L476-L482 |
43,363 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.getBoolQuery | private function getBoolQuery($field, array $values, $operator)
{
$type = ('or' === strtolower($operator) ? BoolQuery::SHOULD : BoolQuery::MUST);
$query = new BoolQuery();
foreach ($values as $value) {
$query->add(new TermQuery($field, $value), $type);
}
return $query;
} | php | private function getBoolQuery($field, array $values, $operator)
{
$type = ('or' === strtolower($operator) ? BoolQuery::SHOULD : BoolQuery::MUST);
$query = new BoolQuery();
foreach ($values as $value) {
$query->add(new TermQuery($field, $value), $type);
}
return $query;
} | [
"private",
"function",
"getBoolQuery",
"(",
"$",
"field",
",",
"array",
"$",
"values",
",",
"$",
"operator",
")",
"{",
"$",
"type",
"=",
"(",
"'or'",
"===",
"strtolower",
"(",
"$",
"operator",
")",
"?",
"BoolQuery",
"::",
"SHOULD",
":",
"BoolQuery",
":... | Returns boolean query for given fields and values.
@param string $field
@param array $values
@param string $operator
@return BoolQuery | [
"Returns",
"boolean",
"query",
"for",
"given",
"fields",
"and",
"values",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L493-L503 |
43,364 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.getFilter | private function getFilter(array $filters, $name, $default = null)
{
if ($this->hasFilter($filters, $name)) {
return $filters[$name];
}
return $default;
} | php | private function getFilter(array $filters, $name, $default = null)
{
if ($this->hasFilter($filters, $name)) {
return $filters[$name];
}
return $default;
} | [
"private",
"function",
"getFilter",
"(",
"array",
"$",
"filters",
",",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasFilter",
"(",
"$",
"filters",
",",
"$",
"name",
")",
")",
"{",
"return",
"$",
"filters... | Returns filter value.
@param array $filters
@param string $name
@param mixed $default
@return mixed | [
"Returns",
"filter",
"value",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L514-L521 |
43,365 | sulu/SuluArticleBundle | Content/ArticleDataProvider.php | ArticleDataProvider.getResource | private function getResource($uuid, $locale)
{
return $this->proxyFactory->createProxy(
ArticleDocument::class,
function (
&$wrappedObject,
LazyLoadingInterface $proxy,
$method,
array $parameters,
&$initializer
) use ($uuid, $locale) {
$initializer = null;
$wrappedObject = $this->documentManager->find($uuid, $locale);
return true;
}
);
} | php | private function getResource($uuid, $locale)
{
return $this->proxyFactory->createProxy(
ArticleDocument::class,
function (
&$wrappedObject,
LazyLoadingInterface $proxy,
$method,
array $parameters,
&$initializer
) use ($uuid, $locale) {
$initializer = null;
$wrappedObject = $this->documentManager->find($uuid, $locale);
return true;
}
);
} | [
"private",
"function",
"getResource",
"(",
"$",
"uuid",
",",
"$",
"locale",
")",
"{",
"return",
"$",
"this",
"->",
"proxyFactory",
"->",
"createProxy",
"(",
"ArticleDocument",
"::",
"class",
",",
"function",
"(",
"&",
"$",
"wrappedObject",
",",
"LazyLoadingI... | Returns Proxy document for uuid.
@param string $uuid
@param string $locale
@return object | [
"Returns",
"Proxy",
"document",
"for",
"uuid",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleDataProvider.php#L544-L561 |
43,366 | sulu/SuluArticleBundle | Content/ArticleResourceItemFactory.php | ArticleResourceItemFactory.createResourceItem | public function createResourceItem(ArticleViewDocumentInterface $articleViewDocument)
{
return new ArticleResourceItem(
$articleViewDocument,
$this->getResource($articleViewDocument->getUuid(), $articleViewDocument->getLocale())
);
} | php | public function createResourceItem(ArticleViewDocumentInterface $articleViewDocument)
{
return new ArticleResourceItem(
$articleViewDocument,
$this->getResource($articleViewDocument->getUuid(), $articleViewDocument->getLocale())
);
} | [
"public",
"function",
"createResourceItem",
"(",
"ArticleViewDocumentInterface",
"$",
"articleViewDocument",
")",
"{",
"return",
"new",
"ArticleResourceItem",
"(",
"$",
"articleViewDocument",
",",
"$",
"this",
"->",
"getResource",
"(",
"$",
"articleViewDocument",
"->",
... | Creates and returns article source item with proxy document.
@param ArticleViewDocumentInterface $articleViewDocument
@return ArticleResourceItem | [
"Creates",
"and",
"returns",
"article",
"source",
"item",
"with",
"proxy",
"document",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Content/ArticleResourceItemFactory.php#L54-L60 |
43,367 | sulu/SuluArticleBundle | Document/Repository/ArticleViewDocumentRepository.php | ArticleViewDocumentRepository.findRecent | public function findRecent(
$excludeUuid = null,
$limit = self::DEFAULT_LIMIT,
array $types = null,
$locale = null,
$webspaceKey = null
) {
$search = $this->createSearch($limit, $types, $locale, $webspaceKey);
if ($excludeUuid) {
$search->addQuery(new TermQuery('uuid', $excludeUuid), BoolQuery::MUST_NOT);
}
$search->addSort(new FieldSort('authored', FieldSort::DESC));
return $this->repository->findDocuments($search);
} | php | public function findRecent(
$excludeUuid = null,
$limit = self::DEFAULT_LIMIT,
array $types = null,
$locale = null,
$webspaceKey = null
) {
$search = $this->createSearch($limit, $types, $locale, $webspaceKey);
if ($excludeUuid) {
$search->addQuery(new TermQuery('uuid', $excludeUuid), BoolQuery::MUST_NOT);
}
$search->addSort(new FieldSort('authored', FieldSort::DESC));
return $this->repository->findDocuments($search);
} | [
"public",
"function",
"findRecent",
"(",
"$",
"excludeUuid",
"=",
"null",
",",
"$",
"limit",
"=",
"self",
"::",
"DEFAULT_LIMIT",
",",
"array",
"$",
"types",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
",",
"$",
"webspaceKey",
"=",
"null",
")",
"{",
... | Finds recent articles for given parameters sorted by field `authored`.
@param null|string $excludeUuid
@param int $limit
@param null|array $types
@param null|string $locale
@param null|string $webspaceKey
@return DocumentIterator | [
"Finds",
"recent",
"articles",
"for",
"given",
"parameters",
"sorted",
"by",
"field",
"authored",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Repository/ArticleViewDocumentRepository.php#L86-L102 |
43,368 | sulu/SuluArticleBundle | Document/Repository/ArticleViewDocumentRepository.php | ArticleViewDocumentRepository.findSimilar | public function findSimilar(
$uuid,
$limit = self::DEFAULT_LIMIT,
array $types = null,
$locale = null,
$webspaceKey = null
) {
$search = $this->createSearch($limit, $types, $locale, $webspaceKey);
$search->addQuery(
new MoreLikeThisQuery(
null,
[
'fields' => $this->searchFields,
'min_term_freq' => 1,
'min_doc_freq' => 2,
'like' => [
[
'_id' => $this->getViewDocumentId($uuid, $locale),
],
],
]
)
);
return $this->repository->findDocuments($search);
} | php | public function findSimilar(
$uuid,
$limit = self::DEFAULT_LIMIT,
array $types = null,
$locale = null,
$webspaceKey = null
) {
$search = $this->createSearch($limit, $types, $locale, $webspaceKey);
$search->addQuery(
new MoreLikeThisQuery(
null,
[
'fields' => $this->searchFields,
'min_term_freq' => 1,
'min_doc_freq' => 2,
'like' => [
[
'_id' => $this->getViewDocumentId($uuid, $locale),
],
],
]
)
);
return $this->repository->findDocuments($search);
} | [
"public",
"function",
"findSimilar",
"(",
"$",
"uuid",
",",
"$",
"limit",
"=",
"self",
"::",
"DEFAULT_LIMIT",
",",
"array",
"$",
"types",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
",",
"$",
"webspaceKey",
"=",
"null",
")",
"{",
"$",
"search",
"="... | Finds similar articles for given `uuid` with given parameters.
@param string $uuid
@param int $limit
@param null|array $types
@param null|string $locale
@param null|string $webspaceKey
@return DocumentIterator | [
"Finds",
"similar",
"articles",
"for",
"given",
"uuid",
"with",
"given",
"parameters",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Repository/ArticleViewDocumentRepository.php#L115-L141 |
43,369 | sulu/SuluArticleBundle | DependencyInjection/SuluArticleExtension.php | SuluArticleExtension.appendDefaultAuthor | private function appendDefaultAuthor(array $config, ContainerBuilder $container)
{
$mapping = $container->getParameter('sulu_document_manager.mapping');
foreach ($mapping as $key => $item) {
if ('article' === $item['alias']) {
$mapping[$key]['set_default_author'] = $config['default_author'];
}
}
$container->setParameter('sulu_document_manager.mapping', $mapping);
$container->setParameter('sulu_article.default_author', $config['default_author']);
} | php | private function appendDefaultAuthor(array $config, ContainerBuilder $container)
{
$mapping = $container->getParameter('sulu_document_manager.mapping');
foreach ($mapping as $key => $item) {
if ('article' === $item['alias']) {
$mapping[$key]['set_default_author'] = $config['default_author'];
}
}
$container->setParameter('sulu_document_manager.mapping', $mapping);
$container->setParameter('sulu_article.default_author', $config['default_author']);
} | [
"private",
"function",
"appendDefaultAuthor",
"(",
"array",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"mapping",
"=",
"$",
"container",
"->",
"getParameter",
"(",
"'sulu_document_manager.mapping'",
")",
";",
"foreach",
"(",
"$",
"m... | Append configuration for article "set_default_author".
@param array $config
@param ContainerBuilder $container | [
"Append",
"configuration",
"for",
"article",
"set_default_author",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/DependencyInjection/SuluArticleExtension.php#L222-L233 |
43,370 | sulu/SuluArticleBundle | DependencyInjection/SuluArticleExtension.php | SuluArticleExtension.cloneArticleConfig | private function cloneArticleConfig(array $config, $type)
{
$result = [];
foreach ($config as $item) {
$result[] = ['path' => $item['path'], 'type' => $type];
}
return $result;
} | php | private function cloneArticleConfig(array $config, $type)
{
$result = [];
foreach ($config as $item) {
$result[] = ['path' => $item['path'], 'type' => $type];
}
return $result;
} | [
"private",
"function",
"cloneArticleConfig",
"(",
"array",
"$",
"config",
",",
"$",
"type",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"config",
"as",
"$",
"item",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"[",
"'path'",
"=>",
... | Clone given path configuration and use given type.
@param array $config
@param string $type
@return array | [
"Clone",
"given",
"path",
"configuration",
"and",
"use",
"given",
"type",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/DependencyInjection/SuluArticleExtension.php#L259-L267 |
43,371 | sulu/SuluArticleBundle | Document/Serializer/ArticleSubscriber.php | ArticleSubscriber.addTypeOnPostSerialize | public function addTypeOnPostSerialize(ObjectEvent $event)
{
$article = $event->getObject();
$visitor = $event->getVisitor();
$context = $event->getContext();
if (!($article instanceof ArticleDocument)) {
return;
}
$structure = $this->structureManager->getStructure($article->getStructureType(), 'article');
$visitor->addData('articleType', $context->accept($this->getType($structure->getStructure())));
} | php | public function addTypeOnPostSerialize(ObjectEvent $event)
{
$article = $event->getObject();
$visitor = $event->getVisitor();
$context = $event->getContext();
if (!($article instanceof ArticleDocument)) {
return;
}
$structure = $this->structureManager->getStructure($article->getStructureType(), 'article');
$visitor->addData('articleType', $context->accept($this->getType($structure->getStructure())));
} | [
"public",
"function",
"addTypeOnPostSerialize",
"(",
"ObjectEvent",
"$",
"event",
")",
"{",
"$",
"article",
"=",
"$",
"event",
"->",
"getObject",
"(",
")",
";",
"$",
"visitor",
"=",
"$",
"event",
"->",
"getVisitor",
"(",
")",
";",
"$",
"context",
"=",
... | Append type to result.
@param ObjectEvent $event | [
"Append",
"type",
"to",
"result",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Serializer/ArticleSubscriber.php#L87-L99 |
43,372 | sulu/SuluArticleBundle | Document/Serializer/ArticleSubscriber.php | ArticleSubscriber.addBrokenIndicatorOnPostSerialize | public function addBrokenIndicatorOnPostSerialize(ObjectEvent $event)
{
$article = $event->getObject();
$visitor = $event->getVisitor();
if (!($article instanceof ArticleViewDocumentInterface)) {
return;
}
$structure = $this->structureManager->getStructure($article->getStructureType(), 'article');
$visitor->addData('broken', !$structure || $structure->getKey() !== $article->getStructureType());
$visitor->addData('originalStructureType', $article->getStructureType());
} | php | public function addBrokenIndicatorOnPostSerialize(ObjectEvent $event)
{
$article = $event->getObject();
$visitor = $event->getVisitor();
if (!($article instanceof ArticleViewDocumentInterface)) {
return;
}
$structure = $this->structureManager->getStructure($article->getStructureType(), 'article');
$visitor->addData('broken', !$structure || $structure->getKey() !== $article->getStructureType());
$visitor->addData('originalStructureType', $article->getStructureType());
} | [
"public",
"function",
"addBrokenIndicatorOnPostSerialize",
"(",
"ObjectEvent",
"$",
"event",
")",
"{",
"$",
"article",
"=",
"$",
"event",
"->",
"getObject",
"(",
")",
";",
"$",
"visitor",
"=",
"$",
"event",
"->",
"getVisitor",
"(",
")",
";",
"if",
"(",
"... | Append broken-indicator to result.
@param ObjectEvent $event | [
"Append",
"broken",
"-",
"indicator",
"to",
"result",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Serializer/ArticleSubscriber.php#L106-L118 |
43,373 | sulu/SuluArticleBundle | Document/Serializer/ArticleSubscriber.php | ArticleSubscriber.addPageTitlePropertyNameOnPostSerialize | public function addPageTitlePropertyNameOnPostSerialize(ObjectEvent $event)
{
$article = $event->getObject();
$visitor = $event->getVisitor();
$context = $event->getContext();
if (!$article instanceof ArticleInterface) {
return;
}
$property = $this->getPageTitleProperty($article);
if ($property) {
$visitor->addData('_pageTitlePropertyName', $context->accept($property->getName()));
}
} | php | public function addPageTitlePropertyNameOnPostSerialize(ObjectEvent $event)
{
$article = $event->getObject();
$visitor = $event->getVisitor();
$context = $event->getContext();
if (!$article instanceof ArticleInterface) {
return;
}
$property = $this->getPageTitleProperty($article);
if ($property) {
$visitor->addData('_pageTitlePropertyName', $context->accept($property->getName()));
}
} | [
"public",
"function",
"addPageTitlePropertyNameOnPostSerialize",
"(",
"ObjectEvent",
"$",
"event",
")",
"{",
"$",
"article",
"=",
"$",
"event",
"->",
"getObject",
"(",
")",
";",
"$",
"visitor",
"=",
"$",
"event",
"->",
"getVisitor",
"(",
")",
";",
"$",
"co... | Append page-title-property to result.
@param ObjectEvent $event | [
"Append",
"page",
"-",
"title",
"-",
"property",
"to",
"result",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Serializer/ArticleSubscriber.php#L125-L139 |
43,374 | sulu/SuluArticleBundle | Document/Serializer/ArticleSubscriber.php | ArticleSubscriber.getPageTitleProperty | private function getPageTitleProperty(ArticleInterface $document)
{
$metadata = $this->structureMetadataFactory->getStructureMetadata(
'article',
$document->getStructureType()
);
if ($metadata->hasPropertyWithTagName(self::PAGE_TITLE_TAG_NAME)) {
return $metadata->getPropertyByTagName(self::PAGE_TITLE_TAG_NAME);
}
if ($metadata->hasProperty(self::PAGE_TITLE_PROPERTY_NAME)) {
return $metadata->getProperty(self::PAGE_TITLE_PROPERTY_NAME);
}
return null;
} | php | private function getPageTitleProperty(ArticleInterface $document)
{
$metadata = $this->structureMetadataFactory->getStructureMetadata(
'article',
$document->getStructureType()
);
if ($metadata->hasPropertyWithTagName(self::PAGE_TITLE_TAG_NAME)) {
return $metadata->getPropertyByTagName(self::PAGE_TITLE_TAG_NAME);
}
if ($metadata->hasProperty(self::PAGE_TITLE_PROPERTY_NAME)) {
return $metadata->getProperty(self::PAGE_TITLE_PROPERTY_NAME);
}
return null;
} | [
"private",
"function",
"getPageTitleProperty",
"(",
"ArticleInterface",
"$",
"document",
")",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"structureMetadataFactory",
"->",
"getStructureMetadata",
"(",
"'article'",
",",
"$",
"document",
"->",
"getStructureType",
"(... | Find page-title property.
@param ArticleInterface $document
@return PropertyMetadata | [
"Find",
"page",
"-",
"title",
"property",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Serializer/ArticleSubscriber.php#L148-L164 |
43,375 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.handleHydrate | public function handleHydrate(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutablePageBehavior) {
return;
}
$locale = $document->getLocale();
if (LocalizationState::SHADOW === $this->documentInspector->getLocalizationState($document)) {
$locale = $document->getOriginalLocale();
}
$propertyName = $this->getRoutePathPropertyName($document->getStructureType(), $locale);
$routePath = $event->getNode()->getPropertyValueWithDefault($propertyName, null);
$document->setRoutePath($routePath);
$route = $this->routeRepository->findByEntity($document->getClass(), $document->getUuid(), $locale);
if ($route) {
$document->setRoute($route);
}
} | php | public function handleHydrate(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutablePageBehavior) {
return;
}
$locale = $document->getLocale();
if (LocalizationState::SHADOW === $this->documentInspector->getLocalizationState($document)) {
$locale = $document->getOriginalLocale();
}
$propertyName = $this->getRoutePathPropertyName($document->getStructureType(), $locale);
$routePath = $event->getNode()->getPropertyValueWithDefault($propertyName, null);
$document->setRoutePath($routePath);
$route = $this->routeRepository->findByEntity($document->getClass(), $document->getUuid(), $locale);
if ($route) {
$document->setRoute($route);
}
} | [
"public",
"function",
"handleHydrate",
"(",
"AbstractMappingEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"RoutablePageBehavior",
")",
"{",
"return",
";"... | Load route.
@param AbstractMappingEvent $event | [
"Load",
"route",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L156-L176 |
43,376 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.handlePersist | public function handlePersist(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutablePageBehavior) {
return;
}
$document->setUuid($event->getNode()->getIdentifier());
$propertyName = $this->getRoutePathPropertyName($document->getStructureType(), $event->getLocale());
$routePath = $event->getNode()->getPropertyValueWithDefault($propertyName, null);
$route = $this->conflictResolver->resolve($this->chainRouteGenerator->generate($document, $routePath));
$document->setRoutePath($route->getPath());
$event->getNode()->setProperty($propertyName, $route->getPath());
if (!$document instanceof ChildrenBehavior) {
return;
}
foreach ($document->getChildren() as $child) {
if (!$child instanceof RoutablePageBehavior) {
continue;
}
$route = $this->chainRouteGenerator->generate($child);
$child->setRoutePath($route->getPath());
$node = $this->documentInspector->getNode($child);
$node->setProperty($propertyName, $route->getPath());
}
} | php | public function handlePersist(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutablePageBehavior) {
return;
}
$document->setUuid($event->getNode()->getIdentifier());
$propertyName = $this->getRoutePathPropertyName($document->getStructureType(), $event->getLocale());
$routePath = $event->getNode()->getPropertyValueWithDefault($propertyName, null);
$route = $this->conflictResolver->resolve($this->chainRouteGenerator->generate($document, $routePath));
$document->setRoutePath($route->getPath());
$event->getNode()->setProperty($propertyName, $route->getPath());
if (!$document instanceof ChildrenBehavior) {
return;
}
foreach ($document->getChildren() as $child) {
if (!$child instanceof RoutablePageBehavior) {
continue;
}
$route = $this->chainRouteGenerator->generate($child);
$child->setRoutePath($route->getPath());
$node = $this->documentInspector->getNode($child);
$node->setProperty($propertyName, $route->getPath());
}
} | [
"public",
"function",
"handlePersist",
"(",
"AbstractMappingEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"RoutablePageBehavior",
")",
"{",
"return",
";"... | Generate route and save route-path.
@param AbstractMappingEvent $event | [
"Generate",
"route",
"and",
"save",
"route",
"-",
"path",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L183-L215 |
43,377 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.handleReorder | public function handleReorder(ReorderEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutablePageBehavior || !$document instanceof ParentBehavior) {
return;
}
$parentDocument = $document->getParent();
if (!$parentDocument instanceof ChildrenBehavior) {
return;
}
$locale = $this->documentInspector->getLocale($parentDocument);
$propertyName = $this->getRoutePathPropertyName($parentDocument->getStructureType(), $locale);
foreach ($parentDocument->getChildren() as $childDocument) {
$node = $this->documentInspector->getNode($childDocument);
$route = $this->chainRouteGenerator->generate($childDocument);
$childDocument->setRoutePath($route->getPath());
$node->setProperty($propertyName, $route->getPath());
}
} | php | public function handleReorder(ReorderEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutablePageBehavior || !$document instanceof ParentBehavior) {
return;
}
$parentDocument = $document->getParent();
if (!$parentDocument instanceof ChildrenBehavior) {
return;
}
$locale = $this->documentInspector->getLocale($parentDocument);
$propertyName = $this->getRoutePathPropertyName($parentDocument->getStructureType(), $locale);
foreach ($parentDocument->getChildren() as $childDocument) {
$node = $this->documentInspector->getNode($childDocument);
$route = $this->chainRouteGenerator->generate($childDocument);
$childDocument->setRoutePath($route->getPath());
$node->setProperty($propertyName, $route->getPath());
}
} | [
"public",
"function",
"handleReorder",
"(",
"ReorderEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"RoutablePageBehavior",
"||",
"!",
"$",
"document",
"... | Regenerate routes for siblings on reorder.
@param ReorderEvent $event | [
"Regenerate",
"routes",
"for",
"siblings",
"on",
"reorder",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L222-L244 |
43,378 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.handlePublish | public function handlePublish(PublishEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutableBehavior) {
return;
}
$node = $this->documentInspector->getNode($document);
try {
$route = $this->createOrUpdateRoute($document, $event->getLocale());
} catch (RouteIsNotUniqueException $exception) {
throw new ResourceLocatorAlreadyExistsException($exception->getRoute()->getPath(), $document->getPath());
}
$document->setRoutePath($route->getPath());
$this->entityManager->persist($route);
$node->setProperty(
$this->getRoutePathPropertyName($document->getStructureType(), $event->getLocale()),
$route->getPath()
);
$propertyName = $this->getPropertyName($event->getLocale(), self::ROUTES_PROPERTY);
// check if nodes previous generated routes exists and remove them if not
$oldRoutes = $event->getNode()->getPropertyValueWithDefault($propertyName, []);
$this->removeOldChildRoutes($event->getNode()->getSession(), $oldRoutes, $event->getLocale());
$routes = [];
if ($document instanceof ChildrenBehavior) {
// generate new routes of children
$routes = $this->generateChildRoutes($document, $event->getLocale());
}
// save the newly generated routes of children
$event->getNode()->setProperty($propertyName, $routes);
$this->entityManager->flush();
} | php | public function handlePublish(PublishEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutableBehavior) {
return;
}
$node = $this->documentInspector->getNode($document);
try {
$route = $this->createOrUpdateRoute($document, $event->getLocale());
} catch (RouteIsNotUniqueException $exception) {
throw new ResourceLocatorAlreadyExistsException($exception->getRoute()->getPath(), $document->getPath());
}
$document->setRoutePath($route->getPath());
$this->entityManager->persist($route);
$node->setProperty(
$this->getRoutePathPropertyName($document->getStructureType(), $event->getLocale()),
$route->getPath()
);
$propertyName = $this->getPropertyName($event->getLocale(), self::ROUTES_PROPERTY);
// check if nodes previous generated routes exists and remove them if not
$oldRoutes = $event->getNode()->getPropertyValueWithDefault($propertyName, []);
$this->removeOldChildRoutes($event->getNode()->getSession(), $oldRoutes, $event->getLocale());
$routes = [];
if ($document instanceof ChildrenBehavior) {
// generate new routes of children
$routes = $this->generateChildRoutes($document, $event->getLocale());
}
// save the newly generated routes of children
$event->getNode()->setProperty($propertyName, $routes);
$this->entityManager->flush();
} | [
"public",
"function",
"handlePublish",
"(",
"PublishEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"RoutableBehavior",
")",
"{",
"return",
";",
"}",
"... | Handle publish event and generate route and the child-routes.
@param PublishEvent $event
@throws ResourceLocatorAlreadyExistsException | [
"Handle",
"publish",
"event",
"and",
"generate",
"route",
"and",
"the",
"child",
"-",
"routes",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L253-L291 |
43,379 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.reallocateExistingRoute | private function reallocateExistingRoute(RoutablePageBehavior $document, $locale)
{
$newRoute = $this->routeRepository->findByPath($document->getRoutePath(), $locale);
if (!$newRoute) {
return;
}
$oldRoute = $this->routeRepository->findByEntity(get_class($document), $document->getUuid(), $locale);
$history = $this->routeRepository->findHistoryByEntity(get_class($document), $document->getUuid(), $locale);
/** @var RouteInterface $historyRoute */
foreach (array_filter(array_merge($history, [$oldRoute])) as $historyRoute) {
if ($historyRoute->getId() === $newRoute->getId() || $document->getId() !== $historyRoute->getEntityId()) {
// Mismatch of entity-id's happens because doctrine don't check entities which has been changed in the
// current session. If the old-route was already reused by a page before it will be returned in the
// query of line 329.
continue;
}
$historyRoute->setTarget($newRoute);
$historyRoute->setHistory(true);
$newRoute->addHistory($historyRoute);
}
$newRoute->setEntityClass(get_class($document));
$newRoute->setEntityId($document->getId());
$newRoute->setTarget(null);
$newRoute->setHistory(false);
return $newRoute;
} | php | private function reallocateExistingRoute(RoutablePageBehavior $document, $locale)
{
$newRoute = $this->routeRepository->findByPath($document->getRoutePath(), $locale);
if (!$newRoute) {
return;
}
$oldRoute = $this->routeRepository->findByEntity(get_class($document), $document->getUuid(), $locale);
$history = $this->routeRepository->findHistoryByEntity(get_class($document), $document->getUuid(), $locale);
/** @var RouteInterface $historyRoute */
foreach (array_filter(array_merge($history, [$oldRoute])) as $historyRoute) {
if ($historyRoute->getId() === $newRoute->getId() || $document->getId() !== $historyRoute->getEntityId()) {
// Mismatch of entity-id's happens because doctrine don't check entities which has been changed in the
// current session. If the old-route was already reused by a page before it will be returned in the
// query of line 329.
continue;
}
$historyRoute->setTarget($newRoute);
$historyRoute->setHistory(true);
$newRoute->addHistory($historyRoute);
}
$newRoute->setEntityClass(get_class($document));
$newRoute->setEntityId($document->getId());
$newRoute->setTarget(null);
$newRoute->setHistory(false);
return $newRoute;
} | [
"private",
"function",
"reallocateExistingRoute",
"(",
"RoutablePageBehavior",
"$",
"document",
",",
"$",
"locale",
")",
"{",
"$",
"newRoute",
"=",
"$",
"this",
"->",
"routeRepository",
"->",
"findByPath",
"(",
"$",
"document",
"->",
"getRoutePath",
"(",
")",
... | Reallocates existing route to given document.
@param RoutablePageBehavior $document
@param string $locale
@return RouteInterface | [
"Reallocates",
"existing",
"route",
"to",
"given",
"document",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L338-L369 |
43,380 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.removeOldChildRoutes | private function removeOldChildRoutes(SessionInterface $session, array $oldRoutes, $locale)
{
foreach ($oldRoutes as $oldRoute) {
$oldRouteEntity = $this->routeRepository->findByPath($oldRoute, $locale);
if ($oldRouteEntity && !$this->nodeExists($session, $oldRouteEntity->getEntityId())) {
$this->entityManager->remove($oldRouteEntity);
}
}
$this->entityManager->flush();
} | php | private function removeOldChildRoutes(SessionInterface $session, array $oldRoutes, $locale)
{
foreach ($oldRoutes as $oldRoute) {
$oldRouteEntity = $this->routeRepository->findByPath($oldRoute, $locale);
if ($oldRouteEntity && !$this->nodeExists($session, $oldRouteEntity->getEntityId())) {
$this->entityManager->remove($oldRouteEntity);
}
}
$this->entityManager->flush();
} | [
"private",
"function",
"removeOldChildRoutes",
"(",
"SessionInterface",
"$",
"session",
",",
"array",
"$",
"oldRoutes",
",",
"$",
"locale",
")",
"{",
"foreach",
"(",
"$",
"oldRoutes",
"as",
"$",
"oldRoute",
")",
"{",
"$",
"oldRouteEntity",
"=",
"$",
"this",
... | Removes old-routes where the node does not exists anymore.
@param SessionInterface $session
@param array $oldRoutes
@param string $locale | [
"Removes",
"old",
"-",
"routes",
"where",
"the",
"node",
"does",
"not",
"exists",
"anymore",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L403-L413 |
43,381 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.generateChildRoutes | private function generateChildRoutes(ChildrenBehavior $document, $locale)
{
$routes = [];
foreach ($document->getChildren() as $child) {
if (!$child instanceof RoutablePageBehavior) {
continue;
}
$childRoute = $this->createOrUpdatePageRoute($child, $locale);
$this->entityManager->persist($childRoute);
$child->setRoutePath($childRoute->getPath());
$childNode = $this->documentInspector->getNode($child);
$propertyName = $this->getRoutePathPropertyName($child->getStructureType(), $locale);
$childNode->setProperty($propertyName, $childRoute->getPath());
$routes[] = $childRoute->getPath();
}
return $routes;
} | php | private function generateChildRoutes(ChildrenBehavior $document, $locale)
{
$routes = [];
foreach ($document->getChildren() as $child) {
if (!$child instanceof RoutablePageBehavior) {
continue;
}
$childRoute = $this->createOrUpdatePageRoute($child, $locale);
$this->entityManager->persist($childRoute);
$child->setRoutePath($childRoute->getPath());
$childNode = $this->documentInspector->getNode($child);
$propertyName = $this->getRoutePathPropertyName($child->getStructureType(), $locale);
$childNode->setProperty($propertyName, $childRoute->getPath());
$routes[] = $childRoute->getPath();
}
return $routes;
} | [
"private",
"function",
"generateChildRoutes",
"(",
"ChildrenBehavior",
"$",
"document",
",",
"$",
"locale",
")",
"{",
"$",
"routes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"document",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child",
")",
"{",
"if",
... | Generates child routes.
@param ChildrenBehavior $document
@param string $locale
@return string[] | [
"Generates",
"child",
"routes",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L423-L444 |
43,382 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.handleRemove | public function handleRemove(RemoveEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutableBehavior) {
return;
}
$locales = $this->documentInspector->getLocales($document);
foreach ($locales as $locale) {
$localizedDocument = $this->documentManager->find($document->getUuid(), $locale);
$route = $this->routeRepository->findByEntity(
$localizedDocument->getClass(),
$localizedDocument->getUuid(),
$locale
);
if (!$route) {
continue;
}
$this->entityManager->remove($route);
if ($document instanceof ChildrenBehavior) {
$this->removeChildRoutes($document, $locale);
}
}
$this->entityManager->flush();
} | php | public function handleRemove(RemoveEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutableBehavior) {
return;
}
$locales = $this->documentInspector->getLocales($document);
foreach ($locales as $locale) {
$localizedDocument = $this->documentManager->find($document->getUuid(), $locale);
$route = $this->routeRepository->findByEntity(
$localizedDocument->getClass(),
$localizedDocument->getUuid(),
$locale
);
if (!$route) {
continue;
}
$this->entityManager->remove($route);
if ($document instanceof ChildrenBehavior) {
$this->removeChildRoutes($document, $locale);
}
}
$this->entityManager->flush();
} | [
"public",
"function",
"handleRemove",
"(",
"RemoveEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"RoutableBehavior",
")",
"{",
"return",
";",
"}",
"$"... | Removes route.
@param RemoveEvent $event | [
"Removes",
"route",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L451-L479 |
43,383 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.handleCopy | public function handleCopy(CopyEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutableBehavior) {
return;
}
$locales = $this->documentInspector->getLocales($document);
foreach ($locales as $locale) {
$localizedDocument = $this->documentManager->find($event->getCopiedPath(), $locale);
$route = $this->conflictResolver->resolve($this->chainRouteGenerator->generate($localizedDocument));
$localizedDocument->setRoutePath($route->getPath());
$node = $this->documentInspector->getNode($localizedDocument);
$node->setProperty(
$this->getRoutePathPropertyName($localizedDocument->getStructureType(), $locale),
$route->getPath()
);
$propertyName = $this->getRoutePathPropertyName($localizedDocument->getStructureType(), $locale);
$node = $this->documentInspector->getNode($localizedDocument);
$node->setProperty($propertyName, $route->getPath());
if ($localizedDocument instanceof ChildrenBehavior) {
$this->generateChildRoutes($localizedDocument, $locale);
}
}
} | php | public function handleCopy(CopyEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof RoutableBehavior) {
return;
}
$locales = $this->documentInspector->getLocales($document);
foreach ($locales as $locale) {
$localizedDocument = $this->documentManager->find($event->getCopiedPath(), $locale);
$route = $this->conflictResolver->resolve($this->chainRouteGenerator->generate($localizedDocument));
$localizedDocument->setRoutePath($route->getPath());
$node = $this->documentInspector->getNode($localizedDocument);
$node->setProperty(
$this->getRoutePathPropertyName($localizedDocument->getStructureType(), $locale),
$route->getPath()
);
$propertyName = $this->getRoutePathPropertyName($localizedDocument->getStructureType(), $locale);
$node = $this->documentInspector->getNode($localizedDocument);
$node->setProperty($propertyName, $route->getPath());
if ($localizedDocument instanceof ChildrenBehavior) {
$this->generateChildRoutes($localizedDocument, $locale);
}
}
} | [
"public",
"function",
"handleCopy",
"(",
"CopyEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"RoutableBehavior",
")",
"{",
"return",
";",
"}",
"$",
... | Update routes for copied article.
@param CopyEvent $event | [
"Update",
"routes",
"for",
"copied",
"article",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L486-L514 |
43,384 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.removeChildRoutes | private function removeChildRoutes(ChildrenBehavior $document, $locale)
{
foreach ($document->getChildren() as $child) {
if ($child instanceof RoutablePageBehavior) {
$this->removeChildRoute($child, $locale);
}
if ($child instanceof ChildrenBehavior) {
$this->removeChildRoutes($child, $locale);
}
}
} | php | private function removeChildRoutes(ChildrenBehavior $document, $locale)
{
foreach ($document->getChildren() as $child) {
if ($child instanceof RoutablePageBehavior) {
$this->removeChildRoute($child, $locale);
}
if ($child instanceof ChildrenBehavior) {
$this->removeChildRoutes($child, $locale);
}
}
} | [
"private",
"function",
"removeChildRoutes",
"(",
"ChildrenBehavior",
"$",
"document",
",",
"$",
"locale",
")",
"{",
"foreach",
"(",
"$",
"document",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"child",
"instanceof",
"Routab... | Iterate over children and remove routes.
@param ChildrenBehavior $document
@param string $locale | [
"Iterate",
"over",
"children",
"and",
"remove",
"routes",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L522-L533 |
43,385 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.removeChildRoute | private function removeChildRoute(RoutablePageBehavior $document, $locale)
{
$route = $this->routeRepository->findByPath($document->getRoutePath(), $locale);
if ($route) {
$this->entityManager->remove($route);
}
} | php | private function removeChildRoute(RoutablePageBehavior $document, $locale)
{
$route = $this->routeRepository->findByPath($document->getRoutePath(), $locale);
if ($route) {
$this->entityManager->remove($route);
}
} | [
"private",
"function",
"removeChildRoute",
"(",
"RoutablePageBehavior",
"$",
"document",
",",
"$",
"locale",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"routeRepository",
"->",
"findByPath",
"(",
"$",
"document",
"->",
"getRoutePath",
"(",
")",
",",
"$"... | Removes route if exists.
@param RoutablePageBehavior $document
@param string $locale | [
"Removes",
"route",
"if",
"exists",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L541-L547 |
43,386 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.getRoutePathPropertyName | private function getRoutePathPropertyName($structureType, $locale)
{
$metadata = $this->metadataFactory->getStructureMetadata('article', $structureType);
if ($metadata->hasTag(self::TAG_NAME)) {
return $this->getPropertyName($locale, $metadata->getPropertyByTagName(self::TAG_NAME)->getName());
}
return $this->getPropertyName($locale, self::ROUTE_FIELD);
} | php | private function getRoutePathPropertyName($structureType, $locale)
{
$metadata = $this->metadataFactory->getStructureMetadata('article', $structureType);
if ($metadata->hasTag(self::TAG_NAME)) {
return $this->getPropertyName($locale, $metadata->getPropertyByTagName(self::TAG_NAME)->getName());
}
return $this->getPropertyName($locale, self::ROUTE_FIELD);
} | [
"private",
"function",
"getRoutePathPropertyName",
"(",
"$",
"structureType",
",",
"$",
"locale",
")",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"metadataFactory",
"->",
"getStructureMetadata",
"(",
"'article'",
",",
"$",
"structureType",
")",
";",
"if",
"... | Returns encoded "routePath" property-name.
@param string $structureType
@param string $locale
@return string | [
"Returns",
"encoded",
"routePath",
"property",
"-",
"name",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L557-L566 |
43,387 | sulu/SuluArticleBundle | Document/Subscriber/RoutableSubscriber.php | RoutableSubscriber.nodeExists | private function nodeExists(SessionInterface $session, $uuid)
{
try {
$session->getNodeByIdentifier($uuid);
return true;
} catch (ItemNotFoundException $exception) {
return false;
}
} | php | private function nodeExists(SessionInterface $session, $uuid)
{
try {
$session->getNodeByIdentifier($uuid);
return true;
} catch (ItemNotFoundException $exception) {
return false;
}
} | [
"private",
"function",
"nodeExists",
"(",
"SessionInterface",
"$",
"session",
",",
"$",
"uuid",
")",
"{",
"try",
"{",
"$",
"session",
"->",
"getNodeByIdentifier",
"(",
"$",
"uuid",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"ItemNotFoundException",
... | Returns true if given uuid exists.
@param SessionInterface $session
@param string $uuid
@return bool | [
"Returns",
"true",
"if",
"given",
"uuid",
"exists",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/RoutableSubscriber.php#L589-L598 |
43,388 | sulu/SuluArticleBundle | Document/MediaViewObject.php | MediaViewObject.setFormats | public function setFormats($formats)
{
if (is_array($formats)) {
$formats = json_encode($formats);
}
$this->formats = $formats;
return $this;
} | php | public function setFormats($formats)
{
if (is_array($formats)) {
$formats = json_encode($formats);
}
$this->formats = $formats;
return $this;
} | [
"public",
"function",
"setFormats",
"(",
"$",
"formats",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"formats",
")",
")",
"{",
"$",
"formats",
"=",
"json_encode",
"(",
"$",
"formats",
")",
";",
"}",
"$",
"this",
"->",
"formats",
"=",
"$",
"formats",
... | Set formats.
@param string[] $formats
@return $this | [
"Set",
"formats",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/MediaViewObject.php#L95-L104 |
43,389 | sulu/SuluArticleBundle | Document/Serializer/WebsiteArticleUrlsSubscriber.php | WebsiteArticleUrlsSubscriber.addUrlsOnPostSerialize | public function addUrlsOnPostSerialize(ObjectEvent $event)
{
$article = $event->getObject();
$visitor = $event->getVisitor();
$context = $event->getContext();
$request = $this->requestStack->getCurrentRequest();
if (!$article instanceof ArticleDocument || !$context->attributes->containsKey('website') || !$request) {
return;
}
/** @var RequestAttributes $attributes */
$attributes = $request->get('_sulu');
if (!$attributes) {
return;
}
/** @var Webspace $webspace */
$webspace = $attributes->getAttribute('webspace');
if (!$webspace) {
return;
}
$urls = [];
foreach ($webspace->getAllLocalizations() as $localization) {
$locale = $localization->getLocale();
$route = $this->routeRepository->findByEntity(get_class($article), $article->getUuid(), $locale);
$urls[$locale] = '/';
if ($route) {
$urls[$locale] = $route->getPath();
}
}
$visitor->addData('urls', $context->accept($urls));
} | php | public function addUrlsOnPostSerialize(ObjectEvent $event)
{
$article = $event->getObject();
$visitor = $event->getVisitor();
$context = $event->getContext();
$request = $this->requestStack->getCurrentRequest();
if (!$article instanceof ArticleDocument || !$context->attributes->containsKey('website') || !$request) {
return;
}
/** @var RequestAttributes $attributes */
$attributes = $request->get('_sulu');
if (!$attributes) {
return;
}
/** @var Webspace $webspace */
$webspace = $attributes->getAttribute('webspace');
if (!$webspace) {
return;
}
$urls = [];
foreach ($webspace->getAllLocalizations() as $localization) {
$locale = $localization->getLocale();
$route = $this->routeRepository->findByEntity(get_class($article), $article->getUuid(), $locale);
$urls[$locale] = '/';
if ($route) {
$urls[$locale] = $route->getPath();
}
}
$visitor->addData('urls', $context->accept($urls));
} | [
"public",
"function",
"addUrlsOnPostSerialize",
"(",
"ObjectEvent",
"$",
"event",
")",
"{",
"$",
"article",
"=",
"$",
"event",
"->",
"getObject",
"(",
")",
";",
"$",
"visitor",
"=",
"$",
"event",
"->",
"getVisitor",
"(",
")",
";",
"$",
"context",
"=",
... | Loops thru current webspace locales and generates routes for them.
@param ObjectEvent $event | [
"Loops",
"thru",
"current",
"webspace",
"locales",
"and",
"generates",
"routes",
"for",
"them",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Serializer/WebsiteArticleUrlsSubscriber.php#L67-L102 |
43,390 | sulu/SuluArticleBundle | Metadata/StructureTagTrait.php | StructureTagTrait.getTagAttribute | private function getTagAttribute(StructureMetadata $metadata, $tag, $attribute, $default)
{
if (!$metadata->hasTag($tag)) {
return $default;
}
$tag = $metadata->getTag($tag);
if (!array_key_exists($attribute, $tag['attributes'])) {
return $default;
}
return $tag['attributes'][$attribute];
} | php | private function getTagAttribute(StructureMetadata $metadata, $tag, $attribute, $default)
{
if (!$metadata->hasTag($tag)) {
return $default;
}
$tag = $metadata->getTag($tag);
if (!array_key_exists($attribute, $tag['attributes'])) {
return $default;
}
return $tag['attributes'][$attribute];
} | [
"private",
"function",
"getTagAttribute",
"(",
"StructureMetadata",
"$",
"metadata",
",",
"$",
"tag",
",",
"$",
"attribute",
",",
"$",
"default",
")",
"{",
"if",
"(",
"!",
"$",
"metadata",
"->",
"hasTag",
"(",
"$",
"tag",
")",
")",
"{",
"return",
"$",
... | Returns attribute for given tag in metadata.
@param StructureMetadata $metadata
@param string $tag
@param string $attribute
@param mixed $default
@return mixed | [
"Returns",
"attribute",
"for",
"given",
"tag",
"in",
"metadata",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Metadata/StructureTagTrait.php#L56-L68 |
43,391 | sulu/SuluArticleBundle | Document/Index/Factory/ExcerptFactory.php | ExcerptFactory.create | public function create($data, $locale)
{
$excerpt = new ExcerptViewObject();
if (empty($data)) {
return $excerpt;
}
$excerpt->title = $data['title'];
$excerpt->more = $data['more'];
$excerpt->description = $data['description'];
$excerpt->tags = $this->tagCollectionFactory->create($data['tags']);
$excerpt->categories = $this->categoryCollectionFactory->create($data['categories'], $locale);
$excerpt->icon = $this->mediaCollectionFactory->create($data['icon'], $locale);
$excerpt->images = $this->mediaCollectionFactory->create($data['images'], $locale);
return $excerpt;
} | php | public function create($data, $locale)
{
$excerpt = new ExcerptViewObject();
if (empty($data)) {
return $excerpt;
}
$excerpt->title = $data['title'];
$excerpt->more = $data['more'];
$excerpt->description = $data['description'];
$excerpt->tags = $this->tagCollectionFactory->create($data['tags']);
$excerpt->categories = $this->categoryCollectionFactory->create($data['categories'], $locale);
$excerpt->icon = $this->mediaCollectionFactory->create($data['icon'], $locale);
$excerpt->images = $this->mediaCollectionFactory->create($data['images'], $locale);
return $excerpt;
} | [
"public",
"function",
"create",
"(",
"$",
"data",
",",
"$",
"locale",
")",
"{",
"$",
"excerpt",
"=",
"new",
"ExcerptViewObject",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"excerpt",
";",
"}",
"$",
"excerpt",... | Create a excerpt object by given data.
@param array $data
@param string $locale
@return ExcerptViewObject | [
"Create",
"a",
"excerpt",
"object",
"by",
"given",
"data",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Index/Factory/ExcerptFactory.php#L61-L78 |
43,392 | sulu/SuluArticleBundle | Document/Subscriber/DateShardingSubscriber.php | DateShardingSubscriber.handleSetParentNode | public function handleSetParentNode(PersistEvent $event)
{
if (!$event->getDocument() instanceof DateShardingBehavior || $event->hasParentNode()) {
return;
}
$date = $event->getDocument()->getCreated();
if (null === $date) {
$date = new \DateTime();
}
$path = $this->pathBuilder->build(['%base%', '%articles%', $date->format('Y'), $date->format('m')]);
$event->setParentNode($this->nodeManager->createPath($path));
} | php | public function handleSetParentNode(PersistEvent $event)
{
if (!$event->getDocument() instanceof DateShardingBehavior || $event->hasParentNode()) {
return;
}
$date = $event->getDocument()->getCreated();
if (null === $date) {
$date = new \DateTime();
}
$path = $this->pathBuilder->build(['%base%', '%articles%', $date->format('Y'), $date->format('m')]);
$event->setParentNode($this->nodeManager->createPath($path));
} | [
"public",
"function",
"handleSetParentNode",
"(",
"PersistEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"getDocument",
"(",
")",
"instanceof",
"DateShardingBehavior",
"||",
"$",
"event",
"->",
"hasParentNode",
"(",
")",
")",
"{",
"retur... | Set parent-node if no parent exists.
The format of parent node is: /%base%/%articles%/
@param PersistEvent $event | [
"Set",
"parent",
"-",
"node",
"if",
"no",
"parent",
"exists",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/DateShardingSubscriber.php#L65-L79 |
43,393 | sulu/SuluArticleBundle | Document/Subscriber/ArticleSubscriber.php | ArticleSubscriber.handleScheduleIndex | public function handleScheduleIndex(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
if (!$document instanceof ArticlePageDocument) {
return;
}
$document = $document->getParent();
}
$this->documents[$document->getUuid()] = [
'uuid' => $document->getUuid(),
'locale' => $document->getLocale(),
];
} | php | public function handleScheduleIndex(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
if (!$document instanceof ArticlePageDocument) {
return;
}
$document = $document->getParent();
}
$this->documents[$document->getUuid()] = [
'uuid' => $document->getUuid(),
'locale' => $document->getLocale(),
];
} | [
"public",
"function",
"handleScheduleIndex",
"(",
"AbstractMappingEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"ArticleDocument",
")",
"{",
"if",
"(",
... | Schedule article document for index.
@param AbstractMappingEvent $event | [
"Schedule",
"article",
"document",
"for",
"index",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/ArticleSubscriber.php#L147-L162 |
43,394 | sulu/SuluArticleBundle | Document/Subscriber/ArticleSubscriber.php | ArticleSubscriber.handleScheduleIndexLive | public function handleScheduleIndexLive(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
if (!$document instanceof ArticlePageDocument) {
return;
}
$document = $document->getParent();
}
$this->liveDocuments[$document->getUuid()] = [
'uuid' => $document->getUuid(),
'locale' => $document->getLocale(),
];
} | php | public function handleScheduleIndexLive(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
if (!$document instanceof ArticlePageDocument) {
return;
}
$document = $document->getParent();
}
$this->liveDocuments[$document->getUuid()] = [
'uuid' => $document->getUuid(),
'locale' => $document->getLocale(),
];
} | [
"public",
"function",
"handleScheduleIndexLive",
"(",
"AbstractMappingEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"ArticleDocument",
")",
"{",
"if",
"(... | Schedule article document for live index.
@param AbstractMappingEvent $event | [
"Schedule",
"article",
"document",
"for",
"live",
"index",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/ArticleSubscriber.php#L169-L184 |
43,395 | sulu/SuluArticleBundle | Document/Subscriber/ArticleSubscriber.php | ArticleSubscriber.synchronizeChildren | public function synchronizeChildren(PublishEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
return;
}
$liveNode = $event->getNode();
$draftNode = $this->documentInspector->getNode($document);
$liveChildren = $this->getChildren($liveNode);
$draftChildren = $this->getChildren($draftNode);
$removedChildrenIds = array_diff(array_keys($liveChildren), array_keys($draftChildren));
foreach ($removedChildrenIds as $removedChildrenId) {
$liveChildren[$removedChildrenId]->remove();
}
} | php | public function synchronizeChildren(PublishEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
return;
}
$liveNode = $event->getNode();
$draftNode = $this->documentInspector->getNode($document);
$liveChildren = $this->getChildren($liveNode);
$draftChildren = $this->getChildren($draftNode);
$removedChildrenIds = array_diff(array_keys($liveChildren), array_keys($draftChildren));
foreach ($removedChildrenIds as $removedChildrenId) {
$liveChildren[$removedChildrenId]->remove();
}
} | [
"public",
"function",
"synchronizeChildren",
"(",
"PublishEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"ArticleDocument",
")",
"{",
"return",
";",
"}"... | Syncs children between live and draft.
@param PublishEvent $event | [
"Syncs",
"children",
"between",
"live",
"and",
"draft",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/ArticleSubscriber.php#L191-L208 |
43,396 | sulu/SuluArticleBundle | Document/Subscriber/ArticleSubscriber.php | ArticleSubscriber.getChildren | private function getChildren(NodeInterface $node)
{
$result = [];
foreach ($node->getNodes() as $child) {
$result[$child->getIdentifier()] = $child;
}
return $result;
} | php | private function getChildren(NodeInterface $node)
{
$result = [];
foreach ($node->getNodes() as $child) {
$result[$child->getIdentifier()] = $child;
}
return $result;
} | [
"private",
"function",
"getChildren",
"(",
"NodeInterface",
"$",
"node",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"node",
"->",
"getNodes",
"(",
")",
"as",
"$",
"child",
")",
"{",
"$",
"result",
"[",
"$",
"child",
"->",
"ge... | Returns children of given node.
@param NodeInterface $node
@return NodeInterface[] | [
"Returns",
"children",
"of",
"given",
"node",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/ArticleSubscriber.php#L217-L225 |
43,397 | sulu/SuluArticleBundle | Document/Subscriber/ArticleSubscriber.php | ArticleSubscriber.publishChildren | public function publishChildren(PublishEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
return;
}
$children = iterator_to_array($document->getChildren());
foreach ($children as $child) {
if (LocalizationState::GHOST !== $this->documentInspector->getLocalizationState($child)) {
$this->documentManager->publish($child, $event->getLocale());
}
}
} | php | public function publishChildren(PublishEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
return;
}
$children = iterator_to_array($document->getChildren());
foreach ($children as $child) {
if (LocalizationState::GHOST !== $this->documentInspector->getLocalizationState($child)) {
$this->documentManager->publish($child, $event->getLocale());
}
}
} | [
"public",
"function",
"publishChildren",
"(",
"PublishEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"ArticleDocument",
")",
"{",
"return",
";",
"}",
... | Publish pages when article will be published.
@param PublishEvent $event | [
"Publish",
"pages",
"when",
"article",
"will",
"be",
"published",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/ArticleSubscriber.php#L232-L245 |
43,398 | sulu/SuluArticleBundle | Document/Subscriber/ArticleSubscriber.php | ArticleSubscriber.persistPageDataOnReorder | public function persistPageDataOnReorder(ReorderEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticlePageDocument) {
return;
}
$document = $document->getParent();
$node = $this->documentInspector->getNode($document);
$this->setPageData($document, $node, $document->getLocale());
$document->setWorkflowStage(WorkflowStage::TEST);
$this->documentManager->persist($document, $this->documentInspector->getLocale($document));
$this->documents[$document->getUuid()] = [
'uuid' => $document->getUuid(),
'locale' => $document->getLocale(),
];
} | php | public function persistPageDataOnReorder(ReorderEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticlePageDocument) {
return;
}
$document = $document->getParent();
$node = $this->documentInspector->getNode($document);
$this->setPageData($document, $node, $document->getLocale());
$document->setWorkflowStage(WorkflowStage::TEST);
$this->documentManager->persist($document, $this->documentInspector->getLocale($document));
$this->documents[$document->getUuid()] = [
'uuid' => $document->getUuid(),
'locale' => $document->getLocale(),
];
} | [
"public",
"function",
"persistPageDataOnReorder",
"(",
"ReorderEvent",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"ArticlePageDocument",
")",
"{",
"return",
"... | Persist page-data for reordering children.
@param ReorderEvent $event | [
"Persist",
"page",
"-",
"data",
"for",
"reordering",
"children",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/ArticleSubscriber.php#L252-L271 |
43,399 | sulu/SuluArticleBundle | Document/Subscriber/ArticleSubscriber.php | ArticleSubscriber.persistPageData | public function persistPageData($event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
return;
}
$this->setPageData($document, $event->getNode(), $event->getLocale());
} | php | public function persistPageData($event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
return;
}
$this->setPageData($document, $event->getNode(), $event->getLocale());
} | [
"public",
"function",
"persistPageData",
"(",
"$",
"event",
")",
"{",
"$",
"document",
"=",
"$",
"event",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"document",
"instanceof",
"ArticleDocument",
")",
"{",
"return",
";",
"}",
"$",
"this",
"... | Persist page-data.
@param PersistEvent|PublishEvent $event | [
"Persist",
"page",
"-",
"data",
"."
] | 6d877ca6f28ffc67b70f60c84f56170541a58cf5 | https://github.com/sulu/SuluArticleBundle/blob/6d877ca6f28ffc67b70f60c84f56170541a58cf5/Document/Subscriber/ArticleSubscriber.php#L278-L286 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.