id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
188,900 | Algo-Web/POData-Laravel | src/Serialisers/IronicSerialiser.php | IronicSerialiser.setService | public function setService(IService $service)
{
$this->service = $service;
$this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString();
$this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/';
} | php | public function setService(IService $service)
{
$this->service = $service;
$this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString();
$this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/';
} | [
"public",
"function",
"setService",
"(",
"IService",
"$",
"service",
")",
"{",
"$",
"this",
"->",
"service",
"=",
"$",
"service",
";",
"$",
"this",
"->",
"absoluteServiceUri",
"=",
"$",
"service",
"->",
"getHost",
"(",
")",
"->",
"getAbsoluteServiceUri",
"... | Gets the data service instance.
@return void | [
"Gets",
"the",
"data",
"service",
"instance",
"."
] | 8f4d7ff8fe7774e1296690bb3432636bb8cffb0b | https://github.com/Algo-Web/POData-Laravel/blob/8f4d7ff8fe7774e1296690bb3432636bb8cffb0b/src/Serialisers/IronicSerialiser.php#L987-L992 |
188,901 | Algo-Web/POData-Laravel | src/Query/LaravelBulkQuery.php | LaravelBulkQuery.createBulkResourceforResourceSet | public function createBulkResourceforResourceSet(
ResourceSet $sourceResourceSet,
array $data
) {
$verbName = 'bulkCreate';
$mapping = $this->getOptionalVerbMapping($sourceResourceSet, $verbName);
$result = [];
try {
DB::beginTransaction();
if... | php | public function createBulkResourceforResourceSet(
ResourceSet $sourceResourceSet,
array $data
) {
$verbName = 'bulkCreate';
$mapping = $this->getOptionalVerbMapping($sourceResourceSet, $verbName);
$result = [];
try {
DB::beginTransaction();
if... | [
"public",
"function",
"createBulkResourceforResourceSet",
"(",
"ResourceSet",
"$",
"sourceResourceSet",
",",
"array",
"$",
"data",
")",
"{",
"$",
"verbName",
"=",
"'bulkCreate'",
";",
"$",
"mapping",
"=",
"$",
"this",
"->",
"getOptionalVerbMapping",
"(",
"$",
"s... | Create multiple new resources in a resource set.
@param ResourceSet $sourceResourceSet The entity set containing the entity to fetch
@param object[] $data The new data for the entity instance
@return object[] returns the newly created model if successful, or throws an exception if model creation faile... | [
"Create",
"multiple",
"new",
"resources",
"in",
"a",
"resource",
"set",
"."
] | 8f4d7ff8fe7774e1296690bb3432636bb8cffb0b | https://github.com/Algo-Web/POData-Laravel/blob/8f4d7ff8fe7774e1296690bb3432636bb8cffb0b/src/Query/LaravelBulkQuery.php#L55-L84 |
188,902 | Algo-Web/POData-Laravel | src/Models/ObjectMap/Entities/Associations/AssociationStubBase.php | AssociationStubBase.isOk | public function isOk()
{
if (null === $this->multiplicity) {
return false;
}
$relName = $this->relationName;
if (null === $relName || !is_string($relName) || empty($relName)) {
return false;
}
$keyField = $this->keyField;
if (null === $... | php | public function isOk()
{
if (null === $this->multiplicity) {
return false;
}
$relName = $this->relationName;
if (null === $relName || !is_string($relName) || empty($relName)) {
return false;
}
$keyField = $this->keyField;
if (null === $... | [
"public",
"function",
"isOk",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"multiplicity",
")",
"{",
"return",
"false",
";",
"}",
"$",
"relName",
"=",
"$",
"this",
"->",
"relationName",
";",
"if",
"(",
"null",
"===",
"$",
"relName",
... | Is this AssociationStub sane? | [
"Is",
"this",
"AssociationStub",
"sane?"
] | 8f4d7ff8fe7774e1296690bb3432636bb8cffb0b | https://github.com/Algo-Web/POData-Laravel/blob/8f4d7ff8fe7774e1296690bb3432636bb8cffb0b/src/Models/ObjectMap/Entities/Associations/AssociationStubBase.php#L129-L158 |
188,903 | Algo-Web/POData-Laravel | src/Models/ObjectMap/Entities/Associations/AssociationStubBase.php | AssociationStubBase.compare | public function compare(AssociationStubBase $other)
{
$thisClass = get_class($this);
$otherClass = get_class($other);
$classComp = strcmp($thisClass, $otherClass);
if (0 !== $classComp) {
return $classComp / abs($classComp);
}
$thisBase = $this->getBaseTyp... | php | public function compare(AssociationStubBase $other)
{
$thisClass = get_class($this);
$otherClass = get_class($other);
$classComp = strcmp($thisClass, $otherClass);
if (0 !== $classComp) {
return $classComp / abs($classComp);
}
$thisBase = $this->getBaseTyp... | [
"public",
"function",
"compare",
"(",
"AssociationStubBase",
"$",
"other",
")",
"{",
"$",
"thisClass",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"otherClass",
"=",
"get_class",
"(",
"$",
"other",
")",
";",
"$",
"classComp",
"=",
"strcmp",
"(",
... | Supply a canonical sort ordering to determine order in associations.
@param AssociationStubBase $other
@return int | [
"Supply",
"a",
"canonical",
"sort",
"ordering",
"to",
"determine",
"order",
"in",
"associations",
"."
] | 8f4d7ff8fe7774e1296690bb3432636bb8cffb0b | https://github.com/Algo-Web/POData-Laravel/blob/8f4d7ff8fe7774e1296690bb3432636bb8cffb0b/src/Models/ObjectMap/Entities/Associations/AssociationStubBase.php#L231-L249 |
188,904 | ankitpokhrel/laravel-image | src/LaravelImage/ImageUploadServiceProvider.php | ImageUploadServiceProvider.registerGlide | protected function registerGlide()
{
$this->app->singleton('\League\Glide\Server', function ($app) {
$fileSystem = $app->make(Filesystem::class);
$uploadDir = config('laravelimage.uploadDir');
// Set source filesystem
$source = new LeagueFilesystem(
... | php | protected function registerGlide()
{
$this->app->singleton('\League\Glide\Server', function ($app) {
$fileSystem = $app->make(Filesystem::class);
$uploadDir = config('laravelimage.uploadDir');
// Set source filesystem
$source = new LeagueFilesystem(
... | [
"protected",
"function",
"registerGlide",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'\\League\\Glide\\Server'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"fileSystem",
"=",
"$",
"app",
"->",
"make",
"(",
"Filesystem",
"::",
... | Register glide. | [
"Register",
"glide",
"."
] | dc13f58b223fd81f9da259ba366068bd1de56eea | https://github.com/ankitpokhrel/laravel-image/blob/dc13f58b223fd81f9da259ba366068bd1de56eea/src/LaravelImage/ImageUploadServiceProvider.php#L47-L71 |
188,905 | ankitpokhrel/laravel-image | src/LaravelImage/ImageUploadServiceProvider.php | ImageUploadServiceProvider.registerBladeExtensions | protected function registerBladeExtensions()
{
$blade = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler();
$blade->directive('laravelImage', function ($options) {
return "<?php echo \\AnkitPokhrel\\LaravelImage\\LaravelImageFacade::image($options);?>";
});... | php | protected function registerBladeExtensions()
{
$blade = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler();
$blade->directive('laravelImage', function ($options) {
return "<?php echo \\AnkitPokhrel\\LaravelImage\\LaravelImageFacade::image($options);?>";
});... | [
"protected",
"function",
"registerBladeExtensions",
"(",
")",
"{",
"$",
"blade",
"=",
"$",
"this",
"->",
"app",
"[",
"'view'",
"]",
"->",
"getEngineResolver",
"(",
")",
"->",
"resolve",
"(",
"'blade'",
")",
"->",
"getCompiler",
"(",
")",
";",
"$",
"blade... | Register blade templates. | [
"Register",
"blade",
"templates",
"."
] | dc13f58b223fd81f9da259ba366068bd1de56eea | https://github.com/ankitpokhrel/laravel-image/blob/dc13f58b223fd81f9da259ba366068bd1de56eea/src/LaravelImage/ImageUploadServiceProvider.php#L76-L83 |
188,906 | ankitpokhrel/laravel-image | src/LaravelImage/ImageUploadService.php | ImageUploadService.setUploadFolder | public function setUploadFolder($folder)
{
$this->uploadPath = $this->basePath . $folder . '/' . $this->getUniqueFolderName() . '/';
$this->destination = $this->publicPath ? public_path($this->uploadPath) : $this->uploadPath;
} | php | public function setUploadFolder($folder)
{
$this->uploadPath = $this->basePath . $folder . '/' . $this->getUniqueFolderName() . '/';
$this->destination = $this->publicPath ? public_path($this->uploadPath) : $this->uploadPath;
} | [
"public",
"function",
"setUploadFolder",
"(",
"$",
"folder",
")",
"{",
"$",
"this",
"->",
"uploadPath",
"=",
"$",
"this",
"->",
"basePath",
".",
"$",
"folder",
".",
"'/'",
".",
"$",
"this",
"->",
"getUniqueFolderName",
"(",
")",
".",
"'/'",
";",
"$",
... | Set upload folder.
@param $folder | [
"Set",
"upload",
"folder",
"."
] | dc13f58b223fd81f9da259ba366068bd1de56eea | https://github.com/ankitpokhrel/laravel-image/blob/dc13f58b223fd81f9da259ba366068bd1de56eea/src/LaravelImage/ImageUploadService.php#L164-L168 |
188,907 | ankitpokhrel/laravel-image | src/LaravelImage/ImageUploadService.php | ImageUploadService.validate | protected function validate($file)
{
// Check if file is valid
if ( ! $file->isValid()) {
return false;
}
$inputFile = [$this->field => $file];
$rules = [$this->field => $this->validationRules];
// Validate
$validator = Validator::make($input... | php | protected function validate($file)
{
// Check if file is valid
if ( ! $file->isValid()) {
return false;
}
$inputFile = [$this->field => $file];
$rules = [$this->field => $this->validationRules];
// Validate
$validator = Validator::make($input... | [
"protected",
"function",
"validate",
"(",
"$",
"file",
")",
"{",
"// Check if file is valid",
"if",
"(",
"!",
"$",
"file",
"->",
"isValid",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"inputFile",
"=",
"[",
"$",
"this",
"->",
"field",
"=>",
... | Perform image validation.
@param $file
@return bool | [
"Perform",
"image",
"validation",
"."
] | dc13f58b223fd81f9da259ba366068bd1de56eea | https://github.com/ankitpokhrel/laravel-image/blob/dc13f58b223fd81f9da259ba366068bd1de56eea/src/LaravelImage/ImageUploadService.php#L213-L232 |
188,908 | ankitpokhrel/laravel-image | src/LaravelImage/ImageUploadService.php | ImageUploadService.upload | public function upload()
{
$file = Input::file($this->field);
if ( ! $this->validate($file)) {
return false;
}
$originalFileName = $file->getClientOriginalName();
$encryptedFileName = $this->getUniqueFilename($originalFileName);
$mimeType = $fil... | php | public function upload()
{
$file = Input::file($this->field);
if ( ! $this->validate($file)) {
return false;
}
$originalFileName = $file->getClientOriginalName();
$encryptedFileName = $this->getUniqueFilename($originalFileName);
$mimeType = $fil... | [
"public",
"function",
"upload",
"(",
")",
"{",
"$",
"file",
"=",
"Input",
"::",
"file",
"(",
"$",
"this",
"->",
"field",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"validate",
"(",
"$",
"file",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",... | Uploads file to required destination.
@return bool | [
"Uploads",
"file",
"to",
"required",
"destination",
"."
] | dc13f58b223fd81f9da259ba366068bd1de56eea | https://github.com/ankitpokhrel/laravel-image/blob/dc13f58b223fd81f9da259ba366068bd1de56eea/src/LaravelImage/ImageUploadService.php#L239-L265 |
188,909 | ankitpokhrel/laravel-image | src/LaravelImage/ImageUploadService.php | ImageUploadService.clean | public function clean($folder, $removeDirectory = false)
{
if ( ! is_dir($folder)) {
throw new \Exception(('Not a folder.'));
}
array_map('unlink', glob($folder . DIRECTORY_SEPARATOR . '*'));
if ($removeDirectory && file_exists($folder)) {
rmdir($folder);
... | php | public function clean($folder, $removeDirectory = false)
{
if ( ! is_dir($folder)) {
throw new \Exception(('Not a folder.'));
}
array_map('unlink', glob($folder . DIRECTORY_SEPARATOR . '*'));
if ($removeDirectory && file_exists($folder)) {
rmdir($folder);
... | [
"public",
"function",
"clean",
"(",
"$",
"folder",
",",
"$",
"removeDirectory",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"folder",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"(",
"'Not a folder.'",
")",
")",
";",
"}",
... | Clear out a folder and its content.
@param string $folder Absolute path to the folder
@param bool $removeDirectory If you want to remove the folder as well
@throws \Exception | [
"Clear",
"out",
"a",
"folder",
"and",
"its",
"content",
"."
] | dc13f58b223fd81f9da259ba366068bd1de56eea | https://github.com/ankitpokhrel/laravel-image/blob/dc13f58b223fd81f9da259ba366068bd1de56eea/src/LaravelImage/ImageUploadService.php#L283-L293 |
188,910 | ankitpokhrel/laravel-image | src/LaravelImage/ImageUploadService.php | ImageUploadService.getUniqueFilename | public function getUniqueFilename($filename)
{
$uniqueName = uniqid();
$fileExt = explode('.', $filename);
$mimeType = end($fileExt);
$filename = $uniqueName . '.' . $mimeType;
return $filename;
} | php | public function getUniqueFilename($filename)
{
$uniqueName = uniqid();
$fileExt = explode('.', $filename);
$mimeType = end($fileExt);
$filename = $uniqueName . '.' . $mimeType;
return $filename;
} | [
"public",
"function",
"getUniqueFilename",
"(",
"$",
"filename",
")",
"{",
"$",
"uniqueName",
"=",
"uniqid",
"(",
")",
";",
"$",
"fileExt",
"=",
"explode",
"(",
"'.'",
",",
"$",
"filename",
")",
";",
"$",
"mimeType",
"=",
"end",
"(",
"$",
"fileExt",
... | function to generate unique filename for images.
@param string $filename
@return string | [
"function",
"to",
"generate",
"unique",
"filename",
"for",
"images",
"."
] | dc13f58b223fd81f9da259ba366068bd1de56eea | https://github.com/ankitpokhrel/laravel-image/blob/dc13f58b223fd81f9da259ba366068bd1de56eea/src/LaravelImage/ImageUploadService.php#L302-L310 |
188,911 | jayzeng/virustotal_apiwrapper | Src/VirusTotal/ApiBase.php | ApiBase.makePostRequest | protected function makePostRequest($endpoint, array $params, $type = 'form_params') {
try {
$params[$type] = $params;
$response = $this->_client->post($endpoint, $params);
$this->validateResponse($response->getStatusCode());
return $this->to_json($response);
... | php | protected function makePostRequest($endpoint, array $params, $type = 'form_params') {
try {
$params[$type] = $params;
$response = $this->_client->post($endpoint, $params);
$this->validateResponse($response->getStatusCode());
return $this->to_json($response);
... | [
"protected",
"function",
"makePostRequest",
"(",
"$",
"endpoint",
",",
"array",
"$",
"params",
",",
"$",
"type",
"=",
"'form_params'",
")",
"{",
"try",
"{",
"$",
"params",
"[",
"$",
"type",
"]",
"=",
"$",
"params",
";",
"$",
"response",
"=",
"$",
"th... | Util function to make post request
@param string $endpoint
@param array $params
@param string $type form_params or multipart
@return (?)
@see Client
@throw \VirusTotal\Exceptions\RateLimitException
@throw \VirusTotal\Exceptions\InvalidApiKeyException | [
"Util",
"function",
"to",
"make",
"post",
"request"
] | 12076ee71aa068cb50b215b1ca4f6210b0827809 | https://github.com/jayzeng/virustotal_apiwrapper/blob/12076ee71aa068cb50b215b1ca4f6210b0827809/Src/VirusTotal/ApiBase.php#L58-L67 |
188,912 | jayzeng/virustotal_apiwrapper | Src/VirusTotal/ApiBase.php | ApiBase.makeGetRequest | protected function makeGetRequest($endpoint, array $params) {
// Constructs get url
// e.g:
// endpoint = 'ip-address/report'
//
// params => array(
// 'ip' => '192.168.2.1',
// 'apikey' => 'supersecureapikey'
// ... | php | protected function makeGetRequest($endpoint, array $params) {
// Constructs get url
// e.g:
// endpoint = 'ip-address/report'
//
// params => array(
// 'ip' => '192.168.2.1',
// 'apikey' => 'supersecureapikey'
// ... | [
"protected",
"function",
"makeGetRequest",
"(",
"$",
"endpoint",
",",
"array",
"$",
"params",
")",
"{",
"// Constructs get url",
"// e.g:",
"// endpoint = 'ip-address/report'",
"//",
"// params => array(",
"// 'ip' => '192.168.2.1',",
"// 'apik... | Util function to make get request
@param string $endpoint
@param array $params
@return (?)
@throw \VirusTotal\Exceptions\RateLimitException
@throw \VirusTotal\Exceptions\InvalidApiKeyException | [
"Util",
"function",
"to",
"make",
"get",
"request"
] | 12076ee71aa068cb50b215b1ca4f6210b0827809 | https://github.com/jayzeng/virustotal_apiwrapper/blob/12076ee71aa068cb50b215b1ca4f6210b0827809/Src/VirusTotal/ApiBase.php#L78-L98 |
188,913 | jayzeng/virustotal_apiwrapper | Src/VirusTotal/ApiBase.php | ApiBase.validateResponse | protected function validateResponse($statusCode) {
switch($statusCode) {
case 204:
throw new Exceptions\RateLimitException('Too many requests');
case 403:
throw new Exceptions\InvalidApiKeyException(sprintf('Key %s is invalid', $this->_apiKey));
... | php | protected function validateResponse($statusCode) {
switch($statusCode) {
case 204:
throw new Exceptions\RateLimitException('Too many requests');
case 403:
throw new Exceptions\InvalidApiKeyException(sprintf('Key %s is invalid', $this->_apiKey));
... | [
"protected",
"function",
"validateResponse",
"(",
"$",
"statusCode",
")",
"{",
"switch",
"(",
"$",
"statusCode",
")",
"{",
"case",
"204",
":",
"throw",
"new",
"Exceptions",
"\\",
"RateLimitException",
"(",
"'Too many requests'",
")",
";",
"case",
"403",
":",
... | Validate response by looking up the http status code
@param int $statusCode - http status code
@throw \VirusTotal\Exceptions\RateLimitException
@throw \VirusTotal\Exceptions\InvalidApiKeyException | [
"Validate",
"response",
"by",
"looking",
"up",
"the",
"http",
"status",
"code"
] | 12076ee71aa068cb50b215b1ca4f6210b0827809 | https://github.com/jayzeng/virustotal_apiwrapper/blob/12076ee71aa068cb50b215b1ca4f6210b0827809/Src/VirusTotal/ApiBase.php#L106-L115 |
188,914 | Tucker-Eric/docusign-rest-client | src/Api/BaseApi.php | BaseApi.getOptions | public function getOptions($method = null)
{
if ($method === null) {
return $this->_options;
}
if (!array_key_exists($method, $this->_options)) {
$optionsClass = get_class($this->client) . "\\" . ucfirst($method);
if (!class_exists($optionsClass)) {
... | php | public function getOptions($method = null)
{
if ($method === null) {
return $this->_options;
}
if (!array_key_exists($method, $this->_options)) {
$optionsClass = get_class($this->client) . "\\" . ucfirst($method);
if (!class_exists($optionsClass)) {
... | [
"public",
"function",
"getOptions",
"(",
"$",
"method",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"method",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_options",
";",
"}",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"method",
",",
"$",
"... | Get an options object or all of them for current Api class
@param null $method
@return array|mixed
@throws ClassNotFoundException | [
"Get",
"an",
"options",
"object",
"or",
"all",
"of",
"them",
"for",
"current",
"Api",
"class"
] | e64813fa4a45c1f10d7c7ea63faaa22e1dddc093 | https://github.com/Tucker-Eric/docusign-rest-client/blob/e64813fa4a45c1f10d7c7ea63faaa22e1dddc093/src/Api/BaseApi.php#L76-L91 |
188,915 | Tucker-Eric/docusign-rest-client | src/Api/BaseApi.php | BaseApi.setOptionsObject | public function setOptionsObject($method, $args)
{
// All options are stored as a child namespace so the below is possible
$class = get_class($this->client) . "\\" . ucfirst($method);
// If there is no array passed to the function just return the object
if (!is_array($args[0]) || co... | php | public function setOptionsObject($method, $args)
{
// All options are stored as a child namespace so the below is possible
$class = get_class($this->client) . "\\" . ucfirst($method);
// If there is no array passed to the function just return the object
if (!is_array($args[0]) || co... | [
"public",
"function",
"setOptionsObject",
"(",
"$",
"method",
",",
"$",
"args",
")",
"{",
"// All options are stored as a child namespace so the below is possible",
"$",
"class",
"=",
"get_class",
"(",
"$",
"this",
"->",
"client",
")",
".",
"\"\\\\\"",
".",
"ucfirst... | Sets the given options object and stores it
@param $method
@param $args
@return mixed | [
"Sets",
"the",
"given",
"options",
"object",
"and",
"stores",
"it"
] | e64813fa4a45c1f10d7c7ea63faaa22e1dddc093 | https://github.com/Tucker-Eric/docusign-rest-client/blob/e64813fa4a45c1f10d7c7ea63faaa22e1dddc093/src/Api/BaseApi.php#L99-L121 |
188,916 | Tucker-Eric/docusign-rest-client | src/Client.php | Client.authenticate | public function authenticate()
{
if (!isset($this->account_id)) {
$accounts = $this->authentication->login();
$allAccounts = $accounts->getLoginAccounts();
$account = $allAccounts[0];
$this->account_id = $account->getAccountId();
}
$this->auth... | php | public function authenticate()
{
if (!isset($this->account_id)) {
$accounts = $this->authentication->login();
$allAccounts = $accounts->getLoginAccounts();
$account = $allAccounts[0];
$this->account_id = $account->getAccountId();
}
$this->auth... | [
"public",
"function",
"authenticate",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"account_id",
")",
")",
"{",
"$",
"accounts",
"=",
"$",
"this",
"->",
"authentication",
"->",
"login",
"(",
")",
";",
"$",
"allAccounts",
"=",
"$",
... | Authenticates api client and stores account_id
@return $this | [
"Authenticates",
"api",
"client",
"and",
"stores",
"account_id"
] | e64813fa4a45c1f10d7c7ea63faaa22e1dddc093 | https://github.com/Tucker-Eric/docusign-rest-client/blob/e64813fa4a45c1f10d7c7ea63faaa22e1dddc093/src/Client.php#L139-L151 |
188,917 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.get_list_or_item | private function get_list_or_item($data, $field, $i = null, $default = '')
{
$i = ($i === false || count($this->article_ids) > 1 ) ? $i : 0;
if ($i === null || $i === false) {
$result = [];
foreach ($data as $page_id => $item) {
$result[$page_id] = isset($ite... | php | private function get_list_or_item($data, $field, $i = null, $default = '')
{
$i = ($i === false || count($this->article_ids) > 1 ) ? $i : 0;
if ($i === null || $i === false) {
$result = [];
foreach ($data as $page_id => $item) {
$result[$page_id] = isset($ite... | [
"private",
"function",
"get_list_or_item",
"(",
"$",
"data",
",",
"$",
"field",
",",
"$",
"i",
"=",
"null",
",",
"$",
"default",
"=",
"''",
")",
"{",
"$",
"i",
"=",
"(",
"$",
"i",
"===",
"false",
"||",
"count",
"(",
"$",
"this",
"->",
"article_id... | Get list of articles or items
@param array $data
@param string $field
@param integer $i
@param string $default
@return mixed | [
"Get",
"list",
"of",
"articles",
"or",
"items"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L75-L88 |
188,918 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.setLanguage | public function setLanguage($language)
{
$language = $language ?: $this->language;
if (!in_array($language, $this->getSupportedLanguages())) {
throw new LanguageNotSupportedException(sprintf('Language [%s] is not supported', $language));
}
$this->language = $language;
... | php | public function setLanguage($language)
{
$language = $language ?: $this->language;
if (!in_array($language, $this->getSupportedLanguages())) {
throw new LanguageNotSupportedException(sprintf('Language [%s] is not supported', $language));
}
$this->language = $language;
... | [
"public",
"function",
"setLanguage",
"(",
"$",
"language",
")",
"{",
"$",
"language",
"=",
"$",
"language",
"?",
":",
"$",
"this",
"->",
"language",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"language",
",",
"$",
"this",
"->",
"getSupportedLanguages",
... | Set the language the api should use
@param string $language | [
"Set",
"the",
"language",
"the",
"api",
"should",
"use"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L121-L131 |
188,919 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.setEngine | public function setEngine($engine) {
if (!in_array($engine, $this->getSupportedEngines())) {
throw new EngineNotSupportedException(sprintf('Engine [%s] is not supported', $engine));
}
$this->engine = $engine;
$this->changeBaseApi();
} | php | public function setEngine($engine) {
if (!in_array($engine, $this->getSupportedEngines())) {
throw new EngineNotSupportedException(sprintf('Engine [%s] is not supported', $engine));
}
$this->engine = $engine;
$this->changeBaseApi();
} | [
"public",
"function",
"setEngine",
"(",
"$",
"engine",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"engine",
",",
"$",
"this",
"->",
"getSupportedEngines",
"(",
")",
")",
")",
"{",
"throw",
"new",
"EngineNotSupportedException",
"(",
"sprintf",
"(",
"... | Set Engine to use, whethere wikipedia or wikiquote
@param string $engine | [
"Set",
"Engine",
"to",
"use",
"whethere",
"wikipedia",
"or",
"wikiquote"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L137-L144 |
188,920 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.changeBaseApi | protected function changeBaseApi() {
$domain = $this->language.'.'.$this->engine_supported[$this->engine];
$this->base_api = sprintf('http://%s/w/api.php?format=json&rawcontinue=1&', $domain);
} | php | protected function changeBaseApi() {
$domain = $this->language.'.'.$this->engine_supported[$this->engine];
$this->base_api = sprintf('http://%s/w/api.php?format=json&rawcontinue=1&', $domain);
} | [
"protected",
"function",
"changeBaseApi",
"(",
")",
"{",
"$",
"domain",
"=",
"$",
"this",
"->",
"language",
".",
"'.'",
".",
"$",
"this",
"->",
"engine_supported",
"[",
"$",
"this",
"->",
"engine",
"]",
";",
"$",
"this",
"->",
"base_api",
"=",
"sprintf... | Change the base api to fetch quotes from
@return void | [
"Change",
"the",
"base",
"api",
"to",
"fetch",
"quotes",
"from"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L150-L153 |
188,921 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.getNewRandomArticle | public function getNewRandomArticle($number = 1)
{
$wiki_api = $this->base_api . 'action=query&list=random&rnnamespace=0&rnlimit=' . $number;
$json_wapi = json_decode(file_get_contents($wiki_api), true);
$this->article_ids = [];
foreach ($json_wapi['query']['random'] as $item) {
... | php | public function getNewRandomArticle($number = 1)
{
$wiki_api = $this->base_api . 'action=query&list=random&rnnamespace=0&rnlimit=' . $number;
$json_wapi = json_decode(file_get_contents($wiki_api), true);
$this->article_ids = [];
foreach ($json_wapi['query']['random'] as $item) {
... | [
"public",
"function",
"getNewRandomArticle",
"(",
"$",
"number",
"=",
"1",
")",
"{",
"$",
"wiki_api",
"=",
"$",
"this",
"->",
"base_api",
".",
"'action=query&list=random&rnnamespace=0&rnlimit='",
".",
"$",
"number",
";",
"$",
"json_wapi",
"=",
"json_decode",
"("... | Get a new random article
@param integer $number
@return array | [
"Get",
"a",
"new",
"random",
"article"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L160-L170 |
188,922 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.getFirstSentence | public function getFirstSentence($number = 1, $i = null)
{
$wiki_api = sprintf($this->base_api . 'action=query&prop=extracts&exsentences=%d&explaintext=&exsectionformat=plain&pageids=%s', intval($number), $this->getId());
$json_wapi = json_decode(file_get_contents($wiki_api), true);
return ... | php | public function getFirstSentence($number = 1, $i = null)
{
$wiki_api = sprintf($this->base_api . 'action=query&prop=extracts&exsentences=%d&explaintext=&exsectionformat=plain&pageids=%s', intval($number), $this->getId());
$json_wapi = json_decode(file_get_contents($wiki_api), true);
return ... | [
"public",
"function",
"getFirstSentence",
"(",
"$",
"number",
"=",
"1",
",",
"$",
"i",
"=",
"null",
")",
"{",
"$",
"wiki_api",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"base_api",
".",
"'action=query&prop=extracts&exsentences=%d&explaintext=&exsectionformat=plain&pag... | Get the first sentence of the article
@param integer $number
@param integer $i
@return mixed | [
"Get",
"the",
"first",
"sentence",
"of",
"the",
"article"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L226-L232 |
188,923 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.getCategoriesRelated | public function getCategoriesRelated($i = null)
{
$wiki_api = $this->base_api . 'action=query&prop=categories&pageids=' . $this->getId();
$json_wapi = json_decode(file_get_contents($wiki_api), true);
$result = $this->get_list_or_item($json_wapi['query']['pages'], 'categories', false, []);
... | php | public function getCategoriesRelated($i = null)
{
$wiki_api = $this->base_api . 'action=query&prop=categories&pageids=' . $this->getId();
$json_wapi = json_decode(file_get_contents($wiki_api), true);
$result = $this->get_list_or_item($json_wapi['query']['pages'], 'categories', false, []);
... | [
"public",
"function",
"getCategoriesRelated",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"$",
"wiki_api",
"=",
"$",
"this",
"->",
"base_api",
".",
"'action=query&prop=categories&pageids='",
".",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"$",
"json_wapi",
"=",
... | Get related categories for the articles
@param integer $i
@return array | [
"Get",
"related",
"categories",
"for",
"the",
"articles"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L266-L282 |
188,924 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.getArticleImages | public function getArticleImages($i = null, $image_min_size = 0)
{
$result = [];
$i = count($this->article_ids) > 1 ? $i : 0;
$article_ids = ($i === null) ? $this->article_ids : [$this->article_ids[$i]];
foreach ($article_ids as $page_id) {
$result[$page_id] = [];
... | php | public function getArticleImages($i = null, $image_min_size = 0)
{
$result = [];
$i = count($this->article_ids) > 1 ? $i : 0;
$article_ids = ($i === null) ? $this->article_ids : [$this->article_ids[$i]];
foreach ($article_ids as $page_id) {
$result[$page_id] = [];
... | [
"public",
"function",
"getArticleImages",
"(",
"$",
"i",
"=",
"null",
",",
"$",
"image_min_size",
"=",
"0",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"i",
"=",
"count",
"(",
"$",
"this",
"->",
"article_ids",
")",
">",
"1",
"?",
"$",
"i",
... | Get Images of the Articles
@param integer $i
@param integer $image_min_size
@return array | [
"Get",
"Images",
"of",
"the",
"Articles"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L290-L317 |
188,925 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.getOtherLangLinks | public function getOtherLangLinks($i = null)
{
$wiki_api = $this->base_api . 'action=query&prop=langlinks&llprop=url&pageids=' . $this->getId();
$json_wapi = json_decode(file_get_contents($wiki_api), true);
return $this->get_list_or_item($json_wapi['query']['pages'], 'langlinks', $i, []);
... | php | public function getOtherLangLinks($i = null)
{
$wiki_api = $this->base_api . 'action=query&prop=langlinks&llprop=url&pageids=' . $this->getId();
$json_wapi = json_decode(file_get_contents($wiki_api), true);
return $this->get_list_or_item($json_wapi['query']['pages'], 'langlinks', $i, []);
... | [
"public",
"function",
"getOtherLangLinks",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"$",
"wiki_api",
"=",
"$",
"this",
"->",
"base_api",
".",
"'action=query&prop=langlinks&llprop=url&pageids='",
".",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"$",
"json_wapi",
... | Get other language links
@param integer $i
@return mixed | [
"Get",
"other",
"language",
"links"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L324-L330 |
188,926 | unicodeveloper/laravel-wikipedia | src/WikiRand.php | WikiRand.getBulkData | public function getBulkData($limit = 1, $sentences = 5, $chars = 200, $with_images = false, $image_min_size = 102400)
{
$wiki_api = $this->base_api . 'action=query&generator=random&grnnamespace=0&grnlimit=' . $limit . '&prop=info|extracts&inprop=url&explaintext=&exsectionformat=plain';
if ($sentenc... | php | public function getBulkData($limit = 1, $sentences = 5, $chars = 200, $with_images = false, $image_min_size = 102400)
{
$wiki_api = $this->base_api . 'action=query&generator=random&grnnamespace=0&grnlimit=' . $limit . '&prop=info|extracts&inprop=url&explaintext=&exsectionformat=plain';
if ($sentenc... | [
"public",
"function",
"getBulkData",
"(",
"$",
"limit",
"=",
"1",
",",
"$",
"sentences",
"=",
"5",
",",
"$",
"chars",
"=",
"200",
",",
"$",
"with_images",
"=",
"false",
",",
"$",
"image_min_size",
"=",
"102400",
")",
"{",
"$",
"wiki_api",
"=",
"$",
... | Get Bulk Data
@param integer $limit
@param integer $sentences
@param integer $chars
@param boolean $with_images
@param integer $image_min_size
@return array | [
"Get",
"Bulk",
"Data"
] | 4ae52d9373abd17a6e71ddee23b31593d12a63a2 | https://github.com/unicodeveloper/laravel-wikipedia/blob/4ae52d9373abd17a6e71ddee23b31593d12a63a2/src/WikiRand.php#L341-L388 |
188,927 | dazzle-php/socket | src/Socket/SocketListener.php | SocketListener.createServer | protected function createServer($endpoint, $config = [])
{
if (stripos($endpoint, 'unix://') !== false)
{
if ($endpoint[7] === DIRECTORY_SEPARATOR)
{
$path = substr($endpoint, 7);
}
else
{
$path = getcwd() . ... | php | protected function createServer($endpoint, $config = [])
{
if (stripos($endpoint, 'unix://') !== false)
{
if ($endpoint[7] === DIRECTORY_SEPARATOR)
{
$path = substr($endpoint, 7);
}
else
{
$path = getcwd() . ... | [
"protected",
"function",
"createServer",
"(",
"$",
"endpoint",
",",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"endpoint",
",",
"'unix://'",
")",
"!==",
"false",
")",
"{",
"if",
"(",
"$",
"endpoint",
"[",
"7",
"]",
"===... | Create the server resource.
This method creates server resource for socket connections.
@param string $endpoint
@param mixed[] $config
@return resource
@throws LogicException | [
"Create",
"the",
"server",
"resource",
"."
] | 7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5 | https://github.com/dazzle-php/socket/blob/7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5/src/Socket/SocketListener.php#L350-L435 |
188,928 | dazzle-php/socket | src/Socket/SocketListener.php | SocketListener.handleConnect | public function handleConnect()
{
$socket = @stream_socket_accept($this->socket);
if ($socket === false)
{
$this->emit('error', [ $this, new ReadException('Socket could not accept new connection.') ]);
return;
}
$client = null;
$ex = null;
... | php | public function handleConnect()
{
$socket = @stream_socket_accept($this->socket);
if ($socket === false)
{
$this->emit('error', [ $this, new ReadException('Socket could not accept new connection.') ]);
return;
}
$client = null;
$ex = null;
... | [
"public",
"function",
"handleConnect",
"(",
")",
"{",
"$",
"socket",
"=",
"@",
"stream_socket_accept",
"(",
"$",
"this",
"->",
"socket",
")",
";",
"if",
"(",
"$",
"socket",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"emit",
"(",
"'error'",
",",
"["... | Handle the new connection.
@internal | [
"Handle",
"the",
"new",
"connection",
"."
] | 7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5 | https://github.com/dazzle-php/socket/blob/7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5/src/Socket/SocketListener.php#L456-L488 |
188,929 | dazzle-php/socket | src/Socket/SocketListener.php | SocketListener.handleClose | public function handleClose()
{
$this->pause();
if (is_resource($this->socket))
{
if ($this->getStreamType() === Socket::TYPE_UNIX)
{
$path = substr($this->parseEndpoint(), 7);
unlink($path);
}
fclose($this->soc... | php | public function handleClose()
{
$this->pause();
if (is_resource($this->socket))
{
if ($this->getStreamType() === Socket::TYPE_UNIX)
{
$path = substr($this->parseEndpoint(), 7);
unlink($path);
}
fclose($this->soc... | [
"public",
"function",
"handleClose",
"(",
")",
"{",
"$",
"this",
"->",
"pause",
"(",
")",
";",
"if",
"(",
"is_resource",
"(",
"$",
"this",
"->",
"socket",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getStreamType",
"(",
")",
"===",
"Socket",
"::"... | Handle closing event.
@internal | [
"Handle",
"closing",
"event",
"."
] | 7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5 | https://github.com/dazzle-php/socket/blob/7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5/src/Socket/SocketListener.php#L506-L519 |
188,930 | dazzle-php/socket | src/Socket/SocketListener.php | SocketListener.configure | private function configure($config = [])
{
$this->config = $config;
$this->configureVariable('ssl');
$this->configureVariable('ssl_method');
$this->configureVariable('ssl_name');
$this->configureVariable('ssl_verify_sign');
$this->configureVariable('ssl_verify_peer')... | php | private function configure($config = [])
{
$this->config = $config;
$this->configureVariable('ssl');
$this->configureVariable('ssl_method');
$this->configureVariable('ssl_name');
$this->configureVariable('ssl_verify_sign');
$this->configureVariable('ssl_verify_peer')... | [
"private",
"function",
"configure",
"(",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"$",
"config",
";",
"$",
"this",
"->",
"configureVariable",
"(",
"'ssl'",
")",
";",
"$",
"this",
"->",
"configureVariable",
"(",
"'ssl_me... | Configure socket.
@param string[] $config | [
"Configure",
"socket",
"."
] | 7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5 | https://github.com/dazzle-php/socket/blob/7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5/src/Socket/SocketListener.php#L526-L536 |
188,931 | dazzle-php/socket | src/Socket/SocketListener.php | SocketListener.configureVariable | private function configureVariable($configKey)
{
$configStaticKey = 'CONFIG_DEFAULT_' . strtoupper($configKey);
$this->config[$configKey] = isset($this->config[$configKey]) ? $this->config[$configKey] : constant("static::$configStaticKey");
} | php | private function configureVariable($configKey)
{
$configStaticKey = 'CONFIG_DEFAULT_' . strtoupper($configKey);
$this->config[$configKey] = isset($this->config[$configKey]) ? $this->config[$configKey] : constant("static::$configStaticKey");
} | [
"private",
"function",
"configureVariable",
"(",
"$",
"configKey",
")",
"{",
"$",
"configStaticKey",
"=",
"'CONFIG_DEFAULT_'",
".",
"strtoupper",
"(",
"$",
"configKey",
")",
";",
"$",
"this",
"->",
"config",
"[",
"$",
"configKey",
"]",
"=",
"isset",
"(",
"... | Configure static key
@param $configKey | [
"Configure",
"static",
"key"
] | 7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5 | https://github.com/dazzle-php/socket/blob/7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5/src/Socket/SocketListener.php#L543-L547 |
188,932 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findFacetById | public function findFacetById($id)
{
// No personality defined yet.
if (is_null($this->personality)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('trait_id', $id, $this->personality);
} | php | public function findFacetById($id)
{
// No personality defined yet.
if (is_null($this->personality)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('trait_id', $id, $this->personality);
} | [
"public",
"function",
"findFacetById",
"(",
"$",
"id",
")",
"{",
"// No personality defined yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"personality",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Traverse and Return.",
"return",
"$",
"this",
"->",
... | Get a Facet using Id.
@param string $id
@return TraitTreeNode|null | [
"Get",
"a",
"Facet",
"using",
"Id",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L185-L194 |
188,933 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findFacetByName | public function findFacetByName($name)
{
// No personality defined yet.
if (is_null($this->personality)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('name', $name, $this->personality);
} | php | public function findFacetByName($name)
{
// No personality defined yet.
if (is_null($this->personality)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('name', $name, $this->personality);
} | [
"public",
"function",
"findFacetByName",
"(",
"$",
"name",
")",
"{",
"// No personality defined yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"personality",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Traverse and Return.",
"return",
"$",
"this",
"->... | Get a Facet using Name.
@param string $name
@return TraitTreeNode|null | [
"Get",
"a",
"Facet",
"using",
"Name",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L203-L212 |
188,934 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.hasFacet | public function hasFacet($facet)
{
return ! is_null($this->findFacetByName($facet)) || ! is_null($this->findFacetById($facet));
} | php | public function hasFacet($facet)
{
return ! is_null($this->findFacetByName($facet)) || ! is_null($this->findFacetById($facet));
} | [
"public",
"function",
"hasFacet",
"(",
"$",
"facet",
")",
"{",
"return",
"!",
"is_null",
"(",
"$",
"this",
"->",
"findFacetByName",
"(",
"$",
"facet",
")",
")",
"||",
"!",
"is_null",
"(",
"$",
"this",
"->",
"findFacetById",
"(",
"$",
"facet",
")",
")... | Checks if the Profile has the Facet given.
@param string $facet
@return bool | [
"Checks",
"if",
"the",
"Profile",
"has",
"the",
"Facet",
"given",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L221-L224 |
188,935 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findNeedById | public function findNeedById($id)
{
// No needs defined yet.
if (is_null($this->needs)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('trait_id', $id, $this->needs);
} | php | public function findNeedById($id)
{
// No needs defined yet.
if (is_null($this->needs)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('trait_id', $id, $this->needs);
} | [
"public",
"function",
"findNeedById",
"(",
"$",
"id",
")",
"{",
"// No needs defined yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"needs",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Traverse and Return.",
"return",
"$",
"this",
"->",
"traverseNod... | Get a Need using Id.
@param string $id
@return TraitTreeNode|null | [
"Get",
"a",
"Need",
"using",
"Id",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L233-L242 |
188,936 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findNeedByName | public function findNeedByName($name)
{
// No needs defined yet.
if (is_null($this->needs)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('name', $name, $this->needs);
} | php | public function findNeedByName($name)
{
// No needs defined yet.
if (is_null($this->needs)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('name', $name, $this->needs);
} | [
"public",
"function",
"findNeedByName",
"(",
"$",
"name",
")",
"{",
"// No needs defined yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"needs",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Traverse and Return.",
"return",
"$",
"this",
"->",
"travers... | Get a Need using its name.
@param string $name
@return TraitTreeNode|null | [
"Get",
"a",
"Need",
"using",
"its",
"name",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L251-L260 |
188,937 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.hasNeed | public function hasNeed($need)
{
return ! is_null($this->findNeedByName($need)) || ! is_null($this->findNeedById($need));
} | php | public function hasNeed($need)
{
return ! is_null($this->findNeedByName($need)) || ! is_null($this->findNeedById($need));
} | [
"public",
"function",
"hasNeed",
"(",
"$",
"need",
")",
"{",
"return",
"!",
"is_null",
"(",
"$",
"this",
"->",
"findNeedByName",
"(",
"$",
"need",
")",
")",
"||",
"!",
"is_null",
"(",
"$",
"this",
"->",
"findNeedById",
"(",
"$",
"need",
")",
")",
"... | Checks if Profile has given need.
@param string $need
@return bool | [
"Checks",
"if",
"Profile",
"has",
"given",
"need",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L269-L272 |
188,938 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findValueById | public function findValueById($id)
{
// No values defined yet.
if (is_null($this->values)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('trait_id', $id, $this->values);
} | php | public function findValueById($id)
{
// No values defined yet.
if (is_null($this->values)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('trait_id', $id, $this->values);
} | [
"public",
"function",
"findValueById",
"(",
"$",
"id",
")",
"{",
"// No values defined yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"values",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Traverse and Return.",
"return",
"$",
"this",
"->",
"traverse... | Get a Value using Id.
@param string $id
@return TraitTreeNode|null | [
"Get",
"a",
"Value",
"using",
"Id",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L281-L290 |
188,939 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findValueByName | public function findValueByName($name)
{
// No values defined yet.
if (is_null($this->values)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('name', $name, $this->values);
} | php | public function findValueByName($name)
{
// No values defined yet.
if (is_null($this->values)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('name', $name, $this->values);
} | [
"public",
"function",
"findValueByName",
"(",
"$",
"name",
")",
"{",
"// No values defined yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"values",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Traverse and Return.",
"return",
"$",
"this",
"->",
"trav... | Get a Value using its name.
@param string $name
@return TraitTreeNode|null | [
"Get",
"a",
"Value",
"using",
"its",
"name",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L299-L308 |
188,940 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.hasValue | public function hasValue($value)
{
return ! is_null($this->findValueByName($value)) || ! is_null($this->findValueById($value));
} | php | public function hasValue($value)
{
return ! is_null($this->findValueByName($value)) || ! is_null($this->findValueById($value));
} | [
"public",
"function",
"hasValue",
"(",
"$",
"value",
")",
"{",
"return",
"!",
"is_null",
"(",
"$",
"this",
"->",
"findValueByName",
"(",
"$",
"value",
")",
")",
"||",
"!",
"is_null",
"(",
"$",
"this",
"->",
"findValueById",
"(",
"$",
"value",
")",
")... | Checks if Profile has given value.
@param string $value
@return bool | [
"Checks",
"if",
"Profile",
"has",
"given",
"value",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L317-L320 |
188,941 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findBehaviorsFor | public function findBehaviorsFor($times)
{
// No behaviors set yet.
if (is_null($this->behavior)) {
return null;
}
// Specifically convert times to array.
$times = ! is_array($times) ? [$times] : $times;
// Return Behavior at specific times
$beha... | php | public function findBehaviorsFor($times)
{
// No behaviors set yet.
if (is_null($this->behavior)) {
return null;
}
// Specifically convert times to array.
$times = ! is_array($times) ? [$times] : $times;
// Return Behavior at specific times
$beha... | [
"public",
"function",
"findBehaviorsFor",
"(",
"$",
"times",
")",
"{",
"// No behaviors set yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"behavior",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Specifically convert times to array.",
"$",
"times",
"=",
... | Find Behaviors a give times or Days.
@param array|string $times
@return Collection|BehaviorNode|null | [
"Find",
"Behaviors",
"a",
"give",
"times",
"or",
"Days",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L329-L350 |
188,942 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findConsumptionPreferenceCategoryById | public function findConsumptionPreferenceCategoryById($preference)
{
// No Preferences defined yet.
if (is_null($this->consumption_preferences)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('consumption_preference_category_id', $p... | php | public function findConsumptionPreferenceCategoryById($preference)
{
// No Preferences defined yet.
if (is_null($this->consumption_preferences)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('consumption_preference_category_id', $p... | [
"public",
"function",
"findConsumptionPreferenceCategoryById",
"(",
"$",
"preference",
")",
"{",
"// No Preferences defined yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"consumption_preferences",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Traverse and Retu... | Get a ConsumptionPreferencesCategory using Id.
@param string $preference
@return ConsumptionPreferencesCategoryNode|null | [
"Get",
"a",
"ConsumptionPreferencesCategory",
"using",
"Id",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L359-L368 |
188,943 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findConsumptionPreferenceCategoryName | public function findConsumptionPreferenceCategoryName($preference)
{
// No Preferences defined yet.
if (is_null($this->consumption_preferences)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('name', $preference, $this->consumption_... | php | public function findConsumptionPreferenceCategoryName($preference)
{
// No Preferences defined yet.
if (is_null($this->consumption_preferences)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('name', $preference, $this->consumption_... | [
"public",
"function",
"findConsumptionPreferenceCategoryName",
"(",
"$",
"preference",
")",
"{",
"// No Preferences defined yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"consumption_preferences",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Traverse and Retu... | Get a ConsumptionPreferencesCategory using its name.
@param string $preference
@return ConsumptionPreferencesCategoryNode|null | [
"Get",
"a",
"ConsumptionPreferencesCategory",
"using",
"its",
"name",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L377-L386 |
188,944 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.hasConsumptionPreferenceCategory | public function hasConsumptionPreferenceCategory($preference)
{
return ! is_null($this->findConsumptionPreferenceCategoryName($preference)) || ! is_null($this->findConsumptionPreferenceCategoryById($preference));
} | php | public function hasConsumptionPreferenceCategory($preference)
{
return ! is_null($this->findConsumptionPreferenceCategoryName($preference)) || ! is_null($this->findConsumptionPreferenceCategoryById($preference));
} | [
"public",
"function",
"hasConsumptionPreferenceCategory",
"(",
"$",
"preference",
")",
"{",
"return",
"!",
"is_null",
"(",
"$",
"this",
"->",
"findConsumptionPreferenceCategoryName",
"(",
"$",
"preference",
")",
")",
"||",
"!",
"is_null",
"(",
"$",
"this",
"->",... | Checks if ConsumptionPreferencesCategory exists on profile.
@param string $preference
@return bool | [
"Checks",
"if",
"ConsumptionPreferencesCategory",
"exists",
"on",
"profile",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L395-L398 |
188,945 | findbrok/laravel-personality-insights | src/Models/Profile.php | Profile.findConsumptionPreference | public function findConsumptionPreference($preferenceId)
{
// No Preferences defined yet.
if (is_null($this->consumption_preferences)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('consumption_preference_id', $preferenceId, $this-... | php | public function findConsumptionPreference($preferenceId)
{
// No Preferences defined yet.
if (is_null($this->consumption_preferences)) {
return null;
}
// Traverse and Return.
return $this->traverseNodesAndFindBy('consumption_preference_id', $preferenceId, $this-... | [
"public",
"function",
"findConsumptionPreference",
"(",
"$",
"preferenceId",
")",
"{",
"// No Preferences defined yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"consumption_preferences",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Traverse and Return.",
"r... | Find ConsumptionPreferencesNode by Id.
@param string $preferenceId
@return ConsumptionPreferencesNode|null | [
"Find",
"ConsumptionPreferencesNode",
"by",
"Id",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/Profile.php#L407-L416 |
188,946 | findbrok/laravel-personality-insights | src/Auth/AccessManager.php | AccessManager.setCredentialsName | public function setCredentialsName($credentialsName = null)
{
// No credentials name.
if (is_null($credentialsName)) {
$credentialsName = config('personality-insights.default_credentials');
}
// Credentials does not exist.
if (! config()->has('personality-insight... | php | public function setCredentialsName($credentialsName = null)
{
// No credentials name.
if (is_null($credentialsName)) {
$credentialsName = config('personality-insights.default_credentials');
}
// Credentials does not exist.
if (! config()->has('personality-insight... | [
"public",
"function",
"setCredentialsName",
"(",
"$",
"credentialsName",
"=",
"null",
")",
"{",
"// No credentials name.",
"if",
"(",
"is_null",
"(",
"$",
"credentialsName",
")",
")",
"{",
"$",
"credentialsName",
"=",
"config",
"(",
"'personality-insights.default_cr... | Sets the Credentials name.
@param string $credentialsName
@return $this | [
"Sets",
"the",
"Credentials",
"name",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Auth/AccessManager.php#L55-L70 |
188,947 | findbrok/laravel-personality-insights | src/Auth/AccessManager.php | AccessManager.setCredentials | public function setCredentials($name = null)
{
// No name given.
if (is_null($name)) {
$name = config('personality-insights.default_credentials');
}
// Credentials does not exist.
if (! config()->has('personality-insights.credentials.'.$name)) {
throw... | php | public function setCredentials($name = null)
{
// No name given.
if (is_null($name)) {
$name = config('personality-insights.default_credentials');
}
// Credentials does not exist.
if (! config()->has('personality-insights.credentials.'.$name)) {
throw... | [
"public",
"function",
"setCredentials",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"// No name given.",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"config",
"(",
"'personality-insights.default_credentials'",
")",
";",
"}",
"// Cre... | Sets the Credentials we will use to perform requests.
@param string $name
@throws InvalidCredentialsName
@return $this | [
"Sets",
"the",
"Credentials",
"we",
"will",
"use",
"to",
"perform",
"requests",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Auth/AccessManager.php#L101-L116 |
188,948 | findbrok/laravel-personality-insights | src/Auth/AccessManager.php | AccessManager.setApiVersion | public function setApiVersion($apiVersion = null)
{
// No version specified.
if (is_null($apiVersion)) {
$apiVersion = config('personality-insights.api_version') ?: 'v3';
}
$this->apiVersion = $apiVersion;
return $this;
} | php | public function setApiVersion($apiVersion = null)
{
// No version specified.
if (is_null($apiVersion)) {
$apiVersion = config('personality-insights.api_version') ?: 'v3';
}
$this->apiVersion = $apiVersion;
return $this;
} | [
"public",
"function",
"setApiVersion",
"(",
"$",
"apiVersion",
"=",
"null",
")",
"{",
"// No version specified.",
"if",
"(",
"is_null",
"(",
"$",
"apiVersion",
")",
")",
"{",
"$",
"apiVersion",
"=",
"config",
"(",
"'personality-insights.api_version'",
")",
"?",
... | Sets ths API version we are using.
@param string $apiVersion
@return $this | [
"Sets",
"ths",
"API",
"version",
"we",
"are",
"using",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Auth/AccessManager.php#L136-L146 |
188,949 | findbrok/laravel-personality-insights | src/Models/TraitTreeNode.php | TraitTreeNode.calculatePercentage | public function calculatePercentage($decimal = 1)
{
// Profile not loaded yet.
if (is_null($this->percentile)) {
return null;
}
// Calculate percentage and return value
return (float) number_format($this->percentile * 100, $decimal, '.', '');
} | php | public function calculatePercentage($decimal = 1)
{
// Profile not loaded yet.
if (is_null($this->percentile)) {
return null;
}
// Calculate percentage and return value
return (float) number_format($this->percentile * 100, $decimal, '.', '');
} | [
"public",
"function",
"calculatePercentage",
"(",
"$",
"decimal",
"=",
"1",
")",
"{",
"// Profile not loaded yet.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"percentile",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Calculate percentage and return value",
... | Calculate the percentage for this node.
@param int $decimal
@return float|null | [
"Calculate",
"the",
"percentage",
"for",
"this",
"node",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/TraitTreeNode.php#L100-L109 |
188,950 | dazzle-php/socket | src/Socket/Socket.php | Socket.createClient | protected function createClient($endpoint, $config = [])
{
$ssl = $this->config['ssl'];
$name = $this->config['ssl_name'];
$verifySign = $this->config['ssl_verify_sign'];
$verifyPeer = $this->config['ssl_verify_peer'];
$verifyDepth = $this->config['ssl_verify_depth'];
... | php | protected function createClient($endpoint, $config = [])
{
$ssl = $this->config['ssl'];
$name = $this->config['ssl_name'];
$verifySign = $this->config['ssl_verify_sign'];
$verifyPeer = $this->config['ssl_verify_peer'];
$verifyDepth = $this->config['ssl_verify_depth'];
... | [
"protected",
"function",
"createClient",
"(",
"$",
"endpoint",
",",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"ssl",
"=",
"$",
"this",
"->",
"config",
"[",
"'ssl'",
"]",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"config",
"[",
"'ssl_name'",
"]",... | Create the client resource.
This method creates client resource for socket connections.
@param string $endpoint
@param mixed[] $config
@return resource
@throws LogicException | [
"Create",
"the",
"client",
"resource",
"."
] | 7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5 | https://github.com/dazzle-php/socket/blob/7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5/src/Socket/Socket.php#L265-L323 |
188,951 | dazzle-php/socket | src/Socket/Socket.php | Socket.handleEncrypt | public function handleEncrypt()
{
$ex = null;
try
{
if ($this->isEncrypted())
{
return;
}
$this->encrypt($this->config['ssl_method']);
if ($this->isEncrypted())
{
$this->pause();
... | php | public function handleEncrypt()
{
$ex = null;
try
{
if ($this->isEncrypted())
{
return;
}
$this->encrypt($this->config['ssl_method']);
if ($this->isEncrypted())
{
$this->pause();
... | [
"public",
"function",
"handleEncrypt",
"(",
")",
"{",
"$",
"ex",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"isEncrypted",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"encrypt",
"(",
"$",
"this",
"->",
"config",
"[... | Handle socket encryption.
@internal | [
"Handle",
"socket",
"encryption",
"."
] | 7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5 | https://github.com/dazzle-php/socket/blob/7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5/src/Socket/Socket.php#L330-L359 |
188,952 | dazzle-php/socket | src/Socket/Socket.php | Socket.selectCryptoType | private function selectCryptoType($version)
{
switch ($version)
{
case STREAM_CRYPTO_METHOD_SSLv3_SERVER:
case STREAM_CRYPTO_METHOD_TLSv1_0_SERVER:
case STREAM_CRYPTO_METHOD_TLSv1_1_SERVER:
case STREAM_CRYPTO_METHOD_TLSv1_2_SERVER:
retu... | php | private function selectCryptoType($version)
{
switch ($version)
{
case STREAM_CRYPTO_METHOD_SSLv3_SERVER:
case STREAM_CRYPTO_METHOD_TLSv1_0_SERVER:
case STREAM_CRYPTO_METHOD_TLSv1_1_SERVER:
case STREAM_CRYPTO_METHOD_TLSv1_2_SERVER:
retu... | [
"private",
"function",
"selectCryptoType",
"(",
"$",
"version",
")",
"{",
"switch",
"(",
"$",
"version",
")",
"{",
"case",
"STREAM_CRYPTO_METHOD_SSLv3_SERVER",
":",
"case",
"STREAM_CRYPTO_METHOD_TLSv1_0_SERVER",
":",
"case",
"STREAM_CRYPTO_METHOD_TLSv1_1_SERVER",
":",
"... | Checks type of crypto.
@param int $version
@return int | [
"Checks",
"type",
"of",
"crypto",
"."
] | 7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5 | https://github.com/dazzle-php/socket/blob/7f896d8ebdabbd9cc158fca44a46a6a0a6f0b6e5/src/Socket/Socket.php#L619-L638 |
188,953 | findbrok/laravel-personality-insights | src/PersonalityInsights.php | PersonalityInsights.getProfileFromWatson | public function getProfileFromWatson()
{
// We have the request in cache and cache is on.
if ($this->cacheIsOn() && $this->cache->has($this->getContainer()->getCacheKey())) {
// Return results from cache.
return $this->cache->get($this->getContainer()->getCacheKey());
... | php | public function getProfileFromWatson()
{
// We have the request in cache and cache is on.
if ($this->cacheIsOn() && $this->cache->has($this->getContainer()->getCacheKey())) {
// Return results from cache.
return $this->cache->get($this->getContainer()->getCacheKey());
... | [
"public",
"function",
"getProfileFromWatson",
"(",
")",
"{",
"// We have the request in cache and cache is on.",
"if",
"(",
"$",
"this",
"->",
"cacheIsOn",
"(",
")",
"&&",
"$",
"this",
"->",
"cache",
"->",
"has",
"(",
"$",
"this",
"->",
"getContainer",
"(",
")... | Get Full Insights From Watson API.
@throws \FindBrok\WatsonBridge\Exceptions\WatsonBridgeException
@return Profile | [
"Get",
"Full",
"Insights",
"From",
"Watson",
"API",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/PersonalityInsights.php#L78-L100 |
188,954 | findbrok/laravel-personality-insights | src/PersonalityInsights.php | PersonalityInsights.clean | public function clean()
{
// Empty Profile.
$this->profile = null;
// Empty credentials.
$this->credentialsName = null;
// Recreate a new container.
$this->newUpContainer();
// Clean headers.
$this->cleanHeaders();
// Clean Query
$this... | php | public function clean()
{
// Empty Profile.
$this->profile = null;
// Empty credentials.
$this->credentialsName = null;
// Recreate a new container.
$this->newUpContainer();
// Clean headers.
$this->cleanHeaders();
// Clean Query
$this... | [
"public",
"function",
"clean",
"(",
")",
"{",
"// Empty Profile.",
"$",
"this",
"->",
"profile",
"=",
"null",
";",
"// Empty credentials.",
"$",
"this",
"->",
"credentialsName",
"=",
"null",
";",
"// Recreate a new container.",
"$",
"this",
"->",
"newUpContainer",... | Cleans the object by erasing all profile and content info.
@return $this | [
"Cleans",
"the",
"object",
"by",
"erasing",
"all",
"profile",
"and",
"content",
"info",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/PersonalityInsights.php#L124-L140 |
188,955 | findbrok/laravel-personality-insights | src/InsightsServiceProvider.php | InsightsServiceProvider.registerBindings | protected function registerBindings()
{
// Bind Personality Insights interface.
$this->app->bind(InsightsContract::class, PersonalityInsights::class);
// Bind Personality Insights Service.
$this->app->bind(PersonalityInsights::SERVICE_ID, PersonalityInsights::class);
// Reg... | php | protected function registerBindings()
{
// Bind Personality Insights interface.
$this->app->bind(InsightsContract::class, PersonalityInsights::class);
// Bind Personality Insights Service.
$this->app->bind(PersonalityInsights::SERVICE_ID, PersonalityInsights::class);
// Reg... | [
"protected",
"function",
"registerBindings",
"(",
")",
"{",
"// Bind Personality Insights interface.",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"InsightsContract",
"::",
"class",
",",
"PersonalityInsights",
"::",
"class",
")",
";",
"// Bind Personality Insights Serv... | Registers all Interface to Class bindings.
@return void | [
"Registers",
"all",
"Interface",
"to",
"Class",
"bindings",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/InsightsServiceProvider.php#L52-L70 |
188,956 | findbrok/laravel-personality-insights | src/InsightsServiceProvider.php | InsightsServiceProvider.registerAccessManager | protected function registerAccessManager()
{
// Bind AccessManager.
$this->app->singleton(AccessManager::SERVICE_ID, function (Application $app) {
/** @var Repository $configRepo */
$configRepo = $app->make('config');
return new AccessManager(
$co... | php | protected function registerAccessManager()
{
// Bind AccessManager.
$this->app->singleton(AccessManager::SERVICE_ID, function (Application $app) {
/** @var Repository $configRepo */
$configRepo = $app->make('config');
return new AccessManager(
$co... | [
"protected",
"function",
"registerAccessManager",
"(",
")",
"{",
"// Bind AccessManager.",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"AccessManager",
"::",
"SERVICE_ID",
",",
"function",
"(",
"Application",
"$",
"app",
")",
"{",
"/** @var Repository $configR... | Registers the Access Manager in
the Container.
@return void | [
"Registers",
"the",
"Access",
"Manager",
"in",
"the",
"Container",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/InsightsServiceProvider.php#L78-L90 |
188,957 | findbrok/laravel-personality-insights | src/InsightsServiceProvider.php | InsightsServiceProvider.registerBridge | protected function registerBridge()
{
// Bind WatsonBridge for Personality insights that we depend on.
$this->app->bind('PIBridge', function (Application $app) {
// Get Default Credentials.
$credentials = $app->make(AccessManager::SERVICE_ID)->getCredentials();
/... | php | protected function registerBridge()
{
// Bind WatsonBridge for Personality insights that we depend on.
$this->app->bind('PIBridge', function (Application $app) {
// Get Default Credentials.
$credentials = $app->make(AccessManager::SERVICE_ID)->getCredentials();
/... | [
"protected",
"function",
"registerBridge",
"(",
")",
"{",
"// Bind WatsonBridge for Personality insights that we depend on.",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'PIBridge'",
",",
"function",
"(",
"Application",
"$",
"app",
")",
"{",
"// Get Default Credential... | Registers the Bridge.
@return void | [
"Registers",
"the",
"Bridge",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/InsightsServiceProvider.php#L97-L107 |
188,958 | findbrok/laravel-personality-insights | src/InsightsServiceProvider.php | InsightsServiceProvider.registerFacades | protected function registerFacades()
{
// Since Laravel 5.4 allows for automatic Facade
// we do not need to register Facades here.
if ($this->app->version() >= 5.0 && $this->app->version() < 5.4) {
// Add Facade.
$this->app->booting(function () {
Alia... | php | protected function registerFacades()
{
// Since Laravel 5.4 allows for automatic Facade
// we do not need to register Facades here.
if ($this->app->version() >= 5.0 && $this->app->version() < 5.4) {
// Add Facade.
$this->app->booting(function () {
Alia... | [
"protected",
"function",
"registerFacades",
"(",
")",
"{",
"// Since Laravel 5.4 allows for automatic Facade",
"// we do not need to register Facades here.",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"version",
"(",
")",
">=",
"5.0",
"&&",
"$",
"this",
"->",
"app",
... | Registers all facades.
@return void | [
"Registers",
"all",
"facades",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/InsightsServiceProvider.php#L114-L124 |
188,959 | findbrok/laravel-personality-insights | src/AbstractPersonalityInsights.php | AbstractPersonalityInsights.usingCredentials | public function usingCredentials($name = null)
{
// Set credentials name.
$this->getAccessManager()->setCredentialsName($name)->setCredentials($name);
// Return this.
return $this;
} | php | public function usingCredentials($name = null)
{
// Set credentials name.
$this->getAccessManager()->setCredentialsName($name)->setCredentials($name);
// Return this.
return $this;
} | [
"public",
"function",
"usingCredentials",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"// Set credentials name.",
"$",
"this",
"->",
"getAccessManager",
"(",
")",
"->",
"setCredentialsName",
"(",
"$",
"name",
")",
"->",
"setCredentials",
"(",
"$",
"name",
")",
... | Specify the credentials name to use.
@param string $name
@return $this | [
"Specify",
"the",
"credentials",
"name",
"to",
"use",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/AbstractPersonalityInsights.php#L78-L85 |
188,960 | findbrok/laravel-personality-insights | src/AbstractPersonalityInsights.php | AbstractPersonalityInsights.getQuery | protected function getQuery()
{
// Our final results.
$finalQueryString = '';
// Construct query string.
foreach ($this->query as $key => $value) {
$finalQueryString .= $key.'='.$value.'&';
}
// We have something in the result.
if (! empty($final... | php | protected function getQuery()
{
// Our final results.
$finalQueryString = '';
// Construct query string.
foreach ($this->query as $key => $value) {
$finalQueryString .= $key.'='.$value.'&';
}
// We have something in the result.
if (! empty($final... | [
"protected",
"function",
"getQuery",
"(",
")",
"{",
"// Our final results.",
"$",
"finalQueryString",
"=",
"''",
";",
"// Construct query string.",
"foreach",
"(",
"$",
"this",
"->",
"query",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"finalQueryStri... | Get Query to pass additionally to the request,.
@return string | [
"Get",
"Query",
"to",
"pass",
"additionally",
"to",
"the",
"request",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/AbstractPersonalityInsights.php#L142-L159 |
188,961 | findbrok/laravel-personality-insights | src/AbstractPersonalityInsights.php | AbstractPersonalityInsights.sendRequest | protected function sendRequest()
{
// Get AccessManager.
$accessManager = $this->getAccessManager();
// Make a Watson Bridge.
$watsonBridge = $this->makeBridge();
// Get Url We post to Watson to Get Profile.
$postUrl = $accessManager->getProfileResourcePath();
... | php | protected function sendRequest()
{
// Get AccessManager.
$accessManager = $this->getAccessManager();
// Make a Watson Bridge.
$watsonBridge = $this->makeBridge();
// Get Url We post to Watson to Get Profile.
$postUrl = $accessManager->getProfileResourcePath();
... | [
"protected",
"function",
"sendRequest",
"(",
")",
"{",
"// Get AccessManager.",
"$",
"accessManager",
"=",
"$",
"this",
"->",
"getAccessManager",
"(",
")",
";",
"// Make a Watson Bridge.",
"$",
"watsonBridge",
"=",
"$",
"this",
"->",
"makeBridge",
"(",
")",
";",... | Send API Request to Watson and get Response.
@return \GuzzleHttp\Psr7\Response | [
"Send",
"API",
"Request",
"to",
"Watson",
"and",
"get",
"Response",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/AbstractPersonalityInsights.php#L166-L184 |
188,962 | findbrok/laravel-personality-insights | src/AbstractPersonalityInsights.php | AbstractPersonalityInsights.appendHeaders | public function appendHeaders(array $headers = [])
{
// Append headers.
$this->headers = collect($this->headers)->merge($headers)->all();
// Return calling object.
return $this;
} | php | public function appendHeaders(array $headers = [])
{
// Append headers.
$this->headers = collect($this->headers)->merge($headers)->all();
// Return calling object.
return $this;
} | [
"public",
"function",
"appendHeaders",
"(",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"// Append headers.",
"$",
"this",
"->",
"headers",
"=",
"collect",
"(",
"$",
"this",
"->",
"headers",
")",
"->",
"merge",
"(",
"$",
"headers",
")",
"->",
"al... | Append Headers to request.
@param array $headers
@return self | [
"Append",
"Headers",
"to",
"request",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/AbstractPersonalityInsights.php#L214-L221 |
188,963 | findbrok/laravel-personality-insights | src/AbstractPersonalityInsights.php | AbstractPersonalityInsights.withQuery | public function withQuery(array $query = [])
{
// Set Query in class.
$this->query = collect($this->query)->merge($query)->all();
return $this;
} | php | public function withQuery(array $query = [])
{
// Set Query in class.
$this->query = collect($this->query)->merge($query)->all();
return $this;
} | [
"public",
"function",
"withQuery",
"(",
"array",
"$",
"query",
"=",
"[",
"]",
")",
"{",
"// Set Query in class.",
"$",
"this",
"->",
"query",
"=",
"collect",
"(",
"$",
"this",
"->",
"query",
")",
"->",
"merge",
"(",
"$",
"query",
")",
"->",
"all",
"(... | Add Query to the Request.
@param array $query
@return self | [
"Add",
"Query",
"to",
"the",
"Request",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/AbstractPersonalityInsights.php#L230-L236 |
188,964 | findbrok/laravel-personality-insights | src/AbstractPersonalityInsights.php | AbstractPersonalityInsights.addSingleContentItem | public function addSingleContentItem($items = [])
{
// Push ContentItem in ContentListContainer.
$this->contentListContainer->push($items instanceof ContentItem ? $items : personality_insights_content_item($items));
// Return object.
return $this;
} | php | public function addSingleContentItem($items = [])
{
// Push ContentItem in ContentListContainer.
$this->contentListContainer->push($items instanceof ContentItem ? $items : personality_insights_content_item($items));
// Return object.
return $this;
} | [
"public",
"function",
"addSingleContentItem",
"(",
"$",
"items",
"=",
"[",
"]",
")",
"{",
"// Push ContentItem in ContentListContainer.",
"$",
"this",
"->",
"contentListContainer",
"->",
"push",
"(",
"$",
"items",
"instanceof",
"ContentItem",
"?",
"$",
"items",
":... | Add a ContentItem to ContentListContainer.
@param array|ContentItem $items
@return self | [
"Add",
"a",
"ContentItem",
"to",
"ContentListContainer",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/AbstractPersonalityInsights.php#L266-L273 |
188,965 | findbrok/laravel-personality-insights | src/AbstractPersonalityInsights.php | AbstractPersonalityInsights.addContentItems | public function addContentItems($items = [])
{
// Loop on each item.
collect($items)->each(function ($item) {
// Add each content to the Container.
$this->addSingleContentItem($item);
});
// Return object.
return $this;
} | php | public function addContentItems($items = [])
{
// Loop on each item.
collect($items)->each(function ($item) {
// Add each content to the Container.
$this->addSingleContentItem($item);
});
// Return object.
return $this;
} | [
"public",
"function",
"addContentItems",
"(",
"$",
"items",
"=",
"[",
"]",
")",
"{",
"// Loop on each item.",
"collect",
"(",
"$",
"items",
")",
"->",
"each",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"// Add each content to the Container.",
"$",
"this",
... | Add ContentItems to the Container.
@param array $items
@return self | [
"Add",
"ContentItems",
"to",
"the",
"Container",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/AbstractPersonalityInsights.php#L282-L292 |
188,966 | findbrok/laravel-personality-insights | src/Models/BaseModel.php | BaseModel.traverseNodesAndFindBy | public function traverseNodesAndFindBy($propName, $propValue, Collection $nodes = null)
{
// Nodes are null so nothing to Traverse.
if (is_null($nodes)) {
return null;
}
foreach ($nodes as $node) {
if ($node->{$propName} == $propValue) {
retur... | php | public function traverseNodesAndFindBy($propName, $propValue, Collection $nodes = null)
{
// Nodes are null so nothing to Traverse.
if (is_null($nodes)) {
return null;
}
foreach ($nodes as $node) {
if ($node->{$propName} == $propValue) {
retur... | [
"public",
"function",
"traverseNodesAndFindBy",
"(",
"$",
"propName",
",",
"$",
"propValue",
",",
"Collection",
"$",
"nodes",
"=",
"null",
")",
"{",
"// Nodes are null so nothing to Traverse.",
"if",
"(",
"is_null",
"(",
"$",
"nodes",
")",
")",
"{",
"return",
... | Traverse Collection of Nodes and return specific Node if
criteria matches.
@param string $propName
@param string $propValue
@param Collection $nodes
@return TraitTreeNode|ConsumptionPreferencesCategoryNode|ConsumptionPreferencesNode|null | [
"Traverse",
"Collection",
"of",
"Nodes",
"and",
"return",
"specific",
"Node",
"if",
"criteria",
"matches",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Models/BaseModel.php#L43-L66 |
188,967 | findbrok/laravel-personality-insights | src/Support/DataCollector/ContentListContainer.php | ContentListContainer.getCacheKey | public function getCacheKey()
{
// Return Key.
return 'PersonalityInsights-'.Uuid::uuid5(Uuid::NAMESPACE_DNS,
collect(['contentItems' => $this->toArray()])->toJson())->toString();
} | php | public function getCacheKey()
{
// Return Key.
return 'PersonalityInsights-'.Uuid::uuid5(Uuid::NAMESPACE_DNS,
collect(['contentItems' => $this->toArray()])->toJson())->toString();
} | [
"public",
"function",
"getCacheKey",
"(",
")",
"{",
"// Return Key.",
"return",
"'PersonalityInsights-'",
".",
"Uuid",
"::",
"uuid5",
"(",
"Uuid",
"::",
"NAMESPACE_DNS",
",",
"collect",
"(",
"[",
"'contentItems'",
"=>",
"$",
"this",
"->",
"toArray",
"(",
")",
... | Unique cache key for this Container.
@return string | [
"Unique",
"cache",
"key",
"for",
"this",
"Container",
"."
] | 0ee783255588b8c0cf5eb3d38742e0875d86a5d8 | https://github.com/findbrok/laravel-personality-insights/blob/0ee783255588b8c0cf5eb3d38742e0875d86a5d8/src/Support/DataCollector/ContentListContainer.php#L60-L65 |
188,968 | yiithings/yii2-dotenv | src/Loader.php | Loader.load | public static function load($path = '', $file = '.env', $overload = false)
{
/*
* Find Composer base directory.
*/
if (empty($path)) {
if (class_exists('Yii', false)) {
/*
* Usually, the env is used before defining these aliases:
... | php | public static function load($path = '', $file = '.env', $overload = false)
{
/*
* Find Composer base directory.
*/
if (empty($path)) {
if (class_exists('Yii', false)) {
/*
* Usually, the env is used before defining these aliases:
... | [
"public",
"static",
"function",
"load",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"file",
"=",
"'.env'",
",",
"$",
"overload",
"=",
"false",
")",
"{",
"/*\n * Find Composer base directory.\n */",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
... | Load .env file from Yii2 project root directory.
@param string $path
@param string $file
@param bool $overload
@return bool | [
"Load",
".",
"env",
"file",
"from",
"Yii2",
"project",
"root",
"directory",
"."
] | 332ba060072927dd300454d1e3ac5fc13da7a558 | https://github.com/yiithings/yii2-dotenv/blob/332ba060072927dd300454d1e3ac5fc13da7a558/src/Loader.php#L19-L81 |
188,969 | madeyourday/contao-rocksolid-custom-elements | src/Template/CustomTemplate.php | CustomTemplate.getTemplate | public static function getTemplate($template, $format = 'html5')
{
$templates = static::getTemplates($template, $format = 'html5');
return isset($templates[0]) ? $templates[0] : null;
} | php | public static function getTemplate($template, $format = 'html5')
{
$templates = static::getTemplates($template, $format = 'html5');
return isset($templates[0]) ? $templates[0] : null;
} | [
"public",
"static",
"function",
"getTemplate",
"(",
"$",
"template",
",",
"$",
"format",
"=",
"'html5'",
")",
"{",
"$",
"templates",
"=",
"static",
"::",
"getTemplates",
"(",
"$",
"template",
",",
"$",
"format",
"=",
"'html5'",
")",
";",
"return",
"isset... | Get the template path
@param string $template Template name
@param string $format Format (xhtml or html5)
@return string Template path | [
"Get",
"the",
"template",
"path"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/Template/CustomTemplate.php#L37-L42 |
188,970 | madeyourday/contao-rocksolid-custom-elements | src/Template/CustomTemplate.php | CustomTemplate.getTemplates | public static function getTemplates($template, $format = 'html5')
{
$templates = array();
try {
$theme = \ThemeModel::findAll(array('order'=>'name'));
}
catch (\Exception $e) {
$theme = null;
}
while ($theme && $theme->next()) {
if ($theme->templates != '') {
if (file_exists(TL_ROOT . '/' . ... | php | public static function getTemplates($template, $format = 'html5')
{
$templates = array();
try {
$theme = \ThemeModel::findAll(array('order'=>'name'));
}
catch (\Exception $e) {
$theme = null;
}
while ($theme && $theme->next()) {
if ($theme->templates != '') {
if (file_exists(TL_ROOT . '/' . ... | [
"public",
"static",
"function",
"getTemplates",
"(",
"$",
"template",
",",
"$",
"format",
"=",
"'html5'",
")",
"{",
"$",
"templates",
"=",
"array",
"(",
")",
";",
"try",
"{",
"$",
"theme",
"=",
"\\",
"ThemeModel",
"::",
"findAll",
"(",
"array",
"(",
... | Get all found template paths
@param string $template Template name
@param string $format Format (xhtml or html5)
@return array All template paths for the specified template | [
"Get",
"all",
"found",
"template",
"paths"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/Template/CustomTemplate.php#L51-L87 |
188,971 | madeyourday/contao-rocksolid-custom-elements | src/Element/CustomElement.php | CustomElement.generate | public function generate()
{
$this->strTemplate = $this->customTpl ?: $this->type;
// Return output for the backend if in BE mode
if (($output = $this->rsceGetBackendOutput()) !== null) {
return $output;
}
try {
return parent::generate();
}
catch (\Exception $exception) {
if (TL_MODE === 'BE'... | php | public function generate()
{
$this->strTemplate = $this->customTpl ?: $this->type;
// Return output for the backend if in BE mode
if (($output = $this->rsceGetBackendOutput()) !== null) {
return $output;
}
try {
return parent::generate();
}
catch (\Exception $exception) {
if (TL_MODE === 'BE'... | [
"public",
"function",
"generate",
"(",
")",
"{",
"$",
"this",
"->",
"strTemplate",
"=",
"$",
"this",
"->",
"customTpl",
"?",
":",
"$",
"this",
"->",
"type",
";",
"// Return output for the backend if in BE mode",
"if",
"(",
"(",
"$",
"output",
"=",
"$",
"th... | Find the correct template and parse it
@return string Parsed template | [
"Find",
"the",
"correct",
"template",
"and",
"parse",
"it"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/Element/CustomElement.php#L33-L59 |
188,972 | madeyourday/contao-rocksolid-custom-elements | src/Element/CustomElement.php | CustomElement.rsceGetBackendOutput | public function rsceGetBackendOutput()
{
if (TL_MODE !== 'BE') {
return null;
}
$config = CustomElements::getConfigByType($this->type) ?: array();
// Handle newsletter output the same way as the frontend
if (!empty($config['isNewsletter'])) {
if (\Input::get('do') === 'newsletter') {
return null... | php | public function rsceGetBackendOutput()
{
if (TL_MODE !== 'BE') {
return null;
}
$config = CustomElements::getConfigByType($this->type) ?: array();
// Handle newsletter output the same way as the frontend
if (!empty($config['isNewsletter'])) {
if (\Input::get('do') === 'newsletter') {
return null... | [
"public",
"function",
"rsceGetBackendOutput",
"(",
")",
"{",
"if",
"(",
"TL_MODE",
"!==",
"'BE'",
")",
"{",
"return",
"null",
";",
"}",
"$",
"config",
"=",
"CustomElements",
"::",
"getConfigByType",
"(",
"$",
"this",
"->",
"type",
")",
"?",
":",
"array",... | Generate backend output if TL_MODE is set to BE
@return string|null Backend output or null | [
"Generate",
"backend",
"output",
"if",
"TL_MODE",
"is",
"set",
"to",
"BE"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/Element/CustomElement.php#L66-L109 |
188,973 | madeyourday/contao-rocksolid-custom-elements | src/Element/CustomElement.php | CustomElement.compile | public function compile()
{
// Add an image
if ($this->addImage && trim($this->singleSRC)) {
$fileModel = \FilesModel::findByUuid($this->singleSRC);
if ($fileModel !== null && is_file(TL_ROOT . '/' . $fileModel->path)) {
$this->singleSRC = $fileModel->path;
$this->addImageToTemplate($this->Template, ... | php | public function compile()
{
// Add an image
if ($this->addImage && trim($this->singleSRC)) {
$fileModel = \FilesModel::findByUuid($this->singleSRC);
if ($fileModel !== null && is_file(TL_ROOT . '/' . $fileModel->path)) {
$this->singleSRC = $fileModel->path;
$this->addImageToTemplate($this->Template, ... | [
"public",
"function",
"compile",
"(",
")",
"{",
"// Add an image",
"if",
"(",
"$",
"this",
"->",
"addImage",
"&&",
"trim",
"(",
"$",
"this",
"->",
"singleSRC",
")",
")",
"{",
"$",
"fileModel",
"=",
"\\",
"FilesModel",
"::",
"findByUuid",
"(",
"$",
"thi... | Parse the json data and pass it to the template
@return void | [
"Parse",
"the",
"json",
"data",
"and",
"pass",
"it",
"to",
"the",
"template"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/Element/CustomElement.php#L116-L146 |
188,974 | madeyourday/contao-rocksolid-custom-elements | src/Element/CustomElement.php | CustomElement.deserializeDataRecursive | protected function deserializeDataRecursive($data)
{
foreach ($data as $key => $value) {
if (is_string($value) && trim($value)) {
if (is_object($data)) {
$data->$key = \StringUtil::deserialize($value);
}
else {
$data[$key] = \StringUtil::deserialize($value);
}
}
else if (is_array($... | php | protected function deserializeDataRecursive($data)
{
foreach ($data as $key => $value) {
if (is_string($value) && trim($value)) {
if (is_object($data)) {
$data->$key = \StringUtil::deserialize($value);
}
else {
$data[$key] = \StringUtil::deserialize($value);
}
}
else if (is_array($... | [
"protected",
"function",
"deserializeDataRecursive",
"(",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"trim",
"(",
"$",
"value",
")",
")",
... | Deserialize all data recursively
@param array|object $data data array or object
@return array|object data passed in with deserialized values | [
"Deserialize",
"all",
"data",
"recursively"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/Element/CustomElement.php#L154-L176 |
188,975 | madeyourday/contao-rocksolid-custom-elements | src/Element/CustomElement.php | CustomElement.getColumnClassName | public function getColumnClassName($index)
{
if (!class_exists(ColumnsStart::class)) {
return '';
}
$config = ColumnsStart::getColumnsConfiguration($this->arrData);
$classes = array('rs-column');
foreach ($config as $name => $media) {
$classes = array_merge($classes, $media[$index % count($media)]);
... | php | public function getColumnClassName($index)
{
if (!class_exists(ColumnsStart::class)) {
return '';
}
$config = ColumnsStart::getColumnsConfiguration($this->arrData);
$classes = array('rs-column');
foreach ($config as $name => $media) {
$classes = array_merge($classes, $media[$index % count($media)]);
... | [
"public",
"function",
"getColumnClassName",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"ColumnsStart",
"::",
"class",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"config",
"=",
"ColumnsStart",
"::",
"getColumnsConfiguration",
"(",
... | Get the column class name for the specified index
@param int $index Index of the column
@return string Class name(s) | [
"Get",
"the",
"column",
"class",
"name",
"for",
"the",
"specified",
"index"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/Element/CustomElement.php#L259-L276 |
188,976 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.onloadCallback | public function onloadCallback($dc)
{
if (\Input::get('act') === 'create') {
return;
}
if (\Input::get('act') === 'edit') {
$this->reloadConfig();
}
if ($dc->table === 'tl_content' && class_exists('CeAccess')) {
$ceAccess = new \CeAccess;
$ceAccess->filterContentElements($dc);
}
if (\Input... | php | public function onloadCallback($dc)
{
if (\Input::get('act') === 'create') {
return;
}
if (\Input::get('act') === 'edit') {
$this->reloadConfig();
}
if ($dc->table === 'tl_content' && class_exists('CeAccess')) {
$ceAccess = new \CeAccess;
$ceAccess->filterContentElements($dc);
}
if (\Input... | [
"public",
"function",
"onloadCallback",
"(",
"$",
"dc",
")",
"{",
"if",
"(",
"\\",
"Input",
"::",
"get",
"(",
"'act'",
")",
"===",
"'create'",
")",
"{",
"return",
";",
"}",
"if",
"(",
"\\",
"Input",
"::",
"get",
"(",
"'act'",
")",
"===",
"'edit'",
... | tl_content, tl_module and tl_form_field DCA onload callback
Reloads config and creates the DCA fields
@param \DataContainer $dc Data container
@return void | [
"tl_content",
"tl_module",
"and",
"tl_form_field",
"DCA",
"onload",
"callback"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L48-L99 |
188,977 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.onsubmitCallback | public function onsubmitCallback($dc)
{
$type = $this->getDcaFieldValue($dc, 'type');
if (!$type || substr($type, 0, 5) !== 'rsce_') {
return;
}
$data = $this->getDcaFieldValue($dc, 'rsce_data', true);
// Check if it is a new element with no data
if ($data === null && !count($this->saveData)) {
//... | php | public function onsubmitCallback($dc)
{
$type = $this->getDcaFieldValue($dc, 'type');
if (!$type || substr($type, 0, 5) !== 'rsce_') {
return;
}
$data = $this->getDcaFieldValue($dc, 'rsce_data', true);
// Check if it is a new element with no data
if ($data === null && !count($this->saveData)) {
//... | [
"public",
"function",
"onsubmitCallback",
"(",
"$",
"dc",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"getDcaFieldValue",
"(",
"$",
"dc",
",",
"'type'",
")",
";",
"if",
"(",
"!",
"$",
"type",
"||",
"substr",
"(",
"$",
"type",
",",
"0",
",",
"5... | tl_content, tl_module and tl_form_field DCA onsubmit callback
Creates empty arrays for empty lists if no data is available
(e.g. for new elements)
@param \DataContainer $dc Data container
@return void | [
"tl_content",
"tl_module",
"and",
"tl_form_field",
"DCA",
"onsubmit",
"callback"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L110-L132 |
188,978 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.loadCallback | public function loadCallback($value, $dc)
{
if ($value !== null) {
return $value;
}
$value = $this->getNestedValue($dc->field);
if ($value === null && isset($GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['default'])) {
$value = $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['default'];
}
... | php | public function loadCallback($value, $dc)
{
if ($value !== null) {
return $value;
}
$value = $this->getNestedValue($dc->field);
if ($value === null && isset($GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['default'])) {
$value = $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['default'];
}
... | [
"public",
"function",
"loadCallback",
"(",
"$",
"value",
",",
"$",
"dc",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"return",
"$",
"value",
";",
"}",
"$",
"value",
"=",
"$",
"this",
"->",
"getNestedValue",
"(",
"$",
"dc",
"->",
"... | Field load callback
Finds the current value for the field
@param string $value Current value
@param \DataContainer $dc Data container
@return string Current value for the field | [
"Field",
"load",
"callback"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L143-L163 |
188,979 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.loadCallbackMultiEdit | public function loadCallbackMultiEdit($value, $dc)
{
if ($value !== null) {
return $value;
}
$field = substr($dc->field, strlen($dc->activeRecord->type . '_field_'));
$data = \Database::getInstance()
->prepare("SELECT rsce_data FROM {$dc->table} WHERE id=?")
->execute($dc->id)
->rsce_data;
$dat... | php | public function loadCallbackMultiEdit($value, $dc)
{
if ($value !== null) {
return $value;
}
$field = substr($dc->field, strlen($dc->activeRecord->type . '_field_'));
$data = \Database::getInstance()
->prepare("SELECT rsce_data FROM {$dc->table} WHERE id=?")
->execute($dc->id)
->rsce_data;
$dat... | [
"public",
"function",
"loadCallbackMultiEdit",
"(",
"$",
"value",
",",
"$",
"dc",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"return",
"$",
"value",
";",
"}",
"$",
"field",
"=",
"substr",
"(",
"$",
"dc",
"->",
"field",
",",
"strlen... | Field load callback multi edit
Finds the current value for the field directly from the database
@param string $value Current value
@param \DataContainer $dc Data container
@return string Current value for the field | [
"Field",
"load",
"callback",
"multi",
"edit"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L174-L204 |
188,980 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.getNestedConfig | protected function getNestedConfig($field, $config)
{
$field = preg_split('(__([0-9]+)__)', substr($field, 11), -1, PREG_SPLIT_DELIM_CAPTURE);
if (!isset($config[$field[0]])) {
return null;
}
$fieldConfig =& $config[$field[0]];
for ($i = 0; isset($field[$i]); $i += 2) {
if (isset($field[$i + 1])) {... | php | protected function getNestedConfig($field, $config)
{
$field = preg_split('(__([0-9]+)__)', substr($field, 11), -1, PREG_SPLIT_DELIM_CAPTURE);
if (!isset($config[$field[0]])) {
return null;
}
$fieldConfig =& $config[$field[0]];
for ($i = 0; isset($field[$i]); $i += 2) {
if (isset($field[$i + 1])) {... | [
"protected",
"function",
"getNestedConfig",
"(",
"$",
"field",
",",
"$",
"config",
")",
"{",
"$",
"field",
"=",
"preg_split",
"(",
"'(__([0-9]+)__)'",
",",
"substr",
"(",
"$",
"field",
",",
"11",
")",
",",
"-",
"1",
",",
"PREG_SPLIT_DELIM_CAPTURE",
")",
... | Get the config from field name
@param string $field Field name
@return mixed Configuration of the field | [
"Get",
"the",
"config",
"from",
"field",
"name"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L280-L306 |
188,981 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.saveCallback | public function saveCallback($value, $dc)
{
if (strpos($dc->field, '__rsce_dummy__') !== false) {
return;
}
if (
$GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fileTree'
|| $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fineUploader'
) {
$value = $th... | php | public function saveCallback($value, $dc)
{
if (strpos($dc->field, '__rsce_dummy__') !== false) {
return;
}
if (
$GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fileTree'
|| $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fineUploader'
) {
$value = $th... | [
"public",
"function",
"saveCallback",
"(",
"$",
"value",
",",
"$",
"dc",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"dc",
"->",
"field",
",",
"'__rsce_dummy__'",
")",
"!==",
"false",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"GLOBALS",
"[",
"'TL_... | Field save callback
Saves the field data to $this->saveData
@param string $value Field value
@param \DataContainer $dc Data container
@return void | [
"Field",
"save",
"callback"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L317-L353 |
188,982 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.saveCallbackMultiEdit | public function saveCallbackMultiEdit($value, $dc)
{
if (
$GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fileTree'
|| $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fineUploader'
) {
$value = $this->uuidBinToText($value);
}
$field = substr($dc->field, s... | php | public function saveCallbackMultiEdit($value, $dc)
{
if (
$GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fileTree'
|| $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fineUploader'
) {
$value = $this->uuidBinToText($value);
}
$field = substr($dc->field, s... | [
"public",
"function",
"saveCallbackMultiEdit",
"(",
"$",
"value",
",",
"$",
"dc",
")",
"{",
"if",
"(",
"$",
"GLOBALS",
"[",
"'TL_DCA'",
"]",
"[",
"$",
"dc",
"->",
"table",
"]",
"[",
"'fields'",
"]",
"[",
"$",
"dc",
"->",
"field",
"]",
"[",
"'inputT... | Field save callback multi edit
Saves the field data directly into the database field rsce_data
@param string $value Field value
@param \DataContainer $dc Data container
@return void | [
"Field",
"save",
"callback",
"multi",
"edit"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L364-L388 |
188,983 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.saveDataCallback | public function saveDataCallback($value, $dc)
{
$this->prepareSaveData('rsce_field_', $this->fieldsConfig);
$data = json_encode($this->saveData);
if ($data === '[]') {
$data = '{}';
}
return $data;
} | php | public function saveDataCallback($value, $dc)
{
$this->prepareSaveData('rsce_field_', $this->fieldsConfig);
$data = json_encode($this->saveData);
if ($data === '[]') {
$data = '{}';
}
return $data;
} | [
"public",
"function",
"saveDataCallback",
"(",
"$",
"value",
",",
"$",
"dc",
")",
"{",
"$",
"this",
"->",
"prepareSaveData",
"(",
"'rsce_field_'",
",",
"$",
"this",
"->",
"fieldsConfig",
")",
";",
"$",
"data",
"=",
"json_encode",
"(",
"$",
"this",
"->",
... | rsce_data field save callback
Returns the JSON encoded $this->saveData
@param string $value Current field value
@param \DataContainer $dc Data container
@return string JSON encoded $this->saveData | [
"rsce_data",
"field",
"save",
"callback"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L399-L410 |
188,984 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.prepareSaveData | protected function prepareSaveData($fieldPrefix, $fieldsConfig)
{
foreach ($fieldsConfig as $fieldName => $fieldConfig) {
if (isset($fieldConfig['inputType']) && $fieldConfig['inputType'] === 'list') {
// creates an empty array for a empty lists
$fieldData = $this->getNestedValueReference($fieldPrefix .... | php | protected function prepareSaveData($fieldPrefix, $fieldsConfig)
{
foreach ($fieldsConfig as $fieldName => $fieldConfig) {
if (isset($fieldConfig['inputType']) && $fieldConfig['inputType'] === 'list') {
// creates an empty array for a empty lists
$fieldData = $this->getNestedValueReference($fieldPrefix .... | [
"protected",
"function",
"prepareSaveData",
"(",
"$",
"fieldPrefix",
",",
"$",
"fieldsConfig",
")",
"{",
"foreach",
"(",
"$",
"fieldsConfig",
"as",
"$",
"fieldName",
"=>",
"$",
"fieldConfig",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"fieldConfig",
"[",
"'in... | prepare the data to save and create empty arrays for empty lists
@param string $fieldPrefix field prefix
@param array $fieldsConfig fields configuration
@return void | [
"prepare",
"the",
"data",
"to",
"save",
"and",
"create",
"empty",
"arrays",
"for",
"empty",
"lists"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L419-L435 |
188,985 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.createDca | protected function createDca($dc, $type, $createFromPost = false, $tmpField = null)
{
$config = static::getConfigByType($type);
if (!$config) {
return;
}
$assetsDir = 'bundles/rocksolidcustomelements';
if (TL_MODE === 'BE') {
$GLOBALS['TL_JAVASCRIPT'][] = $assetsDir . '/js/be_main.js';
$GLOBALS['... | php | protected function createDca($dc, $type, $createFromPost = false, $tmpField = null)
{
$config = static::getConfigByType($type);
if (!$config) {
return;
}
$assetsDir = 'bundles/rocksolidcustomelements';
if (TL_MODE === 'BE') {
$GLOBALS['TL_JAVASCRIPT'][] = $assetsDir . '/js/be_main.js';
$GLOBALS['... | [
"protected",
"function",
"createDca",
"(",
"$",
"dc",
",",
"$",
"type",
",",
"$",
"createFromPost",
"=",
"false",
",",
"$",
"tmpField",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"static",
"::",
"getConfigByType",
"(",
"$",
"type",
")",
";",
"if",
"(... | Create all DCA fields for the specified type
@param \DataContainer $dc Data container
@param string $type The template name
@param boolean $createFromPost Whether to create the field structure from post data or not
@param string $tmpField Field name to create temp... | [
"Create",
"all",
"DCA",
"fields",
"for",
"the",
"specified",
"type"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L446-L505 |
188,986 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.wasListFieldSubmitted | protected function wasListFieldSubmitted($fieldName, $dataKey)
{
if (!is_array(\Input::post('FORM_FIELDS'))) {
return false;
}
if (strpos($fieldName, '__rsce_dummy__') !== false) {
return false;
}
$formFields = array_unique(\StringUtil::trimsplit(
'[,;]',
implode(',', \Input::post('FORM_FIELDS'... | php | protected function wasListFieldSubmitted($fieldName, $dataKey)
{
if (!is_array(\Input::post('FORM_FIELDS'))) {
return false;
}
if (strpos($fieldName, '__rsce_dummy__') !== false) {
return false;
}
$formFields = array_unique(\StringUtil::trimsplit(
'[,;]',
implode(',', \Input::post('FORM_FIELDS'... | [
"protected",
"function",
"wasListFieldSubmitted",
"(",
"$",
"fieldName",
",",
"$",
"dataKey",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"\\",
"Input",
"::",
"post",
"(",
"'FORM_FIELDS'",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"str... | Check if a field was sumitted via POST
@param string $fieldName field name to check
@param int $dataKey data index
@return boolean true if the field was sumitted via POST | [
"Check",
"if",
"a",
"field",
"was",
"sumitted",
"via",
"POST"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L750-L774 |
188,987 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.createDcaItemListDummy | protected function createDcaItemListDummy($fieldPrefix, $fieldName, $fieldConfig, &$paletteFields, $dc, $createFromPost)
{
$dataKey = 'rsce_dummy';
$GLOBALS['TL_DCA'][$dc->table]['fields'][$fieldPrefix . $fieldName . '__' . $dataKey . '_rsce_list_item_start'] = array(
'inputType' => 'rsce_list_item_start',
... | php | protected function createDcaItemListDummy($fieldPrefix, $fieldName, $fieldConfig, &$paletteFields, $dc, $createFromPost)
{
$dataKey = 'rsce_dummy';
$GLOBALS['TL_DCA'][$dc->table]['fields'][$fieldPrefix . $fieldName . '__' . $dataKey . '_rsce_list_item_start'] = array(
'inputType' => 'rsce_list_item_start',
... | [
"protected",
"function",
"createDcaItemListDummy",
"(",
"$",
"fieldPrefix",
",",
"$",
"fieldName",
",",
"$",
"fieldConfig",
",",
"&",
"$",
"paletteFields",
",",
"$",
"dc",
",",
"$",
"createFromPost",
")",
"{",
"$",
"dataKey",
"=",
"'rsce_dummy'",
";",
"$",
... | Create one list item dummy with the specified parameters
@param string $fieldPrefix Field prefix, e.g. "rsce_field_"
@param string $fieldName Field name
@param array $fieldConfig Field configuration array
@param array $paletteFields Reference to the list of all fields
... | [
"Create",
"one",
"list",
"item",
"dummy",
"with",
"the",
"specified",
"parameters"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L787-L809 |
188,988 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.createDcaMultiEdit | protected function createDcaMultiEdit($dc)
{
$session = \System::getContainer()->get('session')->all();
if (empty($session['CURRENT']['IDS']) || !is_array($session['CURRENT']['IDS'])) {
return;
}
$ids = $session['CURRENT']['IDS'];
$types = \Database::getInstance()
->prepare('
SELECT type
FROM ... | php | protected function createDcaMultiEdit($dc)
{
$session = \System::getContainer()->get('session')->all();
if (empty($session['CURRENT']['IDS']) || !is_array($session['CURRENT']['IDS'])) {
return;
}
$ids = $session['CURRENT']['IDS'];
$types = \Database::getInstance()
->prepare('
SELECT type
FROM ... | [
"protected",
"function",
"createDcaMultiEdit",
"(",
"$",
"dc",
")",
"{",
"$",
"session",
"=",
"\\",
"System",
"::",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'session'",
")",
"->",
"all",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"session",
"["... | Create all DCA standard fields for multi edit mode
@param \DataContainer $dc Data container
@return void | [
"Create",
"all",
"DCA",
"standard",
"fields",
"for",
"multi",
"edit",
"mode"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L817-L864 |
188,989 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.getConfigByType | public static function getConfigByType($type)
{
$configPath = null;
try {
$templatePaths = CustomTemplate::getTemplates($type);
if (!empty($templatePaths[0])) {
$configPath = substr($templatePaths[0], 0, -6) . '_config.php';
}
}
catch (\Exception $e) {
$configPath = null;
}
if ($configPat... | php | public static function getConfigByType($type)
{
$configPath = null;
try {
$templatePaths = CustomTemplate::getTemplates($type);
if (!empty($templatePaths[0])) {
$configPath = substr($templatePaths[0], 0, -6) . '_config.php';
}
}
catch (\Exception $e) {
$configPath = null;
}
if ($configPat... | [
"public",
"static",
"function",
"getConfigByType",
"(",
"$",
"type",
")",
"{",
"$",
"configPath",
"=",
"null",
";",
"try",
"{",
"$",
"templatePaths",
"=",
"CustomTemplate",
"::",
"getTemplates",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"empty",
"(",
... | Get configuration array for the specified type
@param string $type Element type beginning with "rsce_"
@return array|null Configuration array | [
"Get",
"configuration",
"array",
"for",
"the",
"specified",
"type"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L872-L906 |
188,990 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.generatePalette | protected static function generatePalette($table, array $paletteFields = array(), array $standardFields = array())
{
$palette = '';
if ($table === 'tl_module') {
$palette .= '{title_legend},name';
if (in_array('headline', $standardFields)) {
$palette .= ',headline';
}
$palette .= ',type';
}
el... | php | protected static function generatePalette($table, array $paletteFields = array(), array $standardFields = array())
{
$palette = '';
if ($table === 'tl_module') {
$palette .= '{title_legend},name';
if (in_array('headline', $standardFields)) {
$palette .= ',headline';
}
$palette .= ',type';
}
el... | [
"protected",
"static",
"function",
"generatePalette",
"(",
"$",
"table",
",",
"array",
"$",
"paletteFields",
"=",
"array",
"(",
")",
",",
"array",
"$",
"standardFields",
"=",
"array",
"(",
")",
")",
"{",
"$",
"palette",
"=",
"''",
";",
"if",
"(",
"$",
... | Generates the palette definition
@param string $table "tl_content", "tl_module" or "tl_form_field"
@param array $paletteFields Palette fields
@param array $standardFields Standard fields
@return string Palette definition | [
"Generates",
"the",
"palette",
"definition"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L916-L977 |
188,991 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.purgeCache | public static function purgeCache()
{
$filePaths = static::getCacheFilePaths();
if (file_exists($filePaths['fullPath'])) {
$file = new \File($filePaths['path'], true);
$file->write('');
$file->close();
static::refreshOpcodeCache($filePaths['fullPath']);
}
} | php | public static function purgeCache()
{
$filePaths = static::getCacheFilePaths();
if (file_exists($filePaths['fullPath'])) {
$file = new \File($filePaths['path'], true);
$file->write('');
$file->close();
static::refreshOpcodeCache($filePaths['fullPath']);
}
} | [
"public",
"static",
"function",
"purgeCache",
"(",
")",
"{",
"$",
"filePaths",
"=",
"static",
"::",
"getCacheFilePaths",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"filePaths",
"[",
"'fullPath'",
"]",
")",
")",
"{",
"$",
"file",
"=",
"new",
"\\... | Purge cache file rocksolid_custom_elements_config.php
@return void | [
"Purge",
"cache",
"file",
"rocksolid_custom_elements_config",
".",
"php"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L1030-L1040 |
188,992 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.getCacheFilePaths | public static function getCacheFilePaths()
{
$cacheDir = \System::getContainer()->getParameter('kernel.cache_dir') . '/contao';
$fileFullPath = $cacheDir . '/rocksolid_custom_elements_config.php';
$filePath = $fileFullPath;
if (
substr($filePath, 0, strlen(TL_ROOT) + 1) === TL_ROOT . '/'
|| substr($file... | php | public static function getCacheFilePaths()
{
$cacheDir = \System::getContainer()->getParameter('kernel.cache_dir') . '/contao';
$fileFullPath = $cacheDir . '/rocksolid_custom_elements_config.php';
$filePath = $fileFullPath;
if (
substr($filePath, 0, strlen(TL_ROOT) + 1) === TL_ROOT . '/'
|| substr($file... | [
"public",
"static",
"function",
"getCacheFilePaths",
"(",
")",
"{",
"$",
"cacheDir",
"=",
"\\",
"System",
"::",
"getContainer",
"(",
")",
"->",
"getParameter",
"(",
"'kernel.cache_dir'",
")",
".",
"'/contao'",
";",
"$",
"fileFullPath",
"=",
"$",
"cacheDir",
... | Get path and fullPath to the cache file
@return string | [
"Get",
"path",
"and",
"fullPath",
"to",
"the",
"cache",
"file"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L1047-L1064 |
188,993 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.refreshOpcodeCache | protected static function refreshOpcodeCache($path)
{
try {
// Zend OPcache
if (function_exists('opcache_invalidate')) {
opcache_invalidate($path, true);
}
// Zend Optimizer+
if (function_exists('accelerator_reset')) {
accelerator_reset();
}
// APC
if (function_exists('apc_compile_... | php | protected static function refreshOpcodeCache($path)
{
try {
// Zend OPcache
if (function_exists('opcache_invalidate')) {
opcache_invalidate($path, true);
}
// Zend Optimizer+
if (function_exists('accelerator_reset')) {
accelerator_reset();
}
// APC
if (function_exists('apc_compile_... | [
"protected",
"static",
"function",
"refreshOpcodeCache",
"(",
"$",
"path",
")",
"{",
"try",
"{",
"// Zend OPcache",
"if",
"(",
"function_exists",
"(",
"'opcache_invalidate'",
")",
")",
"{",
"opcache_invalidate",
"(",
"$",
"path",
",",
"true",
")",
";",
"}",
... | Refreshes all active opcode caches for the specified file
@param string $path Path to the file
@return boolean True on success, false on failure | [
"Refreshes",
"all",
"active",
"opcode",
"caches",
"for",
"the",
"specified",
"file"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L1323-L1367 |
188,994 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.getLabelTranslated | public static function getLabelTranslated($labelConfig)
{
if (!is_array($labelConfig)) {
return $labelConfig;
}
// Return if it isn't an associative array
if (!count(array_filter(array_keys($labelConfig), 'is_string'))) {
return $labelConfig;
}
$language = str_replace('-', '_', $GLOBALS['TL_LANGUAG... | php | public static function getLabelTranslated($labelConfig)
{
if (!is_array($labelConfig)) {
return $labelConfig;
}
// Return if it isn't an associative array
if (!count(array_filter(array_keys($labelConfig), 'is_string'))) {
return $labelConfig;
}
$language = str_replace('-', '_', $GLOBALS['TL_LANGUAG... | [
"public",
"static",
"function",
"getLabelTranslated",
"(",
"$",
"labelConfig",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"labelConfig",
")",
")",
"{",
"return",
"$",
"labelConfig",
";",
"}",
"// Return if it isn't an associative array",
"if",
"(",
"!",
"... | Return translated label if label configuration contains language keys
@param array $labelConfig
@return mixed Translated label if exists, otherwise $labelConfig | [
"Return",
"translated",
"label",
"if",
"label",
"configuration",
"contains",
"language",
"keys"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L1389-L1425 |
188,995 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.exportThemeHook | public function exportThemeHook($xml, $zipArchive, $themeId)
{
$xpath = new \DOMXPath($xml);
$tlModule = $xpath->query('/tables/table[@name = \'tl_module\']')->item(0);
if (!$tlModule) {
return;
}
static::reloadConfig();
foreach ($tlModule->childNodes as $row) {
if (strtolower($row->nodeName) !==... | php | public function exportThemeHook($xml, $zipArchive, $themeId)
{
$xpath = new \DOMXPath($xml);
$tlModule = $xpath->query('/tables/table[@name = \'tl_module\']')->item(0);
if (!$tlModule) {
return;
}
static::reloadConfig();
foreach ($tlModule->childNodes as $row) {
if (strtolower($row->nodeName) !==... | [
"public",
"function",
"exportThemeHook",
"(",
"$",
"xml",
",",
"$",
"zipArchive",
",",
"$",
"themeId",
")",
"{",
"$",
"xpath",
"=",
"new",
"\\",
"DOMXPath",
"(",
"$",
"xml",
")",
";",
"$",
"tlModule",
"=",
"$",
"xpath",
"->",
"query",
"(",
"'/tables/... | Convert IDs for theme export
@param \DOMDocument $xml theme.xml
@param \ZipWriter $zipArchive CTO file
@param int $themeId
@return void | [
"Convert",
"IDs",
"for",
"theme",
"export"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L1435-L1481 |
188,996 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.extractThemeFilesHook | public function extractThemeFilesHook($xml, $zipArchive, $themeId, $idMappingData)
{
$modules = \ModuleModel::findBy(
array('tl_module.pid = ? AND tl_module.type LIKE \'rsce_%\''),
$themeId
);
if (!$modules || !count($modules)) {
return;
}
foreach ($modules as $module) {
if (substr($module->ty... | php | public function extractThemeFilesHook($xml, $zipArchive, $themeId, $idMappingData)
{
$modules = \ModuleModel::findBy(
array('tl_module.pid = ? AND tl_module.type LIKE \'rsce_%\''),
$themeId
);
if (!$modules || !count($modules)) {
return;
}
foreach ($modules as $module) {
if (substr($module->ty... | [
"public",
"function",
"extractThemeFilesHook",
"(",
"$",
"xml",
",",
"$",
"zipArchive",
",",
"$",
"themeId",
",",
"$",
"idMappingData",
")",
"{",
"$",
"modules",
"=",
"\\",
"ModuleModel",
"::",
"findBy",
"(",
"array",
"(",
"'tl_module.pid = ? AND tl_module.type ... | Convert IDs for theme import
@param \DOMDocument $xml theme.xml
@param \ZipWriter $zipArchive CTO file
@param int $themeId
@param array $idMappingData ID mapping for imported database rows
@return void | [
"Convert",
"IDs",
"for",
"theme",
"import"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L1492-L1531 |
188,997 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.uuidBinToText | private function uuidBinToText($value)
{
if (trim($value) && $value !== 'a:1:{i:0;s:0:"";}') {
if (strlen($value) === 16) {
return \StringUtil::binToUuid($value);
}
return serialize(array_map('StringUtil::binToUuid', \StringUtil::deserialize($value)));
}
return '';
} | php | private function uuidBinToText($value)
{
if (trim($value) && $value !== 'a:1:{i:0;s:0:"";}') {
if (strlen($value) === 16) {
return \StringUtil::binToUuid($value);
}
return serialize(array_map('StringUtil::binToUuid', \StringUtil::deserialize($value)));
}
return '';
} | [
"private",
"function",
"uuidBinToText",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"trim",
"(",
"$",
"value",
")",
"&&",
"$",
"value",
"!==",
"'a:1:{i:0;s:0:\"\";}'",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"value",
")",
"===",
"16",
")",
"{",
"return"... | Convert binary UUIDs to text
@param string $value
@return string | [
"Convert",
"binary",
"UUIDs",
"to",
"text"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L1666-L1675 |
188,998 | madeyourday/contao-rocksolid-custom-elements | src/CustomElements.php | CustomElements.uuidTextToBin | private function uuidTextToBin($value)
{
// Multiple files
if (substr($value, 0, 2) === 'a:') {
return serialize(array_map(function($value) {
if (strlen($value) === 36) {
$value = \StringUtil::uuidToBin($value);
}
return $value;
}, \StringUtil::deserialize($value)));
}
// Single file
i... | php | private function uuidTextToBin($value)
{
// Multiple files
if (substr($value, 0, 2) === 'a:') {
return serialize(array_map(function($value) {
if (strlen($value) === 36) {
$value = \StringUtil::uuidToBin($value);
}
return $value;
}, \StringUtil::deserialize($value)));
}
// Single file
i... | [
"private",
"function",
"uuidTextToBin",
"(",
"$",
"value",
")",
"{",
"// Multiple files",
"if",
"(",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"2",
")",
"===",
"'a:'",
")",
"{",
"return",
"serialize",
"(",
"array_map",
"(",
"function",
"(",
"$",
"val... | Convert text UUIDs to binary
@param string $value
@return string | [
"Convert",
"text",
"UUIDs",
"to",
"binary"
] | 2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5 | https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/2ffd50ecb4d3f900f75552f2554a66b0a5c14ad5/src/CustomElements.php#L1684-L1701 |
188,999 | delatbabel/elocryptfive | src/Elocrypt.php | Elocrypt.shouldEncrypt | protected function shouldEncrypt($key)
{
$encrypt = isset($this->encrypts) ? $this->encrypts : $this->encryptable;
return in_array($key, $encrypt);
} | php | protected function shouldEncrypt($key)
{
$encrypt = isset($this->encrypts) ? $this->encrypts : $this->encryptable;
return in_array($key, $encrypt);
} | [
"protected",
"function",
"shouldEncrypt",
"(",
"$",
"key",
")",
"{",
"$",
"encrypt",
"=",
"isset",
"(",
"$",
"this",
"->",
"encrypts",
")",
"?",
"$",
"this",
"->",
"encrypts",
":",
"$",
"this",
"->",
"encryptable",
";",
"return",
"in_array",
"(",
"$",
... | Determine whether an attribute should be encrypted.
@param string $key
@return bool | [
"Determine",
"whether",
"an",
"attribute",
"should",
"be",
"encrypted",
"."
] | 5ff5b7a7f38a881596f60f064a9883ecc3942c37 | https://github.com/delatbabel/elocryptfive/blob/5ff5b7a7f38a881596f60f064a9883ecc3942c37/src/Elocrypt.php#L85-L90 |
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.