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 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
rips/php-connector-bundle | Services/TeamService.php | TeamService.deleteById | public function deleteById($teamId, array $queryParams = [])
{
$response = $this->api->teams()->deleteById($teamId, $queryParams);
return new BaseResponse($response);
} | php | public function deleteById($teamId, array $queryParams = [])
{
$response = $this->api->teams()->deleteById($teamId, $queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteById",
"(",
"$",
"teamId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"teams",
"(",
")",
"->",
"deleteById",
"(",
"$",
"teamId",
",",
"$",
"queryParams... | Delete team by id
@param int $teamId
@param array $queryParams
@return BaseResponse | [
"Delete",
"team",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/TeamService.php#L103-L108 | train |
nabu-3/core | nabu/data/catalog/base/CNabuCatalogItemBase.php | CNabuCatalogItemBase.getAllCatalogItems | public static function getAllCatalogItems(CNabuCatalog $nb_catalog)
{
$nb_catalog_id = nb_getMixedValue($nb_catalog, 'nb_catalog_id');
if (is_numeric($nb_catalog_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_catalog_item_id',
'select * '
. 'from nb_catalog_item '
. 'where nb_catalog_id=%catalog_id$d',
array(
'catalog_id' => $nb_catalog_id
),
$nb_catalog
);
} else {
$retval = new CNabuCatalogItemList();
}
return $retval;
} | php | public static function getAllCatalogItems(CNabuCatalog $nb_catalog)
{
$nb_catalog_id = nb_getMixedValue($nb_catalog, 'nb_catalog_id');
if (is_numeric($nb_catalog_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_catalog_item_id',
'select * '
. 'from nb_catalog_item '
. 'where nb_catalog_id=%catalog_id$d',
array(
'catalog_id' => $nb_catalog_id
),
$nb_catalog
);
} else {
$retval = new CNabuCatalogItemList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllCatalogItems",
"(",
"CNabuCatalog",
"$",
"nb_catalog",
")",
"{",
"$",
"nb_catalog_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_catalog",
",",
"'nb_catalog_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_catalog_id",
"... | Get all items in the storage as an associative array where the field 'nb_catalog_item_id' is the index, and each
value is an instance of class CNabuCatalogItemBase.
@param CNabuCatalog $nb_catalog The CNabuCatalog instance of the Catalog that owns the Catalog Item List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_catalog_item_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuCatalogItemBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/base/CNabuCatalogItemBase.php#L180-L200 | train |
nabu-3/core | nabu/http/managers/CNabuHTTPRendersManager.php | CNabuHTTPRendersManager.setResponseTransform | public function setResponseTransform(CNabuHTTPResponse $nb_response, string $interface_key = null)
{
if ($interface_key === null) {
$nb_response->setTransformFactory(null);
} else {
$nb_engine = CNabuEngine::getEngine();
$nb_descriptor = $nb_engine->getProviderInterfaceDescriptorByKey(
CNabuProviderFactory::INTERFACE_RENDER_TRANSFORM,
$interface_key
);
if ($nb_descriptor instanceof CNabuRenderTransformInterfaceDescriptor &&
($nb_pool_manager = $nb_engine->getRenderPoolManager()) instanceof CNabuRenderPoolManager &&
($nb_transform_factory = $nb_pool_manager->getTransformFactory($nb_descriptor))
instanceof CNabuRenderTransformFactory
) {
$nb_response->setTransformFactory($nb_transform_factory);
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_TRANSFORM_NOT_FOUND,
array($interface_key)
);
}
}
return $this;
} | php | public function setResponseTransform(CNabuHTTPResponse $nb_response, string $interface_key = null)
{
if ($interface_key === null) {
$nb_response->setTransformFactory(null);
} else {
$nb_engine = CNabuEngine::getEngine();
$nb_descriptor = $nb_engine->getProviderInterfaceDescriptorByKey(
CNabuProviderFactory::INTERFACE_RENDER_TRANSFORM,
$interface_key
);
if ($nb_descriptor instanceof CNabuRenderTransformInterfaceDescriptor &&
($nb_pool_manager = $nb_engine->getRenderPoolManager()) instanceof CNabuRenderPoolManager &&
($nb_transform_factory = $nb_pool_manager->getTransformFactory($nb_descriptor))
instanceof CNabuRenderTransformFactory
) {
$nb_response->setTransformFactory($nb_transform_factory);
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_TRANSFORM_NOT_FOUND,
array($interface_key)
);
}
}
return $this;
} | [
"public",
"function",
"setResponseTransform",
"(",
"CNabuHTTPResponse",
"$",
"nb_response",
",",
"string",
"$",
"interface_key",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"interface_key",
"===",
"null",
")",
"{",
"$",
"nb_response",
"->",
"setTransformFactory",
"("... | Sets the Response Render Transform Interface using their Interface Name.
@param CNabuHTTPResponse $nb_response HTTP Response instance.
@param string|null $interface_key Response Render Interface Key to search.
@return CNabuHTTPRendersManager Returns self pointer to grant setters chain. | [
"Sets",
"the",
"Response",
"Render",
"Transform",
"Interface",
"using",
"their",
"Interface",
"Name",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPRendersManager.php#L100-L126 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteUserBase.php | CNabuSiteUserBase.setForceDefaultLang | public function setForceDefaultLang(string $force_default_lang = "T") : CNabuDataObject
{
if ($force_default_lang === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$force_default_lang")
);
}
$this->setValue('nb_site_user_force_default_lang', $force_default_lang);
return $this;
} | php | public function setForceDefaultLang(string $force_default_lang = "T") : CNabuDataObject
{
if ($force_default_lang === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$force_default_lang")
);
}
$this->setValue('nb_site_user_force_default_lang', $force_default_lang);
return $this;
} | [
"public",
"function",
"setForceDefaultLang",
"(",
"string",
"$",
"force_default_lang",
"=",
"\"T\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"force_default_lang",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"... | Sets the Site User Force Default Lang attribute value.
@param string $force_default_lang New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"User",
"Force",
"Default",
"Lang",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteUserBase.php#L251-L262 | train |
rips/php-connector-bundle | Services/Application/ScanService.php | ScanService.getAll | public function getAll($appId = null, array $queryParams = [])
{
$response = $this->api->applications()->scans()->getAll($appId, $queryParams);
return new ScansResponse($response);
} | php | public function getAll($appId = null, array $queryParams = [])
{
$response = $this->api->applications()->scans()->getAll($appId, $queryParams);
return new ScansResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
"=",
"null",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"getAll",
"(",... | Get all Scans
@param int|null $appId
@param array $queryParams
@return ScansResponse | [
"Get",
"all",
"Scans"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/ScanService.php#L36-L41 | train |
rips/php-connector-bundle | Services/Application/ScanService.php | ScanService.getById | public function getById($appId, $scanId, array $queryParams = [])
{
$response = $this->api->applications()->scans()->getById($appId, $scanId, $queryParams);
return new ScanResponse($response);
} | php | public function getById($appId, $scanId, array $queryParams = [])
{
$response = $this->api->applications()->scans()->getById($appId, $scanId, $queryParams);
return new ScanResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"getBy... | Get Scan by ID
@param int $appId
@param int $scanId
@param array $queryParams
@return ScanResponse | [
"Get",
"Scan",
"by",
"ID"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/ScanService.php#L51-L56 | train |
rips/php-connector-bundle | Services/Application/ScanService.php | ScanService.create | public function create($appId, $input, array $queryParams = [])
{
if ($input instanceof ScanBuilder) {
$inputArray = $input->toArray();
$defaultInput = true;
} else {
$inputArray = [];
foreach ($input as $key => $value) {
if ($value instanceof BaseBuilder) {
$inputArray[$key] = $value->toArray();
} else if (is_array($value)) {
foreach ($value as $key2 => $value2) {
if ($value2 instanceof BaseBuilder) {
$inputArray[$key][$key2] = $value2->toArray();
} else if (is_string($value2)) {
$inputArray[$key][$key2] = $value2;
}
}
}
}
$defaultInput = false;
}
$response = $this->api->applications()->scans()->create($appId, $inputArray, $queryParams, $defaultInput);
return new ScanResponse($response);
} | php | public function create($appId, $input, array $queryParams = [])
{
if ($input instanceof ScanBuilder) {
$inputArray = $input->toArray();
$defaultInput = true;
} else {
$inputArray = [];
foreach ($input as $key => $value) {
if ($value instanceof BaseBuilder) {
$inputArray[$key] = $value->toArray();
} else if (is_array($value)) {
foreach ($value as $key2 => $value2) {
if ($value2 instanceof BaseBuilder) {
$inputArray[$key][$key2] = $value2->toArray();
} else if (is_string($value2)) {
$inputArray[$key][$key2] = $value2;
}
}
}
}
$defaultInput = false;
}
$response = $this->api->applications()->scans()->create($appId, $inputArray, $queryParams, $defaultInput);
return new ScanResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"input",
"instanceof",
"ScanBuilder",
")",
"{",
"$",
"inputArray",
"=",
"$",
"input",
"->",
"toArray",
"(... | Create a new scan
@param int $appId
@param ScanBuilder|BaseBuilder[string] $input
@param array $queryParams
@return ScanResponse | [
"Create",
"a",
"new",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/ScanService.php#L65-L91 | train |
rips/php-connector-bundle | Services/Application/ScanService.php | ScanService.update | public function update($appId, $scanId, $input, array $queryParams = [])
{
if ($input instanceof ScanBuilder) {
$inputArray = $input->toArray();
$defaultInput = true;
} else {
$inputArray = [];
foreach ($input as $key => $value) {
if ($value instanceof BaseBuilder) {
$inputArray[$key] = $value->toArray();
}
}
$defaultInput = false;
}
$response = $this->api->applications()->scans()->update($appId, $scanId, $inputArray, $queryParams, $defaultInput);
return new ScanResponse($response);
} | php | public function update($appId, $scanId, $input, array $queryParams = [])
{
if ($input instanceof ScanBuilder) {
$inputArray = $input->toArray();
$defaultInput = true;
} else {
$inputArray = [];
foreach ($input as $key => $value) {
if ($value instanceof BaseBuilder) {
$inputArray[$key] = $value->toArray();
}
}
$defaultInput = false;
}
$response = $this->api->applications()->scans()->update($appId, $scanId, $inputArray, $queryParams, $defaultInput);
return new ScanResponse($response);
} | [
"public",
"function",
"update",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"input",
"instanceof",
"ScanBuilder",
")",
"{",
"$",
"inputArray",
"=",
"$",
"input",... | Update an existing scan by id
@param int $appId
@param int $scanId
@param ScanBuilder|BaseBuilder[string] $input
@param array $queryParams
@return ScanResponse | [
"Update",
"an",
"existing",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/ScanService.php#L102-L120 | train |
rips/php-connector-bundle | Services/Application/ScanService.php | ScanService.blockUntilDone | public function blockUntilDone($appId, $scanId, $waitTime = 0, $sleepTime = 5, array $queryParams = [])
{
$response = $this->api->applications()->scans()->blockUntilDone($appId, $scanId, $waitTime, $sleepTime, $queryParams);
return new ScanResponse($response);
} | php | public function blockUntilDone($appId, $scanId, $waitTime = 0, $sleepTime = 5, array $queryParams = [])
{
$response = $this->api->applications()->scans()->blockUntilDone($appId, $scanId, $waitTime, $sleepTime, $queryParams);
return new ScanResponse($response);
} | [
"public",
"function",
"blockUntilDone",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"waitTime",
"=",
"0",
",",
"$",
"sleepTime",
"=",
"5",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api... | Block until a scan is finished
@param int $appId
@param int $scanId
@param int $waitTime - Optional time to wait in seconds. Waits indefinitely if 0
@param int $sleepTime - Time to wait between scan completion checks
@param array $queryParams
@return ScanResponse
@throws \Exception if scan does not finish in time | [
"Block",
"until",
"a",
"scan",
"is",
"finished"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/ScanService.php#L162-L167 | train |
orchestral/lumen | src/Console/Kernel.php | Kernel.getCommands | protected function getCommands()
{
return \array_merge($this->commands, [
\Illuminate\Console\Scheduling\ScheduleRunCommand::class,
\Laravel\Lumen\Console\Commands\ServeCommand::class,
]);
} | php | protected function getCommands()
{
return \array_merge($this->commands, [
\Illuminate\Console\Scheduling\ScheduleRunCommand::class,
\Laravel\Lumen\Console\Commands\ServeCommand::class,
]);
} | [
"protected",
"function",
"getCommands",
"(",
")",
"{",
"return",
"\\",
"array_merge",
"(",
"$",
"this",
"->",
"commands",
",",
"[",
"\\",
"Illuminate",
"\\",
"Console",
"\\",
"Scheduling",
"\\",
"ScheduleRunCommand",
"::",
"class",
",",
"\\",
"Laravel",
"\\"... | Get the commands to add to the application.
@return array | [
"Get",
"the",
"commands",
"to",
"add",
"to",
"the",
"application",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Console/Kernel.php#L225-L231 | train |
rips/php-connector-bundle | Hydrators/Application/UploadHydrator.php | UploadHydrator.hydrateCollection | public static function hydrateCollection(array $uploads)
{
$hydrated = [];
foreach ($uploads as $upload) {
$hydrated[] = self::hydrate($upload);
}
return $hydrated;
} | php | public static function hydrateCollection(array $uploads)
{
$hydrated = [];
foreach ($uploads as $upload) {
$hydrated[] = self::hydrate($upload);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"uploads",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"uploads",
"as",
"$",
"upload",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
... | Hydrate a collection of upload objects into a collection of
UploadEntity objects
@param stdClass[] $uploads
@return UploadEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"upload",
"objects",
"into",
"a",
"collection",
"of",
"UploadEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/UploadHydrator.php#L20-L29 | train |
rips/php-connector-bundle | Hydrators/Application/UploadHydrator.php | UploadHydrator.hydrate | public static function hydrate(stdClass $upload)
{
$hydrated = new UploadEntity;
if (isset($upload->id)) {
$hydrated->setId($upload->id);
}
if (isset($upload->created_at)) {
$hydrated->setCreatedAt(new DateTime($upload->created_at));
}
if (isset($upload->name)) {
$hydrated->setName($upload->name);
}
if (isset($upload->extension)) {
$hydrated->setExtension($upload->extension);
}
if (isset($upload->size)) {
$hydrated->setSize($upload->size);
}
if (isset($upload->file)) {
$hydrated->setFile($upload->file);
}
if (isset($upload->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($upload->created_by));
}
if (isset($upload->application)) {
$hydrated->setApplication(ApplicationHydrator::hydrate($upload->application));
}
return $hydrated;
} | php | public static function hydrate(stdClass $upload)
{
$hydrated = new UploadEntity;
if (isset($upload->id)) {
$hydrated->setId($upload->id);
}
if (isset($upload->created_at)) {
$hydrated->setCreatedAt(new DateTime($upload->created_at));
}
if (isset($upload->name)) {
$hydrated->setName($upload->name);
}
if (isset($upload->extension)) {
$hydrated->setExtension($upload->extension);
}
if (isset($upload->size)) {
$hydrated->setSize($upload->size);
}
if (isset($upload->file)) {
$hydrated->setFile($upload->file);
}
if (isset($upload->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($upload->created_by));
}
if (isset($upload->application)) {
$hydrated->setApplication(ApplicationHydrator::hydrate($upload->application));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"upload",
")",
"{",
"$",
"hydrated",
"=",
"new",
"UploadEntity",
";",
"if",
"(",
"isset",
"(",
"$",
"upload",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$",
"uploa... | Hydrate a upload object into a UploadEntity object
@param stdClass $upload
@return UploadEntity | [
"Hydrate",
"a",
"upload",
"object",
"into",
"a",
"UploadEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/UploadHydrator.php#L37-L74 | train |
rips/php-connector-bundle | Hydrators/ActivityHydrator.php | ActivityHydrator.hydrateCollection | public static function hydrateCollection(array $activities)
{
$hydrated = [];
foreach ($activities as $activity) {
$hydrated[] = self::hydrate($activity);
}
return $hydrated;
} | php | public static function hydrateCollection(array $activities)
{
$hydrated = [];
foreach ($activities as $activity) {
$hydrated[] = self::hydrate($activity);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"activities",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"activities",
"as",
"$",
"activity",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydr... | Hydrate a collection of activity objects into a collection of
ActivityEntity objects
@param stdClass[] $activities
@return ActivityEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"activity",
"objects",
"into",
"a",
"collection",
"of",
"ActivityEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/ActivityHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/ActivityHydrator.php | ActivityHydrator.hydrate | public static function hydrate(stdClass $activity)
{
$hydrated = new ActivityEntity();
if (isset($activity->id)) {
$hydrated->setId($activity->id);
}
if (isset($activity->type)) {
$hydrated->setType($activity->type);
}
if (isset($activity->context)) {
$hydrated->setContext(json_decode(json_encode($activity->context), true));
}
if (isset($activity->application)) {
$hydrated->setApplication(ApplicationHydrator::hydrate($activity->application));
}
if (isset($activity->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($activity->created_by));
}
if (isset($activity->created_at)) {
$hydrated->setCreatedAt(new DateTime($activity->created_at));
}
return $hydrated;
} | php | public static function hydrate(stdClass $activity)
{
$hydrated = new ActivityEntity();
if (isset($activity->id)) {
$hydrated->setId($activity->id);
}
if (isset($activity->type)) {
$hydrated->setType($activity->type);
}
if (isset($activity->context)) {
$hydrated->setContext(json_decode(json_encode($activity->context), true));
}
if (isset($activity->application)) {
$hydrated->setApplication(ApplicationHydrator::hydrate($activity->application));
}
if (isset($activity->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($activity->created_by));
}
if (isset($activity->created_at)) {
$hydrated->setCreatedAt(new DateTime($activity->created_at));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"activity",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ActivityEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"activity",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
... | Hydrate a activity object into a ActivityEntity object
@param stdClass $activity
@return ActivityEntity | [
"Hydrate",
"a",
"activity",
"object",
"into",
"a",
"ActivityEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/ActivityHydrator.php#L35-L64 | train |
nabu-3/core | nabu/data/site/traits/TNabuSiteMapChild.php | TNabuSiteMapChild.setSiteMap | public function setSiteMap(CNabuSiteMap $nb_site_map, $field = NABU_SITE_MAP_FIELD_ID)
{
$this->nb_site_map = $nb_site_map;
if ($this instanceof CNabuDataObject) {
$this->transferValue($nb_site_map, NABU_SITE_MAP_FIELD_ID, $field);
}
return $this;
} | php | public function setSiteMap(CNabuSiteMap $nb_site_map, $field = NABU_SITE_MAP_FIELD_ID)
{
$this->nb_site_map = $nb_site_map;
if ($this instanceof CNabuDataObject) {
$this->transferValue($nb_site_map, NABU_SITE_MAP_FIELD_ID, $field);
}
return $this;
} | [
"public",
"function",
"setSiteMap",
"(",
"CNabuSiteMap",
"$",
"nb_site_map",
",",
"$",
"field",
"=",
"NABU_SITE_MAP_FIELD_ID",
")",
"{",
"$",
"this",
"->",
"nb_site_map",
"=",
"$",
"nb_site_map",
";",
"if",
"(",
"$",
"this",
"instanceof",
"CNabuDataObject",
")... | Sets the Site Map instance that owns this object and sets the field containing the site id.
@param CNabuSiteMap $nb_site_map Site Map instance to be setted.
@param string $field Field name where the site id will be stored.
@return mixed Returns $this to allow the cascade chain of setters. | [
"Sets",
"the",
"Site",
"Map",
"instance",
"that",
"owns",
"this",
"object",
"and",
"sets",
"the",
"field",
"containing",
"the",
"site",
"id",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/traits/TNabuSiteMapChild.php#L58-L66 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/CommentService.php | CommentService.getAll | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()->getAll($appId, $scanId, $issueId, $queryParams);
return new CommentsResponse($response);
} | php | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()->getAll($appId, $scanId, $issueId, $queryParams);
return new CommentsResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(... | Get all comments for an issue
@param int $appId
@param int $scanId
@param int $issueId
@param array $queryParams
@return CommentsResponse | [
"Get",
"all",
"comments",
"for",
"an",
"issue"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/CommentService.php#L37-L46 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/CommentService.php | CommentService.getById | public function getById($appId, $scanId, $issueId, $commentId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()
->getById($appId, $scanId, $issueId, $commentId, $queryParams);
return new CommentResponse($response);
} | php | public function getById($appId, $scanId, $issueId, $commentId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()
->getById($appId, $scanId, $issueId, $commentId, $queryParams);
return new CommentResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"$",
"commentId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
... | Get comment for an issue by id
@param int $appId
@param int $scanId
@param int $issueId
@param int $commentId
@param array $queryParams
@return CommentResponse | [
"Get",
"comment",
"for",
"an",
"issue",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/CommentService.php#L58-L68 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/CommentService.php | CommentService.create | public function create($appId, $scanId, $issueId, CommentBuilder $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()
->create($appId, $scanId, $issueId, $input->toArray(), $queryParams);
return new CommentResponse($response);
} | php | public function create($appId, $scanId, $issueId, CommentBuilder $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()
->create($appId, $scanId, $issueId, $input->toArray(), $queryParams);
return new CommentResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"CommentBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applica... | Create a comment for an issue
@param int $appId
@param int $scanId
@param int $issueId
@param CommentBuilder $input
@param array $queryParams
@return CommentResponse | [
"Create",
"a",
"comment",
"for",
"an",
"issue"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/CommentService.php#L80-L90 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/CommentService.php | CommentService.deleteAll | public function deleteAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()
->deleteAll($appId, $scanId, $issueId, $queryParams);
return new BaseResponse($response);
} | php | public function deleteAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()
->deleteAll($appId, $scanId, $issueId, $queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
... | Delete all comments for an issue
@param int $appId
@param int $scanId
@param int $issueId
@param array $queryParams
@return BaseResponse | [
"Delete",
"all",
"comments",
"for",
"an",
"issue"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/CommentService.php#L101-L111 | train |
zikula/Wizard | Wizard.php | Wizard.getCurrentStage | public function getCurrentStage(string $name): StageInterface
{
// compute the stageClass from Request parameter
$stageClass = $this->getStageClassName($name);
// loop each stage until finds the first that is necessary
do {
$useCurrentStage = false;
/** @var StageInterface $currentStage */
if (!isset($currentStage)) {
$currentStage = $this->getStageInstance($stageClass);
}
$this->currentStageName = $currentStage->getName();
try {
$isNecessary = $currentStage->isNecessary();
} catch (AbortStageException $e) {
$this->warning = $e->getMessage();
$isNecessary = true;
}
if ($isNecessary) {
$useCurrentStage = true;
} else {
$currentStage = $this->getNextStage();
}
} while (false === $useCurrentStage);
return $currentStage;
} | php | public function getCurrentStage(string $name): StageInterface
{
// compute the stageClass from Request parameter
$stageClass = $this->getStageClassName($name);
// loop each stage until finds the first that is necessary
do {
$useCurrentStage = false;
/** @var StageInterface $currentStage */
if (!isset($currentStage)) {
$currentStage = $this->getStageInstance($stageClass);
}
$this->currentStageName = $currentStage->getName();
try {
$isNecessary = $currentStage->isNecessary();
} catch (AbortStageException $e) {
$this->warning = $e->getMessage();
$isNecessary = true;
}
if ($isNecessary) {
$useCurrentStage = true;
} else {
$currentStage = $this->getNextStage();
}
} while (false === $useCurrentStage);
return $currentStage;
} | [
"public",
"function",
"getCurrentStage",
"(",
"string",
"$",
"name",
")",
":",
"StageInterface",
"{",
"// compute the stageClass from Request parameter",
"$",
"stageClass",
"=",
"$",
"this",
"->",
"getStageClassName",
"(",
"$",
"name",
")",
";",
"// loop each stage un... | Get the stage that is the first necessary stage | [
"Get",
"the",
"stage",
"that",
"is",
"the",
"first",
"necessary",
"stage"
] | 1d19a5c14da3f17e1962be96a24c85fa733dc136 | https://github.com/zikula/Wizard/blob/1d19a5c14da3f17e1962be96a24c85fa733dc136/Wizard.php#L117-L145 | train |
zikula/Wizard | Wizard.php | Wizard.getSequentialStage | private function getSequentialStage(string $direction): ?StageInterface
{
$dir = in_array($direction, ['prev', 'next']) ? $direction : 'next';
ksort($this->stageOrder);
// forward the array pointer to the current index
while (current($this->stageOrder) !== $this->currentStageName && null !== key($this->stageOrder)) {
next($this->stageOrder);
}
$key = $dir($this->stageOrder);
if (null !== $key && false !== $key) {
return $this->getStageInstance($this->stagesByName[$key]);
}
return null;
} | php | private function getSequentialStage(string $direction): ?StageInterface
{
$dir = in_array($direction, ['prev', 'next']) ? $direction : 'next';
ksort($this->stageOrder);
// forward the array pointer to the current index
while (current($this->stageOrder) !== $this->currentStageName && null !== key($this->stageOrder)) {
next($this->stageOrder);
}
$key = $dir($this->stageOrder);
if (null !== $key && false !== $key) {
return $this->getStageInstance($this->stagesByName[$key]);
}
return null;
} | [
"private",
"function",
"getSequentialStage",
"(",
"string",
"$",
"direction",
")",
":",
"?",
"StageInterface",
"{",
"$",
"dir",
"=",
"in_array",
"(",
"$",
"direction",
",",
"[",
"'prev'",
",",
"'next'",
"]",
")",
"?",
"$",
"direction",
":",
"'next'",
";"... | Get either previous or next stage | [
"Get",
"either",
"previous",
"or",
"next",
"stage"
] | 1d19a5c14da3f17e1962be96a24c85fa733dc136 | https://github.com/zikula/Wizard/blob/1d19a5c14da3f17e1962be96a24c85fa733dc136/Wizard.php#L166-L180 | train |
zikula/Wizard | Wizard.php | Wizard.getStageInstance | private function getStageInstance(string $stageClass): StageInterface
{
if (!class_exists($stageClass)) {
throw new RuntimeException('Error: Could not find requested stage class.');
}
if (in_array("Zikula\\Component\\Wizard\\InjectContainerInterface", class_implements($stageClass), true)) {
return new $stageClass($this->container);
}
return new $stageClass();
} | php | private function getStageInstance(string $stageClass): StageInterface
{
if (!class_exists($stageClass)) {
throw new RuntimeException('Error: Could not find requested stage class.');
}
if (in_array("Zikula\\Component\\Wizard\\InjectContainerInterface", class_implements($stageClass), true)) {
return new $stageClass($this->container);
}
return new $stageClass();
} | [
"private",
"function",
"getStageInstance",
"(",
"string",
"$",
"stageClass",
")",
":",
"StageInterface",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"stageClass",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Error: Could not find requested stage clas... | Factory class to instantiate a StageClass | [
"Factory",
"class",
"to",
"instantiate",
"a",
"StageClass"
] | 1d19a5c14da3f17e1962be96a24c85fa733dc136 | https://github.com/zikula/Wizard/blob/1d19a5c14da3f17e1962be96a24c85fa733dc136/Wizard.php#L185-L195 | train |
zikula/Wizard | Wizard.php | Wizard.getStageClassName | private function getStageClassName(string $name): string
{
if (!empty($this->stagesByName[$name])) {
return $this->stagesByName[$name];
}
if (!empty($this->defaultStage) && !empty($this->stagesByName[$this->defaultStage])) {
return $this->stagesByName[$this->defaultStage];
}
throw new InvalidArgumentException('The request stage could not be found and there is no default stage defined.');
} | php | private function getStageClassName(string $name): string
{
if (!empty($this->stagesByName[$name])) {
return $this->stagesByName[$name];
}
if (!empty($this->defaultStage) && !empty($this->stagesByName[$this->defaultStage])) {
return $this->stagesByName[$this->defaultStage];
}
throw new InvalidArgumentException('The request stage could not be found and there is no default stage defined.');
} | [
"private",
"function",
"getStageClassName",
"(",
"string",
"$",
"name",
")",
":",
"string",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"stagesByName",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"stagesByName",
"[",
... | Match the stage and return the stage classname or default.
@throws InvalidArgumentException | [
"Match",
"the",
"stage",
"and",
"return",
"the",
"stage",
"classname",
"or",
"default",
"."
] | 1d19a5c14da3f17e1962be96a24c85fa733dc136 | https://github.com/zikula/Wizard/blob/1d19a5c14da3f17e1962be96a24c85fa733dc136/Wizard.php#L218-L227 | train |
rips/php-connector-bundle | Services/Application/Scan/CustomFunctionService.php | CustomFunctionService.getAll | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->functions()
->getAll($appId, $scanId, $queryParams);
return new CustomFunctionsResponse($response);
} | php | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->functions()
->getAll($appId, $scanId, $queryParams);
return new CustomFunctionsResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"functi... | Get all custom functions for a scan
@param int $appId
@param int $scanId
@param array $queryParams
@return CustomFunctionsResponse | [
"Get",
"all",
"custom",
"functions",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/CustomFunctionService.php#L35-L44 | train |
rips/php-connector-bundle | Services/Application/Scan/CustomFunctionService.php | CustomFunctionService.getById | public function getById($appId, $scanId, $functionId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->functions()
->getById($appId, $scanId, $functionId, $queryParams);
return new CustomFunctionResponse($response);
} | php | public function getById($appId, $scanId, $functionId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->functions()
->getById($appId, $scanId, $functionId, $queryParams);
return new CustomFunctionResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"functionId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
... | Get custom function for scan by id
@param int $appId
@param int $scanId
@param int $functionId
@param array $queryParams
@return CustomFunctionResponse | [
"Get",
"custom",
"function",
"for",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/CustomFunctionService.php#L55-L64 | train |
rips/php-connector-bundle | Services/Application/Scan/CustomFunctionService.php | CustomFunctionService.create | public function create($appId, $scanId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->functions()
->create($appId, $scanId, $input->toArray(), $queryParams);
return new CustomFunctionResponse($response);
} | php | public function create($appId, $scanId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->functions()
->create($appId, $scanId, $input->toArray(), $queryParams);
return new CustomFunctionResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",... | Create custom function for a scan
@param int $appId
@param int $scanId
@param CustomFunctionBuilder $input
@param array $queryParams
@return CustomFunctionResponse | [
"Create",
"custom",
"function",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/CustomFunctionService.php#L75-L84 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/SummaryService.php | SummaryService.getAll | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->summaries()
->getAll($appId, $scanId, $issueId, $queryParams);
return new SummariesResponse($response);
} | php | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->summaries()
->getAll($appId, $scanId, $issueId, $queryParams);
return new SummariesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(... | Get all summaries for an issue
@param int $appId
@param int $scanId
@param int $issueId
@param array $queryParams
@return SummariesResponse | [
"Get",
"all",
"summaries",
"for",
"an",
"issue"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/SummaryService.php#L35-L45 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/SummaryService.php | SummaryService.getById | public function getById($appId, $scanId, $issueId, $summaryId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->summaries()
->getById($appId, $scanId, $issueId, $summaryId, $queryParams);
return new SummaryResponse($response);
} | php | public function getById($appId, $scanId, $issueId, $summaryId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->summaries()
->getById($appId, $scanId, $issueId, $summaryId, $queryParams);
return new SummaryResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"$",
"summaryId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
... | Get summary for an issue by id
@param int $appId
@param int $scanId
@param int $issueId
@param int $summaryId
@param array $queryParams
@return SummaryResponse | [
"Get",
"summary",
"for",
"an",
"issue",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/SummaryService.php#L57-L67 | train |
nabu-3/core | nabu/render/adapters/CNabuRenderModuleManagerAdapter.php | CNabuRenderModuleManagerAdapter.registerRenderInterface | protected function registerRenderInterface(INabuRenderInterface $interface) : bool
{
$hash = $interface->getHash();
if (is_array($this->render_interface_list) && array_key_exists($hash, $this->render_interface_list)) {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_INSTANCE_ALREADY_REGISTERED,
array(get_class($interface))
);
}
if ($this->render_interface_list === null) {
$this->render_interface_list = array($hash => $interface);
} else {
$this->render_interface_list[$hash] = $interface;
}
return $interface->init();
} | php | protected function registerRenderInterface(INabuRenderInterface $interface) : bool
{
$hash = $interface->getHash();
if (is_array($this->render_interface_list) && array_key_exists($hash, $this->render_interface_list)) {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_INSTANCE_ALREADY_REGISTERED,
array(get_class($interface))
);
}
if ($this->render_interface_list === null) {
$this->render_interface_list = array($hash => $interface);
} else {
$this->render_interface_list[$hash] = $interface;
}
return $interface->init();
} | [
"protected",
"function",
"registerRenderInterface",
"(",
"INabuRenderInterface",
"$",
"interface",
")",
":",
"bool",
"{",
"$",
"hash",
"=",
"$",
"interface",
"->",
"getHash",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"render_interface_list"... | Register a new Render Interface instance.
@param INabuRenderInterface $interface Interface instance to be registered.
@return bool Returns true if the instance is registered and initiated.
@throws ENabuRenderException Raises an exception if $interface is already registered. | [
"Register",
"a",
"new",
"Render",
"Interface",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/render/adapters/CNabuRenderModuleManagerAdapter.php#L54-L71 | train |
nabu-3/core | nabu/render/adapters/CNabuRenderModuleManagerAdapter.php | CNabuRenderModuleManagerAdapter.registerTransformInterface | protected function registerTransformInterface(INabuRenderTransformInterface $interface) : bool
{
$hash = $interface->getHash();
if (is_array($this->render_transform_interface_list) &&
array_key_exists($hash, $this->render_transform_interface_list)
) {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_TRANSFORM_INSTANCE_ALREADY_REGISTERED,
array(get_class($interface))
);
}
if ($this->render_transform_interface_list === null) {
$this->render_transform_interface_list = array($hash => $interface);
} else {
$this->render_transform_interface_list[$hash] = $interface;
}
return $interface->init();
} | php | protected function registerTransformInterface(INabuRenderTransformInterface $interface) : bool
{
$hash = $interface->getHash();
if (is_array($this->render_transform_interface_list) &&
array_key_exists($hash, $this->render_transform_interface_list)
) {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_TRANSFORM_INSTANCE_ALREADY_REGISTERED,
array(get_class($interface))
);
}
if ($this->render_transform_interface_list === null) {
$this->render_transform_interface_list = array($hash => $interface);
} else {
$this->render_transform_interface_list[$hash] = $interface;
}
return $interface->init();
} | [
"protected",
"function",
"registerTransformInterface",
"(",
"INabuRenderTransformInterface",
"$",
"interface",
")",
":",
"bool",
"{",
"$",
"hash",
"=",
"$",
"interface",
"->",
"getHash",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"render_tra... | Register a new Render Transform Interface instance.
@param INabuRenderTransformInterface $interface Interface instance to be registered.
@return bool Returns true if the instance is registered and initiated.
@throws ENabuRenderException Raises an exception if $interface is already registered. | [
"Register",
"a",
"new",
"Render",
"Transform",
"Interface",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/render/adapters/CNabuRenderModuleManagerAdapter.php#L125-L144 | train |
orchestral/lumen | src/Routing/Concerns/ProvidesSignedRoute.php | ProvidesSignedRoute.hasValidSignature | public function hasValidSignature(Request $request)
{
$url = $request->url();
$original = rtrim($url.'?'.Arr::query(
Arr::except($request->query(), 'signature')
), '?');
$expires = $request->query()['expires'] ?? null;
$signature = \hash_hmac('sha256', $original, \call_user_func($this->keyResolver));
return \hash_equals($signature, (string) $request->query('signature', '')) &&
! ($expires && Carbon::now()->getTimestamp() > $expires);
} | php | public function hasValidSignature(Request $request)
{
$url = $request->url();
$original = rtrim($url.'?'.Arr::query(
Arr::except($request->query(), 'signature')
), '?');
$expires = $request->query()['expires'] ?? null;
$signature = \hash_hmac('sha256', $original, \call_user_func($this->keyResolver));
return \hash_equals($signature, (string) $request->query('signature', '')) &&
! ($expires && Carbon::now()->getTimestamp() > $expires);
} | [
"public",
"function",
"hasValidSignature",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"url",
"=",
"$",
"request",
"->",
"url",
"(",
")",
";",
"$",
"original",
"=",
"rtrim",
"(",
"$",
"url",
".",
"'?'",
".",
"Arr",
"::",
"query",
"(",
"Arr",
"::... | Determine if the given request has a valid signature.
@param \Illuminate\Http\Request $request
@return bool | [
"Determine",
"if",
"the",
"given",
"request",
"has",
"a",
"valid",
"signature",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Routing/Concerns/ProvidesSignedRoute.php#L70-L84 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetCTABase.php | CNabuSiteTargetCTABase.setTargetUseURI | public function setTargetUseURI(string $target_use_uri = "N") : CNabuDataObject
{
if ($target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$target_use_uri")
);
}
$this->setValue('nb_site_target_cta_target_use_uri', $target_use_uri);
return $this;
} | php | public function setTargetUseURI(string $target_use_uri = "N") : CNabuDataObject
{
if ($target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$target_use_uri")
);
}
$this->setValue('nb_site_target_cta_target_use_uri', $target_use_uri);
return $this;
} | [
"public",
"function",
"setTargetUseURI",
"(",
"string",
"$",
"target_use_uri",
"=",
"\"N\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"target_use_uri",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERRO... | Sets the Site Target CTA Target Use URI attribute value.
@param string $target_use_uri New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"CTA",
"Target",
"Use",
"URI",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetCTABase.php#L393-L404 | train |
nabu-3/core | nabu/data/security/base/CNabuUserBase.php | CNabuUserBase.getAllUsers | public static function getAllUsers(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_user_id',
'select * '
. 'from nb_user '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuUserList();
}
return $retval;
} | php | public static function getAllUsers(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_user_id',
'select * '
. 'from nb_user '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuUserList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllUsers",
"(",
"CNabuCustomer",
"$",
"nb_customer",
")",
"{",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
",",
"'nb_customer_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_customer_id",
")... | Get all items in the storage as an associative array where the field 'nb_user_id' is the index, and each value
is an instance of class CNabuUserBase.
@param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the User List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_user_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuUserBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserBase.php#L99-L119 | train |
nabu-3/core | nabu/data/security/base/CNabuUserBase.php | CNabuUserBase.setSearchVisibility | public function setSearchVisibility(string $search_visibility = "N") : CNabuDataObject
{
if ($search_visibility === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$search_visibility")
);
}
$this->setValue('nb_user_search_visibility', $search_visibility);
return $this;
} | php | public function setSearchVisibility(string $search_visibility = "N") : CNabuDataObject
{
if ($search_visibility === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$search_visibility")
);
}
$this->setValue('nb_user_search_visibility', $search_visibility);
return $this;
} | [
"public",
"function",
"setSearchVisibility",
"(",
"string",
"$",
"search_visibility",
"=",
"\"N\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"search_visibility",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::... | Sets the User Search Visibility attribute value.
@param string $search_visibility New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Search",
"Visibility",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserBase.php#L289-L300 | train |
nabu-3/core | nabu/data/security/base/CNabuUserBase.php | CNabuUserBase.setLogin | public function setLogin(string $login) : CNabuDataObject
{
if ($login === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$login")
);
}
$this->setValue('nb_user_login', $login);
return $this;
} | php | public function setLogin(string $login) : CNabuDataObject
{
if ($login === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$login")
);
}
$this->setValue('nb_user_login', $login);
return $this;
} | [
"public",
"function",
"setLogin",
"(",
"string",
"$",
"login",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"login",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
"arr... | Sets the User Login attribute value.
@param string $login New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Login",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserBase.php#L316-L327 | train |
nabu-3/core | nabu/data/security/base/CNabuUserBase.php | CNabuUserBase.setPassword | public function setPassword(string $passwd) : CNabuDataObject
{
if ($passwd === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$passwd")
);
}
$this->setValue('nb_user_passwd', $passwd);
return $this;
} | php | public function setPassword(string $passwd) : CNabuDataObject
{
if ($passwd === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$passwd")
);
}
$this->setValue('nb_user_passwd', $passwd);
return $this;
} | [
"public",
"function",
"setPassword",
"(",
"string",
"$",
"passwd",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"passwd",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
... | Sets the User Password attribute value.
@param string $passwd New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Password",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserBase.php#L343-L354 | train |
nabu-3/core | nabu/data/security/base/CNabuUserBase.php | CNabuUserBase.setValidationStatus | public function setValidationStatus(string $validation_status = "F") : CNabuDataObject
{
if ($validation_status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$validation_status")
);
}
$this->setValue('nb_user_validation_status', $validation_status);
return $this;
} | php | public function setValidationStatus(string $validation_status = "F") : CNabuDataObject
{
if ($validation_status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$validation_status")
);
}
$this->setValue('nb_user_validation_status', $validation_status);
return $this;
} | [
"public",
"function",
"setValidationStatus",
"(",
"string",
"$",
"validation_status",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"validation_status",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::... | Sets the User Validation Status attribute value.
@param string $validation_status New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Validation",
"Status",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserBase.php#L370-L381 | train |
nabu-3/core | nabu/data/security/base/CNabuUserBase.php | CNabuUserBase.setPoliciesAccepted | public function setPoliciesAccepted(string $policies_accepted = "F") : CNabuDataObject
{
if ($policies_accepted === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$policies_accepted")
);
}
$this->setValue('nb_user_policies_accepted', $policies_accepted);
return $this;
} | php | public function setPoliciesAccepted(string $policies_accepted = "F") : CNabuDataObject
{
if ($policies_accepted === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$policies_accepted")
);
}
$this->setValue('nb_user_policies_accepted', $policies_accepted);
return $this;
} | [
"public",
"function",
"setPoliciesAccepted",
"(",
"string",
"$",
"policies_accepted",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"policies_accepted",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::... | Sets the User Policies Accepted attribute value.
@param string $policies_accepted New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Policies",
"Accepted",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserBase.php#L397-L408 | train |
nabu-3/core | nabu/data/security/base/CNabuUserBase.php | CNabuUserBase.setCreationDatetime | public function setCreationDatetime($creation_datetime) : CNabuDataObject
{
if ($creation_datetime === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$creation_datetime")
);
}
$this->setValue('nb_user_creation_datetime', $creation_datetime);
return $this;
} | php | public function setCreationDatetime($creation_datetime) : CNabuDataObject
{
if ($creation_datetime === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$creation_datetime")
);
}
$this->setValue('nb_user_creation_datetime', $creation_datetime);
return $this;
} | [
"public",
"function",
"setCreationDatetime",
"(",
"$",
"creation_datetime",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"creation_datetime",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALL... | Sets the User Creation Datetime attribute value.
@param mixed $creation_datetime New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Creation",
"Datetime",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserBase.php#L451-L462 | train |
nabu-3/core | nabu/data/security/base/CNabuUserBase.php | CNabuUserBase.setEmail | public function setEmail(string $email) : CNabuDataObject
{
if ($email === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$email")
);
}
$this->setValue('nb_user_email', $email);
return $this;
} | php | public function setEmail(string $email) : CNabuDataObject
{
if ($email === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$email")
);
}
$this->setValue('nb_user_email', $email);
return $this;
} | [
"public",
"function",
"setEmail",
"(",
"string",
"$",
"email",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"email",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
"arr... | Sets the User Email attribute value.
@param string $email New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Email",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserBase.php#L961-L972 | train |
nabu-3/core | nabu/data/security/base/CNabuUserBase.php | CNabuUserBase.setAllowNotification | public function setAllowNotification(string $allow_notification = "F") : CNabuDataObject
{
if ($allow_notification === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$allow_notification")
);
}
$this->setValue('nb_user_allow_notification', $allow_notification);
return $this;
} | php | public function setAllowNotification(string $allow_notification = "F") : CNabuDataObject
{
if ($allow_notification === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$allow_notification")
);
}
$this->setValue('nb_user_allow_notification', $allow_notification);
return $this;
} | [
"public",
"function",
"setAllowNotification",
"(",
"string",
"$",
"allow_notification",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"allow_notification",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
... | Sets the User Allow Notification attribute value.
@param string $allow_notification New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Allow",
"Notification",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserBase.php#L1114-L1125 | train |
brtriver/dbup | src/Dbup/Application.php | Application.sort | public function sort()
{
return function (\SplFileInfo $a, \SplFileInfo $b) {
preg_match(self::PATTERN, $a->getFileName(), $version_a);
preg_match(self::PATTERN, $b->getFileName(), $version_b);
return ((int)$version_a[1] < (int)$version_b[1]) ? -1 : 1;
};
} | php | public function sort()
{
return function (\SplFileInfo $a, \SplFileInfo $b) {
preg_match(self::PATTERN, $a->getFileName(), $version_a);
preg_match(self::PATTERN, $b->getFileName(), $version_b);
return ((int)$version_a[1] < (int)$version_b[1]) ? -1 : 1;
};
} | [
"public",
"function",
"sort",
"(",
")",
"{",
"return",
"function",
"(",
"\\",
"SplFileInfo",
"$",
"a",
",",
"\\",
"SplFileInfo",
"$",
"b",
")",
"{",
"preg_match",
"(",
"self",
"::",
"PATTERN",
",",
"$",
"a",
"->",
"getFileName",
"(",
")",
",",
"$",
... | sort closure for Finder
@return callable sort closure for Finder | [
"sort",
"closure",
"for",
"Finder"
] | 8663e5342a096c739d70236a49bb981634023534 | https://github.com/brtriver/dbup/blob/8663e5342a096c739d70236a49bb981634023534/src/Dbup/Application.php#L111-L118 | train |
brtriver/dbup | src/Dbup/Application.php | Application.getSqlFiles | public function getSqlFiles()
{
$sqlFinder = $this->getFinder();
$files = $sqlFinder->files()
->in($this->sqlFilesDir)
->name(self::PATTERN)
->sort($this->sort())
;
return $files;
} | php | public function getSqlFiles()
{
$sqlFinder = $this->getFinder();
$files = $sqlFinder->files()
->in($this->sqlFilesDir)
->name(self::PATTERN)
->sort($this->sort())
;
return $files;
} | [
"public",
"function",
"getSqlFiles",
"(",
")",
"{",
"$",
"sqlFinder",
"=",
"$",
"this",
"->",
"getFinder",
"(",
")",
";",
"$",
"files",
"=",
"$",
"sqlFinder",
"->",
"files",
"(",
")",
"->",
"in",
"(",
"$",
"this",
"->",
"sqlFilesDir",
")",
"->",
"n... | get sql files
@return Finder | [
"get",
"sql",
"files"
] | 8663e5342a096c739d70236a49bb981634023534 | https://github.com/brtriver/dbup/blob/8663e5342a096c739d70236a49bb981634023534/src/Dbup/Application.php#L124-L135 | train |
brtriver/dbup | src/Dbup/Application.php | Application.getSqlFileByName | public function getSqlFileByName($fileName)
{
$sqlFinder = $this->getFinder();
$files = $sqlFinder->files()
->in($this->sqlFilesDir)
->name($fileName)
;
if ($files->count() !== 1) {
throw new RuntimeException('cannot find File:' . $fileName);
}
foreach ($files as $file){
return $file;
}
} | php | public function getSqlFileByName($fileName)
{
$sqlFinder = $this->getFinder();
$files = $sqlFinder->files()
->in($this->sqlFilesDir)
->name($fileName)
;
if ($files->count() !== 1) {
throw new RuntimeException('cannot find File:' . $fileName);
}
foreach ($files as $file){
return $file;
}
} | [
"public",
"function",
"getSqlFileByName",
"(",
"$",
"fileName",
")",
"{",
"$",
"sqlFinder",
"=",
"$",
"this",
"->",
"getFinder",
"(",
")",
";",
"$",
"files",
"=",
"$",
"sqlFinder",
"->",
"files",
"(",
")",
"->",
"in",
"(",
"$",
"this",
"->",
"sqlFile... | find sql file by the file name
@param $fileName
@return mixed
@throws Exception\RuntimeException | [
"find",
"sql",
"file",
"by",
"the",
"file",
"name"
] | 8663e5342a096c739d70236a49bb981634023534 | https://github.com/brtriver/dbup/blob/8663e5342a096c739d70236a49bb981634023534/src/Dbup/Application.php#L143-L159 | train |
brtriver/dbup | src/Dbup/Application.php | Application.getAppliedFiles | public function getAppliedFiles()
{
$appliedFinder = $this->getFinder();
$files = $appliedFinder->files()
->in($this->appliedFilesDir)
->name(self::PATTERN)
->sort($this->sort())
;
return $files;
} | php | public function getAppliedFiles()
{
$appliedFinder = $this->getFinder();
$files = $appliedFinder->files()
->in($this->appliedFilesDir)
->name(self::PATTERN)
->sort($this->sort())
;
return $files;
} | [
"public",
"function",
"getAppliedFiles",
"(",
")",
"{",
"$",
"appliedFinder",
"=",
"$",
"this",
"->",
"getFinder",
"(",
")",
";",
"$",
"files",
"=",
"$",
"appliedFinder",
"->",
"files",
"(",
")",
"->",
"in",
"(",
"$",
"this",
"->",
"appliedFilesDir",
"... | get applied files
@return Finder | [
"get",
"applied",
"files"
] | 8663e5342a096c739d70236a49bb981634023534 | https://github.com/brtriver/dbup/blob/8663e5342a096c739d70236a49bb981634023534/src/Dbup/Application.php#L165-L176 | train |
brtriver/dbup | src/Dbup/Application.php | Application.getStatuses | public function getStatuses()
{
$files = $this->getSqlFiles();
$appliedFiles = $this->getAppliedFiles();
/**
* is file applied or not
* @param $file
* @return bool if applied, return true.
*/
$isApplied = function($file) use ($appliedFiles){
foreach ($appliedFiles as $appliedFile) {
if ($appliedFile->getFileName() === $file->getFileName()){
return true;
}
}
return false;
};
$statuses = [];
foreach($files as $file){
$appliedAt = $isApplied($file)? date('Y-m-d H:i:s', $file->getMTime()): "";
$statuses[] = new Status($appliedAt, $file);
}
return $statuses;
} | php | public function getStatuses()
{
$files = $this->getSqlFiles();
$appliedFiles = $this->getAppliedFiles();
/**
* is file applied or not
* @param $file
* @return bool if applied, return true.
*/
$isApplied = function($file) use ($appliedFiles){
foreach ($appliedFiles as $appliedFile) {
if ($appliedFile->getFileName() === $file->getFileName()){
return true;
}
}
return false;
};
$statuses = [];
foreach($files as $file){
$appliedAt = $isApplied($file)? date('Y-m-d H:i:s', $file->getMTime()): "";
$statuses[] = new Status($appliedAt, $file);
}
return $statuses;
} | [
"public",
"function",
"getStatuses",
"(",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"getSqlFiles",
"(",
")",
";",
"$",
"appliedFiles",
"=",
"$",
"this",
"->",
"getAppliedFiles",
"(",
")",
";",
"/**\n * is file applied or not\n * @param $file\... | get migration status
@return array Statuses with applied datetime and file name | [
"get",
"migration",
"status"
] | 8663e5342a096c739d70236a49bb981634023534 | https://github.com/brtriver/dbup/blob/8663e5342a096c739d70236a49bb981634023534/src/Dbup/Application.php#L182-L209 | train |
brtriver/dbup | src/Dbup/Application.php | Application.getUpCandidates | public function getUpCandidates()
{
$statuses = $this->getStatuses();
// search latest applied migration
$latest = '';
foreach ($statuses as $status) {
if ($status->appliedAt !== "") {
$latest = $status->file->getFileName();
}
}
// make statuses without being applied
$candidates = [];
$isSkipped = ($latest === '')? false: true;
foreach ($statuses as $status) {
if (false === $isSkipped) {
$candidates[] = $status;
}
if($status->file->getFileName() !== $latest) {
continue;
} else {
$isSkipped = false;
}
}
return $candidates;
} | php | public function getUpCandidates()
{
$statuses = $this->getStatuses();
// search latest applied migration
$latest = '';
foreach ($statuses as $status) {
if ($status->appliedAt !== "") {
$latest = $status->file->getFileName();
}
}
// make statuses without being applied
$candidates = [];
$isSkipped = ($latest === '')? false: true;
foreach ($statuses as $status) {
if (false === $isSkipped) {
$candidates[] = $status;
}
if($status->file->getFileName() !== $latest) {
continue;
} else {
$isSkipped = false;
}
}
return $candidates;
} | [
"public",
"function",
"getUpCandidates",
"(",
")",
"{",
"$",
"statuses",
"=",
"$",
"this",
"->",
"getStatuses",
"(",
")",
";",
"// search latest applied migration",
"$",
"latest",
"=",
"''",
";",
"foreach",
"(",
"$",
"statuses",
"as",
"$",
"status",
")",
"... | get up candidates sql files | [
"get",
"up",
"candidates",
"sql",
"files"
] | 8663e5342a096c739d70236a49bb981634023534 | https://github.com/brtriver/dbup/blob/8663e5342a096c739d70236a49bb981634023534/src/Dbup/Application.php#L214-L241 | train |
brtriver/dbup | src/Dbup/Application.php | Application.copyToAppliedDir | public function copyToAppliedDir($file)
{
if (false === @copy($file->getPathName(), $this->appliedFilesDir . '/' . $file->getFileName())) {
throw new RuntimeException('cannot copy the sql file to applied directory. check the <info>'. $this->appliedFilesDir . '</info> directory.');
}
} | php | public function copyToAppliedDir($file)
{
if (false === @copy($file->getPathName(), $this->appliedFilesDir . '/' . $file->getFileName())) {
throw new RuntimeException('cannot copy the sql file to applied directory. check the <info>'. $this->appliedFilesDir . '</info> directory.');
}
} | [
"public",
"function",
"copyToAppliedDir",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"false",
"===",
"@",
"copy",
"(",
"$",
"file",
"->",
"getPathName",
"(",
")",
",",
"$",
"this",
"->",
"appliedFilesDir",
".",
"'/'",
".",
"$",
"file",
"->",
"getFileName",... | copy applied sql file to the applied directory.
@param SplFileInfo $file | [
"copy",
"applied",
"sql",
"file",
"to",
"the",
"applied",
"directory",
"."
] | 8663e5342a096c739d70236a49bb981634023534 | https://github.com/brtriver/dbup/blob/8663e5342a096c739d70236a49bb981634023534/src/Dbup/Application.php#L278-L283 | train |
nabu-3/core | nabu/data/icontact/CNabuIContact.php | CNabuIContact.getProspect | public function getProspect($nb_prospect)
{
$retval = false;
if (is_numeric($nb_prospect_id = nb_getMixedValue($nb_prospect, NABU_ICONTACT_PROSPECT_FIELD_ID))) {
$retval = $this->nb_icontact_prospect_list->getItem($nb_prospect_id);
}
return $retval;
} | php | public function getProspect($nb_prospect)
{
$retval = false;
if (is_numeric($nb_prospect_id = nb_getMixedValue($nb_prospect, NABU_ICONTACT_PROSPECT_FIELD_ID))) {
$retval = $this->nb_icontact_prospect_list->getItem($nb_prospect_id);
}
return $retval;
} | [
"public",
"function",
"getProspect",
"(",
"$",
"nb_prospect",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_prospect_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_prospect",
",",
"NABU_ICONTACT_PROSPECT_FIELD_ID",
")",
")",
"... | Get a Prospect by his Id.
@param mixed $nb_prospect A CNabuDataObject containing a field named nb_icontact_prospect_id or a valid Id.
@return CNabuIContactProspect|false Returns a valid instance if found or false if none exists. | [
"Get",
"a",
"Prospect",
"by",
"his",
"Id",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContact.php#L55-L64 | train |
nabu-3/core | nabu/data/icontact/CNabuIContact.php | CNabuIContact.getProspectsOfUser | public function getProspectsOfUser($nb_user, CNabuIContactProspectStatusType $nb_status_type = null) : CNabuIContactProspectList
{
$this->nb_icontact_prospect_list->clear();
$this->nb_icontact_prospect_list->merge(CNabuIContactProspect::getProspectsOfUser($this, $nb_user, $nb_status_type));
return $this->nb_icontact_prospect_list;
} | php | public function getProspectsOfUser($nb_user, CNabuIContactProspectStatusType $nb_status_type = null) : CNabuIContactProspectList
{
$this->nb_icontact_prospect_list->clear();
$this->nb_icontact_prospect_list->merge(CNabuIContactProspect::getProspectsOfUser($this, $nb_user, $nb_status_type));
return $this->nb_icontact_prospect_list;
} | [
"public",
"function",
"getProspectsOfUser",
"(",
"$",
"nb_user",
",",
"CNabuIContactProspectStatusType",
"$",
"nb_status_type",
"=",
"null",
")",
":",
"CNabuIContactProspectList",
"{",
"$",
"this",
"->",
"nb_icontact_prospect_list",
"->",
"clear",
"(",
")",
";",
"$"... | Get a list with all Prospects owned by a User.
@param mixed $nb_user A CNabuDataObject containing a field named nb_user_id or a valid Id.
@param CNabuIContactProspectStatusType|null $nb_status_type If setted, the list is filtered using this status.
@return CNabuIContactProspectList Returns a list instance with all types found. | [
"Get",
"a",
"list",
"with",
"all",
"Prospects",
"owned",
"by",
"a",
"User",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContact.php#L72-L78 | train |
nabu-3/core | nabu/data/icontact/CNabuIContact.php | CNabuIContact.getCountProspectsOfUser | public function getCountProspectsOfUser($nb_user, CNabuIContactProspectStatusType $nb_status_type = null) : int
{
return CNabuIContactProspect::getCountProspectsOfUser($this, $nb_user, $nb_status_type);
} | php | public function getCountProspectsOfUser($nb_user, CNabuIContactProspectStatusType $nb_status_type = null) : int
{
return CNabuIContactProspect::getCountProspectsOfUser($this, $nb_user, $nb_status_type);
} | [
"public",
"function",
"getCountProspectsOfUser",
"(",
"$",
"nb_user",
",",
"CNabuIContactProspectStatusType",
"$",
"nb_status_type",
"=",
"null",
")",
":",
"int",
"{",
"return",
"CNabuIContactProspect",
"::",
"getCountProspectsOfUser",
"(",
"$",
"this",
",",
"$",
"n... | Get the number of Prospects owned by a User.
@param mixed $nb_user A CNabuDataObject containing a field named nb_user_id or a valid Id.
@param CNabuIContactProspectStatusType|null $nb_status_type If setted, the list is filtered using this status.
@return int Returns the count of all types found. | [
"Get",
"the",
"number",
"of",
"Prospects",
"owned",
"by",
"a",
"User",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContact.php#L86-L89 | train |
nabu-3/core | nabu/data/icontact/CNabuIContact.php | CNabuIContact.getProspects | public function getProspects(CNabuIContactProspectStatusType $nb_status_type = null) : CNabuIContactProspectList
{
$this->nb_icontact_prospect_list->clear();
$this->nb_icontact_prospect_list->merge(CNabuIContactProspect::getProspectsForIContact($this, $nb_status_type));
return $this->nb_icontact_prospect_list;
} | php | public function getProspects(CNabuIContactProspectStatusType $nb_status_type = null) : CNabuIContactProspectList
{
$this->nb_icontact_prospect_list->clear();
$this->nb_icontact_prospect_list->merge(CNabuIContactProspect::getProspectsForIContact($this, $nb_status_type));
return $this->nb_icontact_prospect_list;
} | [
"public",
"function",
"getProspects",
"(",
"CNabuIContactProspectStatusType",
"$",
"nb_status_type",
"=",
"null",
")",
":",
"CNabuIContactProspectList",
"{",
"$",
"this",
"->",
"nb_icontact_prospect_list",
"->",
"clear",
"(",
")",
";",
"$",
"this",
"->",
"nb_icontac... | Get all prospects of an IContact.
@param CNabuIContactProspectStatusType|null $nb_status_type If setted, the list is filtered using this status.
@return CNabuIContactProspectList Returns a list instance with all types found. | [
"Get",
"all",
"prospects",
"of",
"an",
"IContact",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContact.php#L96-L102 | train |
nabu-3/core | nabu/data/icontact/CNabuIContact.php | CNabuIContact.getProspectStatusTypes | public function getProspectStatusTypes(bool $force = false) : CNabuIContactProspectStatusTypeList
{
if ($this->nb_icontact_prospect_status_type_list->isEmpty() || $force) {
$this->nb_icontact_prospect_status_type_list->clear();
$this->nb_icontact_prospect_status_type_list->merge(CNabuIContactProspectStatusType::getTypesForIContact($this));
}
return $this->nb_icontact_prospect_status_type_list;
} | php | public function getProspectStatusTypes(bool $force = false) : CNabuIContactProspectStatusTypeList
{
if ($this->nb_icontact_prospect_status_type_list->isEmpty() || $force) {
$this->nb_icontact_prospect_status_type_list->clear();
$this->nb_icontact_prospect_status_type_list->merge(CNabuIContactProspectStatusType::getTypesForIContact($this));
}
return $this->nb_icontact_prospect_status_type_list;
} | [
"public",
"function",
"getProspectStatusTypes",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuIContactProspectStatusTypeList",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_icontact_prospect_status_type_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")"... | Get Prospect Status Types of this instance.
@param bool $force If true then force to reload complete list from database storage.
@return CNabuIContactProspectStatusTypeList Returns a list instance with all types found. | [
"Get",
"Prospect",
"Status",
"Types",
"of",
"this",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContact.php#L108-L116 | train |
nabu-3/core | nabu/data/icontact/CNabuIContact.php | CNabuIContact.getProspectStatusType | public function getProspectStatusType($nb_type)
{
$retval = false;
if (is_numeric($nb_type_id = nb_getMixedValue($nb_type, 'nb_icontact_prospect_status_type_id'))) {
$retval = $this->nb_icontact_prospect_status_type_list->getItem($nb_type_id);
}
return $retval;
} | php | public function getProspectStatusType($nb_type)
{
$retval = false;
if (is_numeric($nb_type_id = nb_getMixedValue($nb_type, 'nb_icontact_prospect_status_type_id'))) {
$retval = $this->nb_icontact_prospect_status_type_list->getItem($nb_type_id);
}
return $retval;
} | [
"public",
"function",
"getProspectStatusType",
"(",
"$",
"nb_type",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_type_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_type",
",",
"'nb_icontact_prospect_status_type_id'",
")",
")",... | Get a specific Prospect Status Type of this instance.
@param mixed $nb_type A CNabuDataObject containing a field named nb_icontact_prospect_status_type_id or a valid Id.
@return CNabuIContactProspectStatusType|false Returns the status type instance if exists or false if not. | [
"Get",
"a",
"specific",
"Prospect",
"Status",
"Type",
"of",
"this",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContact.php#L123-L132 | train |
nabu-3/core | nabu/data/icontact/CNabuIContact.php | CNabuIContact.getProspectStatusTypeByKey | public function getProspectStatusTypeByKey(string $key)
{
$retval = false;
if (is_string($key)) {
$this->getProspectStatusTypes();
$retval = $this->nb_icontact_prospect_status_type_list->getItem($key, CNabuIContactProspectStatusTypeList::INDEX_KEY);
}
return $retval;
} | php | public function getProspectStatusTypeByKey(string $key)
{
$retval = false;
if (is_string($key)) {
$this->getProspectStatusTypes();
$retval = $this->nb_icontact_prospect_status_type_list->getItem($key, CNabuIContactProspectStatusTypeList::INDEX_KEY);
}
return $retval;
} | [
"public",
"function",
"getProspectStatusTypeByKey",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"getProspectStatusTypes",
"(",
")",
";",
"$",
"retval",
... | Get a specific Prospect Status Type of this instance identified by his key.
@param string $key A key to looking for.
@return CNabuIContactProspectStatusType|false Returns the status type instance if exists or false if not. | [
"Get",
"a",
"specific",
"Prospect",
"Status",
"Type",
"of",
"this",
"instance",
"identified",
"by",
"his",
"key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContact.php#L139-L149 | train |
nabu-3/core | nabu/data/icontact/CNabuIContact.php | CNabuIContact.refresh | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) &&
(!$cascade || (
$this->getProspectStatusTypes($force)
))
;
} | php | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) &&
(!$cascade || (
$this->getProspectStatusTypes($force)
))
;
} | [
"public",
"function",
"refresh",
"(",
"bool",
"$",
"force",
"=",
"false",
",",
"bool",
"$",
"cascade",
"=",
"false",
")",
":",
"bool",
"{",
"return",
"parent",
"::",
"refresh",
"(",
"$",
"force",
",",
"$",
"cascade",
")",
"&&",
"(",
"!",
"$",
"casc... | Overrides refresh method to allow iContact subentities to be refreshed.
@param bool $force Forces to reload entities from the database storage.
@param bool $cascade Forces to reload child entities from the database storage.
@return bool Returns true if transations are empty or refreshed. | [
"Overrides",
"refresh",
"method",
"to",
"allow",
"iContact",
"subentities",
"to",
"be",
"refreshed",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContact.php#L167-L174 | train |
nabu-3/core | nabu/data/icontact/CNabuIContact.php | CNabuIContact.grantStorageFolder | public function grantStorageFolder(bool $save = true)
{
$base_path = $this->getBasePath();
if (!is_string($base_path) || strlen($base_path) === 0 || !file_exists($base_path)) {
$hash = mb_strtolower(str_replace(array('{', '}'), '', $this->grantHash()));
$base_path = NABU_ICONTACT_PATH . DIRECTORY_SEPARATOR . $hash;
if (!file_exists($base_path) && (!mkdir($base_path) || !file_exists($base_path))) {
throw new ENabuIContactException(
ENabuIContactException::ERROR_MAIN_PATH_CANNOT_BE_CREATED,
array($base_path)
);
}
$this->setBasePath($base_path);
if ($save) $this->save();
}
} | php | public function grantStorageFolder(bool $save = true)
{
$base_path = $this->getBasePath();
if (!is_string($base_path) || strlen($base_path) === 0 || !file_exists($base_path)) {
$hash = mb_strtolower(str_replace(array('{', '}'), '', $this->grantHash()));
$base_path = NABU_ICONTACT_PATH . DIRECTORY_SEPARATOR . $hash;
if (!file_exists($base_path) && (!mkdir($base_path) || !file_exists($base_path))) {
throw new ENabuIContactException(
ENabuIContactException::ERROR_MAIN_PATH_CANNOT_BE_CREATED,
array($base_path)
);
}
$this->setBasePath($base_path);
if ($save) $this->save();
}
} | [
"public",
"function",
"grantStorageFolder",
"(",
"bool",
"$",
"save",
"=",
"true",
")",
"{",
"$",
"base_path",
"=",
"$",
"this",
"->",
"getBasePath",
"(",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"base_path",
")",
"||",
"strlen",
"(",
"$",
"b... | Check if the main storage folder for this IContact exists and if not, then create it.
@param bool $save If true, applies now the changes to instance in the database storage.
@throws ENabuIContactException Raises an exception if the folder cannot be created. | [
"Check",
"if",
"the",
"main",
"storage",
"folder",
"for",
"this",
"IContact",
"exists",
"and",
"if",
"not",
"then",
"create",
"it",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContact.php#L191-L207 | train |
orchestral/lumen | src/Routing/Router.php | Router.parseAction | protected function parseAction($action)
{
if (\is_string($action)) {
return ['uses' => $action];
} elseif (! \is_array($action)) {
return [$action];
}
if (isset($action['middleware']) && \is_string($action['middleware'])) {
$action['middleware'] = \explode('|', $action['middleware']);
}
return $action;
} | php | protected function parseAction($action)
{
if (\is_string($action)) {
return ['uses' => $action];
} elseif (! \is_array($action)) {
return [$action];
}
if (isset($action['middleware']) && \is_string($action['middleware'])) {
$action['middleware'] = \explode('|', $action['middleware']);
}
return $action;
} | [
"protected",
"function",
"parseAction",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"action",
")",
")",
"{",
"return",
"[",
"'uses'",
"=>",
"$",
"action",
"]",
";",
"}",
"elseif",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"act... | Parse the action into an array format.
@param mixed $action
@return array | [
"Parse",
"the",
"action",
"into",
"an",
"array",
"format",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Routing/Router.php#L216-L229 | train |
rips/php-connector-bundle | Hydrators/System/LdapHydrator.php | LdapHydrator.hydrateCollection | public static function hydrateCollection(array $ldaps)
{
$hydrated = [];
foreach ($ldaps as $ldap) {
$hydrated[] = self::hydrate($ldap);
}
return $hydrated;
} | php | public static function hydrateCollection(array $ldaps)
{
$hydrated = [];
foreach ($ldaps as $ldap) {
$hydrated[] = self::hydrate($ldap);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"ldaps",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"ldaps",
"as",
"$",
"ldap",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"(",
... | Hydrate a collection of ldap objects into a collection of
LdapEntity objects
@param stdClass[] $ldaps
@return LdapEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"ldap",
"objects",
"into",
"a",
"collection",
"of",
"LdapEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/System/LdapHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/System/LdapHydrator.php | LdapHydrator.hydrate | public static function hydrate(stdClass $ldap)
{
$hydrated = new LdapEntity();
if (isset($ldap->id)) {
$hydrated->setId($ldap->id);
}
if (isset($ldap->enabled)) {
$hydrated->setEnabled($ldap->enabled);
}
if (isset($ldap->search_dn)) {
$hydrated->setSearchDn($ldap->search_dn);
}
if (isset($ldap->search_password)) {
$hydrated->setSearchPassword($ldap->search_password);
}
if (isset($ldap->search_query)) {
$hydrated->setSearchQuery($ldap->search_query);
}
if (isset($ldap->base_dn)) {
$hydrated->setBaseDn($ldap->base_dn);
}
if (isset($ldap->email_key)) {
$hydrated->setEmailKey($ldap->email_key);
}
if (isset($ldap->user_dn)) {
$hydrated->setUserDn($ldap->user_dn);
}
if (isset($ldap->host)) {
$hydrated->setHost($ldap->host);
}
if (isset($ldap->port)) {
$hydrated->setPort($ldap->port);
}
if (isset($ldap->encryption)) {
$hydrated->setEncryption($ldap->encryption);
}
if (isset($ldap->protocol_version)) {
$hydrated->setProtocolVersion($ldap->protocol_version);
}
if (isset($ldap->expired_accounts)) {
$hydrated->setExpiredAccounts($ldap->expired_accounts);
}
if (isset($ldap->last_sync_at)) {
$hydrated->setLastSyncAt(new DateTime($ldap->last_sync_at));
}
return $hydrated;
} | php | public static function hydrate(stdClass $ldap)
{
$hydrated = new LdapEntity();
if (isset($ldap->id)) {
$hydrated->setId($ldap->id);
}
if (isset($ldap->enabled)) {
$hydrated->setEnabled($ldap->enabled);
}
if (isset($ldap->search_dn)) {
$hydrated->setSearchDn($ldap->search_dn);
}
if (isset($ldap->search_password)) {
$hydrated->setSearchPassword($ldap->search_password);
}
if (isset($ldap->search_query)) {
$hydrated->setSearchQuery($ldap->search_query);
}
if (isset($ldap->base_dn)) {
$hydrated->setBaseDn($ldap->base_dn);
}
if (isset($ldap->email_key)) {
$hydrated->setEmailKey($ldap->email_key);
}
if (isset($ldap->user_dn)) {
$hydrated->setUserDn($ldap->user_dn);
}
if (isset($ldap->host)) {
$hydrated->setHost($ldap->host);
}
if (isset($ldap->port)) {
$hydrated->setPort($ldap->port);
}
if (isset($ldap->encryption)) {
$hydrated->setEncryption($ldap->encryption);
}
if (isset($ldap->protocol_version)) {
$hydrated->setProtocolVersion($ldap->protocol_version);
}
if (isset($ldap->expired_accounts)) {
$hydrated->setExpiredAccounts($ldap->expired_accounts);
}
if (isset($ldap->last_sync_at)) {
$hydrated->setLastSyncAt(new DateTime($ldap->last_sync_at));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"ldap",
")",
"{",
"$",
"hydrated",
"=",
"new",
"LdapEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"ldap",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$",
... | Hydrate a ldap object into a LdapEntity object
@param stdClass $ldap
@return LdapEntity | [
"Hydrate",
"a",
"ldap",
"object",
"into",
"a",
"LdapEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/System/LdapHydrator.php#L35-L96 | train |
xtlsoft/NonDB | src/Drivers/LocalDriver.php | LocalDriver.getData | public function getData(string $table, $name = ""){
$file = $this->base . '/' . $table . '.json';
if(file_exists($file)){
return json_decode(file_get_contents($file), true);
}else{
throw new \NonDB\Exceptions\DriverException('Table Not Exists.', 1002);
}
} | php | public function getData(string $table, $name = ""){
$file = $this->base . '/' . $table . '.json';
if(file_exists($file)){
return json_decode(file_get_contents($file), true);
}else{
throw new \NonDB\Exceptions\DriverException('Table Not Exists.', 1002);
}
} | [
"public",
"function",
"getData",
"(",
"string",
"$",
"table",
",",
"$",
"name",
"=",
"\"\"",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"base",
".",
"'/'",
".",
"$",
"table",
".",
"'.json'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")... | Get a table's data
@param string $table
@param mixed $name = ""
@throws \NonDB\Exceptions\DriverException
@return mixed | [
"Get",
"a",
"table",
"s",
"data"
] | 6599c13bb5feabe77d91764fdf3c24b786c777b2 | https://github.com/xtlsoft/NonDB/blob/6599c13bb5feabe77d91764fdf3c24b786c777b2/src/Drivers/LocalDriver.php#L54-L63 | train |
xtlsoft/NonDB | src/Drivers/LocalDriver.php | LocalDriver.setData | public function setData(string $table, $data){
$file = $this->base . '/' . $table . '.json';
if(file_exists($file)){
if(file_put_contents($file, json_encode($data))){
$status = true;
}else{
$status = false;
}
return new \NonDB\Components\Status($status);
}else{
throw new \NonDB\Exceptions\DriverException('Table Not Exists.', 1002);
}
} | php | public function setData(string $table, $data){
$file = $this->base . '/' . $table . '.json';
if(file_exists($file)){
if(file_put_contents($file, json_encode($data))){
$status = true;
}else{
$status = false;
}
return new \NonDB\Components\Status($status);
}else{
throw new \NonDB\Exceptions\DriverException('Table Not Exists.', 1002);
}
} | [
"public",
"function",
"setData",
"(",
"string",
"$",
"table",
",",
"$",
"data",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"base",
".",
"'/'",
".",
"$",
"table",
".",
"'.json'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
... | Set a table's data
@param string $table
@param mixed[] $data
@throws \NonDB\Exceptions\DriverException
@return \NonDB\Components\Status | [
"Set",
"a",
"table",
"s",
"data"
] | 6599c13bb5feabe77d91764fdf3c24b786c777b2 | https://github.com/xtlsoft/NonDB/blob/6599c13bb5feabe77d91764fdf3c24b786c777b2/src/Drivers/LocalDriver.php#L75-L89 | train |
xtlsoft/NonDB | src/Drivers/LocalDriver.php | LocalDriver.newTable | public function newTable(string $name){
$status = file_put_contents($file = $this->base . '/' . $name . '.json', "[]");
return new \NonDB\Components\Status($status);
} | php | public function newTable(string $name){
$status = file_put_contents($file = $this->base . '/' . $name . '.json', "[]");
return new \NonDB\Components\Status($status);
} | [
"public",
"function",
"newTable",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"status",
"=",
"file_put_contents",
"(",
"$",
"file",
"=",
"$",
"this",
"->",
"base",
".",
"'/'",
".",
"$",
"name",
".",
"'.json'",
",",
"\"[]\"",
")",
";",
"return",
"new",... | Add a table
@param string $name
@throws \NonDB\Exceptions\DriverException
@return \NonDB\Components\Status | [
"Add",
"a",
"table"
] | 6599c13bb5feabe77d91764fdf3c24b786c777b2 | https://github.com/xtlsoft/NonDB/blob/6599c13bb5feabe77d91764fdf3c24b786c777b2/src/Drivers/LocalDriver.php#L100-L106 | train |
xtlsoft/NonDB | src/Drivers/LocalDriver.php | LocalDriver.removeTable | public function removeTable(string $name){
$status = unlink($file = $this->base . '/' . $name . '.json');
return new \NonDB\Components\Status($status);
} | php | public function removeTable(string $name){
$status = unlink($file = $this->base . '/' . $name . '.json');
return new \NonDB\Components\Status($status);
} | [
"public",
"function",
"removeTable",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"status",
"=",
"unlink",
"(",
"$",
"file",
"=",
"$",
"this",
"->",
"base",
".",
"'/'",
".",
"$",
"name",
".",
"'.json'",
")",
";",
"return",
"new",
"\\",
"NonDB",
"\\",... | Remove a table
@param string $name
@throws \NonDB\Exceptions\DriverException
@return \NonDB\Components\Status | [
"Remove",
"a",
"table"
] | 6599c13bb5feabe77d91764fdf3c24b786c777b2 | https://github.com/xtlsoft/NonDB/blob/6599c13bb5feabe77d91764fdf3c24b786c777b2/src/Drivers/LocalDriver.php#L117-L123 | train |
rips/php-connector-bundle | Services/APIService.php | APIService.initialize | public function initialize($email, $password, $config)
{
$this->api = new API($email, $password, $config);
} | php | public function initialize($email, $password, $config)
{
$this->api = new API($email, $password, $config);
} | [
"public",
"function",
"initialize",
"(",
"$",
"email",
",",
"$",
"password",
",",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"api",
"=",
"new",
"API",
"(",
"$",
"email",
",",
"$",
"password",
",",
"$",
"config",
")",
";",
"}"
] | Initialize API instance
@param $email
@param $password
@param $config
@return void
@throws Exception | [
"Initialize",
"API",
"instance"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/APIService.php#L38-L41 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/ProcessHydrator.php | ProcessHydrator.hydrateCollection | public static function hydrateCollection(array $processes)
{
$hydrated = [];
foreach ($processes as $process) {
$hydrated[] = self::hydrate($process);
}
return $hydrated;
} | php | public static function hydrateCollection(array $processes)
{
$hydrated = [];
foreach ($processes as $process) {
$hydrated[] = self::hydrate($process);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"processes",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"processes",
"as",
"$",
"process",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate... | Hydrate a collection of process objects into a collection of
ProcessEntity objects
@param stdClass[] $processes
@return ProcessEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"process",
"objects",
"into",
"a",
"collection",
"of",
"ProcessEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/ProcessHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/ProcessHydrator.php | ProcessHydrator.hydrate | public static function hydrate(stdClass $process)
{
$hydrated = new ProcessEntity();
if (isset($process->id)) {
$hydrated->setId($process->id);
}
if (isset($process->pid)) {
$hydrated->setPid($process->pid);
}
if (isset($process->version)) {
$hydrated->setVersion($process->version);
}
if (isset($process->name)) {
$hydrated->setName($process->name);
}
if (isset($process->started_at)) {
$hydrated->setStartedAt(new DateTime($process->started_at));
}
if (isset($process->finished_at)) {
$hydrated->setFinishedAt(new DateTime($process->finished_at));
}
if (isset($process->finished)) {
$hydrated->setFinished($process->finished);
}
if (isset($process->memory)) {
$hydrated->setMemory($process->memory);
}
if (isset($process->phase)) {
$hydrated->setPhase($process->phase);
}
if (isset($process->percent)) {
$hydrated->setPercent($process->percent);
}
if (isset($process->weight)) {
$hydrated->setWeight($process->weight);
}
return $hydrated;
} | php | public static function hydrate(stdClass $process)
{
$hydrated = new ProcessEntity();
if (isset($process->id)) {
$hydrated->setId($process->id);
}
if (isset($process->pid)) {
$hydrated->setPid($process->pid);
}
if (isset($process->version)) {
$hydrated->setVersion($process->version);
}
if (isset($process->name)) {
$hydrated->setName($process->name);
}
if (isset($process->started_at)) {
$hydrated->setStartedAt(new DateTime($process->started_at));
}
if (isset($process->finished_at)) {
$hydrated->setFinishedAt(new DateTime($process->finished_at));
}
if (isset($process->finished)) {
$hydrated->setFinished($process->finished);
}
if (isset($process->memory)) {
$hydrated->setMemory($process->memory);
}
if (isset($process->phase)) {
$hydrated->setPhase($process->phase);
}
if (isset($process->percent)) {
$hydrated->setPercent($process->percent);
}
if (isset($process->weight)) {
$hydrated->setWeight($process->weight);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"process",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ProcessEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"process",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"("... | Hydrate a process object into a ProcessEntity object
@param stdClass $process
@return ProcessEntity | [
"Hydrate",
"a",
"process",
"object",
"into",
"a",
"ProcessEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/ProcessHydrator.php#L35-L84 | train |
rips/php-connector-bundle | Hydrators/Application/Profile/ExtensionHydrator.php | ExtensionHydrator.hydrateCollection | public static function hydrateCollection(array $extensions)
{
$hydrated = [];
foreach ($extensions as $extension) {
$hydrated[] = self::hydrate($extension);
}
return $hydrated;
} | php | public static function hydrateCollection(array $extensions)
{
$hydrated = [];
foreach ($extensions as $extension) {
$hydrated[] = self::hydrate($extension);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"extensions",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"extensions",
"as",
"$",
"extension",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hyd... | Hydrate a collection of extension objects into a collection of
ExtensionEntity objects
@param stdClass[] $extensions
@return ExtensionEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"extension",
"objects",
"into",
"a",
"collection",
"of",
"ExtensionEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Profile/ExtensionHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Profile/ExtensionHydrator.php | ExtensionHydrator.hydrate | public static function hydrate(stdClass $extension)
{
$hydrated = new ExtensionEntity();
if (isset($extension->id)) {
$hydrated->setId($extension->id);
}
if (isset($extension->extension)) {
$hydrated->setExtension($extension->extension);
}
return $hydrated;
} | php | public static function hydrate(stdClass $extension)
{
$hydrated = new ExtensionEntity();
if (isset($extension->id)) {
$hydrated->setId($extension->id);
}
if (isset($extension->extension)) {
$hydrated->setExtension($extension->extension);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"extension",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ExtensionEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"extension",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",... | Hydrate a extension object into a ExtensionEntity object
@param stdClass $extension
@return ExtensionEntity | [
"Hydrate",
"a",
"extension",
"object",
"into",
"a",
"ExtensionEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Profile/ExtensionHydrator.php#L34-L47 | train |
rips/php-connector-bundle | Hydrators/QuotaHydrator.php | QuotaHydrator.hydrateCollection | public static function hydrateCollection(array $quotas)
{
$hydrated = [];
foreach ($quotas as $quota) {
$hydrated[] = self::hydrate($quota);
}
return $hydrated;
} | php | public static function hydrateCollection(array $quotas)
{
$hydrated = [];
foreach ($quotas as $quota) {
$hydrated[] = self::hydrate($quota);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"quotas",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"quotas",
"as",
"$",
"quota",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"("... | Hydrate a collection of of quota objects into a collection of
QuotaEntity objects
@param stdClass[] $quotas
@return QuotaEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"of",
"quota",
"objects",
"into",
"a",
"collection",
"of",
"QuotaEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/QuotaHydrator.php#L19-L28 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetSectionListBase.php | CNabuSiteTargetSectionListBase.createSecondaryIndexes | protected function createSecondaryIndexes()
{
$this->addIndex(
new CNabuDataObjectListIndex($this, 'nb_site_target_section_key', 'nb_site_target_section_order', self::INDEX_KEY)
);
$this->addIndex(
new CNabuDataObjectListIndex($this, 'nb_site_target_section_order', 'nb_site_target_section_order', self::INDEX_ORDER)
);
} | php | protected function createSecondaryIndexes()
{
$this->addIndex(
new CNabuDataObjectListIndex($this, 'nb_site_target_section_key', 'nb_site_target_section_order', self::INDEX_KEY)
);
$this->addIndex(
new CNabuDataObjectListIndex($this, 'nb_site_target_section_order', 'nb_site_target_section_order', self::INDEX_ORDER)
);
} | [
"protected",
"function",
"createSecondaryIndexes",
"(",
")",
"{",
"$",
"this",
"->",
"addIndex",
"(",
"new",
"CNabuDataObjectListIndex",
"(",
"$",
"this",
",",
"'nb_site_target_section_key'",
",",
"'nb_site_target_section_order'",
",",
"self",
"::",
"INDEX_KEY",
")",
... | Creates alternate indexes for this list. | [
"Creates",
"alternate",
"indexes",
"for",
"this",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetSectionListBase.php#L64-L72 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetSectionListBase.php | CNabuSiteTargetSectionListBase.acquireItem | public function acquireItem($key, $index = false)
{
$retval = false;
if ($index === false && CNabuEngine::getEngine()->isMainDBAvailable()) {
$item = new CNabuSiteTargetSection($key);
if ($item->isFetched()) {
$retval = $item;
}
}
return $retval;
} | php | public function acquireItem($key, $index = false)
{
$retval = false;
if ($index === false && CNabuEngine::getEngine()->isMainDBAvailable()) {
$item = new CNabuSiteTargetSection($key);
if ($item->isFetched()) {
$retval = $item;
}
}
return $retval;
} | [
"public",
"function",
"acquireItem",
"(",
"$",
"key",
",",
"$",
"index",
"=",
"false",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"$",
"index",
"===",
"false",
"&&",
"CNabuEngine",
"::",
"getEngine",
"(",
")",
"->",
"isMainDBAvailable",
"("... | Acquires an instance of class CNabuSiteTargetSection from the database.
@param string $key Id or reference field in the instance to acquire.
@param string $index Secondary index to be used if needed.
@return mixed Returns the unserialized instance if exists or false if not. | [
"Acquires",
"an",
"instance",
"of",
"class",
"CNabuSiteTargetSection",
"from",
"the",
"database",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetSectionListBase.php#L80-L92 | train |
nabu-3/core | nabu/data/messaging/base/CNabuMessagingBase.php | CNabuMessagingBase.getAllMessagings | public static function getAllMessagings(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_messaging_id',
'select * '
. 'from nb_messaging '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuMessagingList();
}
return $retval;
} | php | public static function getAllMessagings(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_messaging_id',
'select * '
. 'from nb_messaging '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuMessagingList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllMessagings",
"(",
"CNabuCustomer",
"$",
"nb_customer",
")",
"{",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
",",
"'nb_customer_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_customer_id",... | Get all items in the storage as an associative array where the field 'nb_messaging_id' is the index, and each
value is an instance of class CNabuMessagingBase.
@param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the Messaging List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_messaging_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuMessagingBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/base/CNabuMessagingBase.php#L180-L200 | train |
rips/php-connector-bundle | Services/Application/Scan/ProcessService.php | ProcessService.getAll | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->processes()
->getAll($appId, $scanId, $queryParams);
return new ProcessesResponse($response);
} | php | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->processes()
->getAll($appId, $scanId, $queryParams);
return new ProcessesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"proces... | Get all processes for a scan
@param int $appId
@param int $scanId
@param array $queryParams
@return ProcessesResponse | [
"Get",
"all",
"processes",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/ProcessService.php#L35-L44 | train |
rips/php-connector-bundle | Services/Application/Scan/ProcessService.php | ProcessService.getById | public function getById($appId, $scanId, $processId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->processes()
->getById($appId, $scanId, $processId, $queryParams);
return new ProcessResponse($response);
} | php | public function getById($appId, $scanId, $processId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->processes()
->getById($appId, $scanId, $processId, $queryParams);
return new ProcessResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"processId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
... | Get process for scan by id
@param int $appId
@param int $scanId
@param int $processId
@param array $queryParams
@return ProcessResponse | [
"Get",
"process",
"for",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/ProcessService.php#L55-L64 | train |
rips/php-connector-bundle | Services/Application/Scan/ProcessService.php | ProcessService.create | public function create($appId, $scanId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->processes()
->create($appId, $scanId, $input->toArray(), $queryParams);
return new ProcessResponse($response);
} | php | public function create($appId, $scanId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->processes()
->create($appId, $scanId, $input->toArray(), $queryParams);
return new ProcessResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",... | Create a process for a scan
@param int $appId
@param int $scanId
@param ProcessBuilder $input
@param array $queryParams
@return ProcessResponse | [
"Create",
"a",
"process",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/ProcessService.php#L75-L84 | train |
nabu-3/core | nabu/data/CNabuDataObjectList.php | CNabuDataObjectList.clear | public function clear()
{
$this->list = null;
if (is_array($this->secondary_indexes)) {
foreach ($this->secondary_indexes as $index) {
$index->clear();
}
}
} | php | public function clear()
{
$this->list = null;
if (is_array($this->secondary_indexes)) {
foreach ($this->secondary_indexes as $index) {
$index->clear();
}
}
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"this",
"->",
"list",
"=",
"null",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"secondary_indexes",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"secondary_indexes",
"as",
"$",
"index",
... | Empty the list and reset all indexes. | [
"Empty",
"the",
"list",
"and",
"reset",
"all",
"indexes",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectList.php#L163-L171 | train |
nabu-3/core | nabu/data/CNabuDataObjectList.php | CNabuDataObjectList.addIndex | public function addIndex(CNabuDataObjectListIndex $index)
{
$name = $index->getName();
if (is_array($this->secondary_indexes)) {
$this->secondary_indexes[$name] = $index;
} else {
$this->secondary_indexes = array($name => $index);
}
return $index;
} | php | public function addIndex(CNabuDataObjectListIndex $index)
{
$name = $index->getName();
if (is_array($this->secondary_indexes)) {
$this->secondary_indexes[$name] = $index;
} else {
$this->secondary_indexes = array($name => $index);
}
return $index;
} | [
"public",
"function",
"addIndex",
"(",
"CNabuDataObjectListIndex",
"$",
"index",
")",
"{",
"$",
"name",
"=",
"$",
"index",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"secondary_indexes",
")",
")",
"{",
"$",
"this",
"... | Adds a new index to have alternate indexes of this list.
@param CNabuDataObjectListIndex $index Instance to manage this index.
@return CNabuDataObjectListIndex Returns the $index added. | [
"Adds",
"a",
"new",
"index",
"to",
"have",
"alternate",
"indexes",
"of",
"this",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectList.php#L178-L189 | train |
nabu-3/core | nabu/data/CNabuDataObjectList.php | CNabuDataObjectList.getIndex | public function getIndex($index)
{
if (is_string($index) &&
is_array($this->secondary_indexes) &&
array_key_exists($index, $this->secondary_indexes)
) {
return $this->secondary_indexes[$index];
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_INVALID_INDEX, array(print_r($index, true)));
}
} | php | public function getIndex($index)
{
if (is_string($index) &&
is_array($this->secondary_indexes) &&
array_key_exists($index, $this->secondary_indexes)
) {
return $this->secondary_indexes[$index];
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_INVALID_INDEX, array(print_r($index, true)));
}
} | [
"public",
"function",
"getIndex",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"index",
")",
"&&",
"is_array",
"(",
"$",
"this",
"->",
"secondary_indexes",
")",
"&&",
"array_key_exists",
"(",
"$",
"index",
",",
"$",
"this",
"->",
"sec... | Gets a index instance of this list.
@param string $index Index indentifier to looking for.
@return CNabuDataObjectListIndex Returns the selected index if exists or null if not.
@throws ENabuCoreException Raises an exception if $index is not valid. | [
"Gets",
"a",
"index",
"instance",
"of",
"this",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectList.php#L197-L207 | train |
nabu-3/core | nabu/data/CNabuDataObjectList.php | CNabuDataObjectList.getKeys | public function getKeys($index = false)
{
$retval = null;
if ($index === false) {
$retval = is_array($this->list) ? array_keys($this->list) : null;
} elseif (is_string($index) &&
is_array($this->secondary_indexes) &&
array_key_exists($index, $this->secondary_indexes)
) {
$retval = $this->secondary_indexes[$index]->getKeys();
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_INVALID_INDEX, array(print_r($index, true)));
}
return $retval;
} | php | public function getKeys($index = false)
{
$retval = null;
if ($index === false) {
$retval = is_array($this->list) ? array_keys($this->list) : null;
} elseif (is_string($index) &&
is_array($this->secondary_indexes) &&
array_key_exists($index, $this->secondary_indexes)
) {
$retval = $this->secondary_indexes[$index]->getKeys();
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_INVALID_INDEX, array(print_r($index, true)));
}
return $retval;
} | [
"public",
"function",
"getKeys",
"(",
"$",
"index",
"=",
"false",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"if",
"(",
"$",
"index",
"===",
"false",
")",
"{",
"$",
"retval",
"=",
"is_array",
"(",
"$",
"this",
"->",
"list",
")",
"?",
"array_keys",
... | Gets keys of this index as an array.
@param string $index Alternate index to get keys.
@return array Returns the array of keys. | [
"Gets",
"keys",
"of",
"this",
"index",
"as",
"an",
"array",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectList.php#L214-L230 | train |
nabu-3/core | nabu/data/CNabuDataObjectList.php | CNabuDataObjectList.addItem | public function addItem(CNabuDataObject $item)
{
$retval = false;
if ($this->index_field !== false) {
if ($item->contains($this->index_field)) {
if (is_array($this->list)) {
$this->list[$item->getValue($this->index_field)] = $item;
$retval = $item;
} else {
$this->list = array(
$item->getValue($this->index_field) => $item
);
$retval = $item;
}
}
} else {
if (is_array($this->list)) {
$this->list[] = $item;
$retval = $item;
} else {
$this->list = array($item);
$retval = $item;
}
}
$this->indexItem($item);
return $retval;
} | php | public function addItem(CNabuDataObject $item)
{
$retval = false;
if ($this->index_field !== false) {
if ($item->contains($this->index_field)) {
if (is_array($this->list)) {
$this->list[$item->getValue($this->index_field)] = $item;
$retval = $item;
} else {
$this->list = array(
$item->getValue($this->index_field) => $item
);
$retval = $item;
}
}
} else {
if (is_array($this->list)) {
$this->list[] = $item;
$retval = $item;
} else {
$this->list = array($item);
$retval = $item;
}
}
$this->indexItem($item);
return $retval;
} | [
"public",
"function",
"addItem",
"(",
"CNabuDataObject",
"$",
"item",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"index_field",
"!==",
"false",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"contains",
"(",
"$",
"this",
"->",... | Adds a new item to the list.
@param CNabuDataObject $item Object item to be added.
@return CNabuDataObject Returns the inserted object or false if something happens. | [
"Adds",
"a",
"new",
"item",
"to",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectList.php#L237-L266 | train |
nabu-3/core | nabu/data/CNabuDataObjectList.php | CNabuDataObjectList.indexItem | protected function indexItem(CNabuDataObject $item)
{
if (is_array($this->secondary_indexes)) {
foreach ($this->secondary_indexes as $index) {
$index->addItem($item);
}
}
} | php | protected function indexItem(CNabuDataObject $item)
{
if (is_array($this->secondary_indexes)) {
foreach ($this->secondary_indexes as $index) {
$index->addItem($item);
}
}
} | [
"protected",
"function",
"indexItem",
"(",
"CNabuDataObject",
"$",
"item",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"secondary_indexes",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"secondary_indexes",
"as",
"$",
"index",
")",
"{",
... | Puts an item in all indexes.
@param CNabuDataObject $item Item to be indexed. | [
"Puts",
"an",
"item",
"in",
"all",
"indexes",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectList.php#L272-L279 | train |
nabu-3/core | nabu/data/CNabuDataObjectList.php | CNabuDataObjectList.removeItemIndex | protected function removeItemIndex(CNabuDataObject $item)
{
if (is_array($this->secondary_indexes)) {
foreach ($this->secondary_indexes as $index) {
$index->removeItem($item->getValue($this->index_field));
}
}
} | php | protected function removeItemIndex(CNabuDataObject $item)
{
if (is_array($this->secondary_indexes)) {
foreach ($this->secondary_indexes as $index) {
$index->removeItem($item->getValue($this->index_field));
}
}
} | [
"protected",
"function",
"removeItemIndex",
"(",
"CNabuDataObject",
"$",
"item",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"secondary_indexes",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"secondary_indexes",
"as",
"$",
"index",
")",
"... | Removes and item in all indexes.
@param CNabuDataObject $item Item to be removed. | [
"Removes",
"and",
"item",
"in",
"all",
"indexes",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectList.php#L285-L292 | train |
nabu-3/core | nabu/data/CNabuDataObjectList.php | CNabuDataObjectList.removeItem | public function removeItem($item)
{
$nb_index_id = nb_getMixedValue($item, $this->index_field);
if ((is_numeric($nb_index_id) || nb_isValidGUID($nb_index_id)) && $this->containsKey($nb_index_id)) {
unset($this->list[$nb_index_id]);
$this->removeItemIndex($item);
}
} | php | public function removeItem($item)
{
$nb_index_id = nb_getMixedValue($item, $this->index_field);
if ((is_numeric($nb_index_id) || nb_isValidGUID($nb_index_id)) && $this->containsKey($nb_index_id)) {
unset($this->list[$nb_index_id]);
$this->removeItemIndex($item);
}
} | [
"public",
"function",
"removeItem",
"(",
"$",
"item",
")",
"{",
"$",
"nb_index_id",
"=",
"nb_getMixedValue",
"(",
"$",
"item",
",",
"$",
"this",
"->",
"index_field",
")",
";",
"if",
"(",
"(",
"is_numeric",
"(",
"$",
"nb_index_id",
")",
"||",
"nb_isValidG... | Removes an item from the list.
@param mixed $item A CNabuDataObject containing a field matching the main index field name
or a scalar variable containing the Id to be removed.
@return CNabuDataObject|bool Returns the removed item if exists or false if not. | [
"Removes",
"an",
"item",
"from",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectList.php#L374-L381 | train |
nabu-3/core | nabu/data/CNabuDataObjectList.php | CNabuDataObjectList.mergeArray | public function mergeArray(array $array = null)
{
$count = 0;
if (is_array($array)) {
if (count($array) > 0) {
foreach ($array as $key => $item) {
if (!$this->containsKey($key)) {
$this->addItem($item);
$count++;
}
}
}
} elseif ($array !== null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_METHOD_PARAMETER_NOT_VALID,
array('$array', print_r($array, true))
);
}
return $count;
} | php | public function mergeArray(array $array = null)
{
$count = 0;
if (is_array($array)) {
if (count($array) > 0) {
foreach ($array as $key => $item) {
if (!$this->containsKey($key)) {
$this->addItem($item);
$count++;
}
}
}
} elseif ($array !== null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_METHOD_PARAMETER_NOT_VALID,
array('$array', print_r($array, true))
);
}
return $count;
} | [
"public",
"function",
"mergeArray",
"(",
"array",
"$",
"array",
"=",
"null",
")",
"{",
"$",
"count",
"=",
"0",
";",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"array",
")",
">",
"0",
")",
"{",
"foreac... | Merges items included in an array.
@param array|null $array Array of items to merge.
@return int Returns the count of items merged. | [
"Merges",
"items",
"included",
"in",
"an",
"array",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectList.php#L443-L464 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Core/MigrationCompiler.php | MigrationCompiler.compile | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, array $extensions, $extra = null)
{
// Add time to migration
$this->date->addSeconds(5);
if (File::exists(base_path('scaffolder-config/cache/migration_' . $hash . self::CACHE_EXT)))
{
return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
}
else
{
$this->stub = $stub;
$this->replaceClassName($modelName)
->replaceTableName($scaffolderConfig, $modelName)
->addFields($modelData);
foreach ($extensions as $extension)
{
$this->stub = $extension->runAfterMigrationIsCompiled($this->stub, $modelData, $scaffolderConfig);
}
return $this->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
}
} | php | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, array $extensions, $extra = null)
{
// Add time to migration
$this->date->addSeconds(5);
if (File::exists(base_path('scaffolder-config/cache/migration_' . $hash . self::CACHE_EXT)))
{
return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
}
else
{
$this->stub = $stub;
$this->replaceClassName($modelName)
->replaceTableName($scaffolderConfig, $modelName)
->addFields($modelData);
foreach ($extensions as $extension)
{
$this->stub = $extension->runAfterMigrationIsCompiled($this->stub, $modelData, $scaffolderConfig);
}
return $this->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
}
} | [
"public",
"function",
"compile",
"(",
"$",
"stub",
",",
"$",
"modelName",
",",
"$",
"modelData",
",",
"stdClass",
"$",
"scaffolderConfig",
",",
"$",
"hash",
",",
"array",
"$",
"extensions",
",",
"$",
"extra",
"=",
"null",
")",
"{",
"// Add time to migratio... | Compiles a migration.
@param $stub
@param $modelName
@param $modelData
@param \stdClass $scaffolderConfig
@param $hash
@param \Scaffolder\Support\Contracts\ScaffolderExtensionInterface[] $extensions
@param null $extra
@return string | [
"Compiles",
"a",
"migration",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Core/MigrationCompiler.php#L41-L65 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Core/MigrationCompiler.php | MigrationCompiler.replaceTableName | private function replaceTableName(stdClass $scaffolderConfig, $modelName)
{
$tableName = isset($scaffolderConfig->tableName) && !empty($scaffolderConfig->tableName) ? $scaffolderConfig->tableName : $modelName . 's';
$this->stub = str_replace('{{table_name}}', strtolower($tableName), $this->stub);
return $this;
} | php | private function replaceTableName(stdClass $scaffolderConfig, $modelName)
{
$tableName = isset($scaffolderConfig->tableName) && !empty($scaffolderConfig->tableName) ? $scaffolderConfig->tableName : $modelName . 's';
$this->stub = str_replace('{{table_name}}', strtolower($tableName), $this->stub);
return $this;
} | [
"private",
"function",
"replaceTableName",
"(",
"stdClass",
"$",
"scaffolderConfig",
",",
"$",
"modelName",
")",
"{",
"$",
"tableName",
"=",
"isset",
"(",
"$",
"scaffolderConfig",
"->",
"tableName",
")",
"&&",
"!",
"empty",
"(",
"$",
"scaffolderConfig",
"->",
... | Replace the table name.
@param \stdClass $scaffolderConfig
@param $modelName
@return $this | [
"Replace",
"the",
"table",
"name",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Core/MigrationCompiler.php#L103-L110 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Core/MigrationCompiler.php | MigrationCompiler.addFields | private function addFields($modelData)
{
// Default primary key
$fields = $this->tab(3) . "\$table->increments('id');" . PHP_EOL . PHP_EOL;
// Check primary key
foreach ($modelData->fields as $field)
{
if ($field->index == 'primary')
{
$fields = '';
break;
}
}
foreach ($modelData->fields as $field)
{
$parsedModifiers = '';
// Check modifiers
if (!empty($field->modifiers))
{
$modifiersArray = explode(':', $field->modifiers);
foreach ($modifiersArray as $modifier)
{
$modifierAndValue = explode(',', $modifier);
if (count($modifierAndValue) == 2)
{
$parsedModifiers .= '->' . $modifierAndValue[0] . '(' . $modifierAndValue[1] . ')';
}
else
{
$parsedModifiers .= '->' . $modifierAndValue[0] . '()';
}
}
}
// Check indexes
if ($field->index != 'none')
{
$fields .= sprintf($this->tab(3) . "\$table->%s('%s')%s->%s();" . PHP_EOL, $field->type->db, $field->name, $parsedModifiers, $field->index);
}
else
{
$fields .= sprintf($this->tab(3) . "\$table->%s('%s')%s;" . PHP_EOL, $field->type->db, $field->name, $parsedModifiers);
}
// Check foreign key
if (!empty($field->foreignKey))
{
$foreignKey = explode(':', $field->foreignKey);
$fields .= sprintf($this->tab(3) . "\$table->foreign('%s')->references('%s')->on('%s');" . PHP_EOL . PHP_EOL, $field->name, $foreignKey[0], $foreignKey[1]);
}
}
$fields .= PHP_EOL . $this->tab(3) . "\$table->timestamps();" . PHP_EOL;
$this->stub = str_replace('{{fields}}', $fields, $this->stub);
return $this;
} | php | private function addFields($modelData)
{
// Default primary key
$fields = $this->tab(3) . "\$table->increments('id');" . PHP_EOL . PHP_EOL;
// Check primary key
foreach ($modelData->fields as $field)
{
if ($field->index == 'primary')
{
$fields = '';
break;
}
}
foreach ($modelData->fields as $field)
{
$parsedModifiers = '';
// Check modifiers
if (!empty($field->modifiers))
{
$modifiersArray = explode(':', $field->modifiers);
foreach ($modifiersArray as $modifier)
{
$modifierAndValue = explode(',', $modifier);
if (count($modifierAndValue) == 2)
{
$parsedModifiers .= '->' . $modifierAndValue[0] . '(' . $modifierAndValue[1] . ')';
}
else
{
$parsedModifiers .= '->' . $modifierAndValue[0] . '()';
}
}
}
// Check indexes
if ($field->index != 'none')
{
$fields .= sprintf($this->tab(3) . "\$table->%s('%s')%s->%s();" . PHP_EOL, $field->type->db, $field->name, $parsedModifiers, $field->index);
}
else
{
$fields .= sprintf($this->tab(3) . "\$table->%s('%s')%s;" . PHP_EOL, $field->type->db, $field->name, $parsedModifiers);
}
// Check foreign key
if (!empty($field->foreignKey))
{
$foreignKey = explode(':', $field->foreignKey);
$fields .= sprintf($this->tab(3) . "\$table->foreign('%s')->references('%s')->on('%s');" . PHP_EOL . PHP_EOL, $field->name, $foreignKey[0], $foreignKey[1]);
}
}
$fields .= PHP_EOL . $this->tab(3) . "\$table->timestamps();" . PHP_EOL;
$this->stub = str_replace('{{fields}}', $fields, $this->stub);
return $this;
} | [
"private",
"function",
"addFields",
"(",
"$",
"modelData",
")",
"{",
"// Default primary key",
"$",
"fields",
"=",
"$",
"this",
"->",
"tab",
"(",
"3",
")",
".",
"\"\\$table->increments('id');\"",
".",
"PHP_EOL",
".",
"PHP_EOL",
";",
"// Check primary key",
"fore... | Add fields.
@param $modelData
@return $this | [
"Add",
"fields",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Core/MigrationCompiler.php#L119-L181 | train |
nabu-3/core | nabu/data/catalog/CNabuCatalog.php | CNabuCatalog.getTaxonomies | public function getTaxonomies(bool $force = false)
{
if ($this->nb_catalog_taxonomy_list->isEmpty() || $force) {
$this->nb_catalog_taxonomy_list->clear();
$this->nb_catalog_taxonomy_list->merge(
CNabuCatalogTaxonomy::getAllCatalogTaxonomies($this)
);
}
return $this->nb_catalog_taxonomy_list;
} | php | public function getTaxonomies(bool $force = false)
{
if ($this->nb_catalog_taxonomy_list->isEmpty() || $force) {
$this->nb_catalog_taxonomy_list->clear();
$this->nb_catalog_taxonomy_list->merge(
CNabuCatalogTaxonomy::getAllCatalogTaxonomies($this)
);
}
return $this->nb_catalog_taxonomy_list;
} | [
"public",
"function",
"getTaxonomies",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_catalog_taxonomy_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_catalog_taxonomy_list",
"->"... | Gets all taxonomy instances of the Catalog.
@param bool $force If true, then reloads the list from the storage.
@return CNabuCatalogTaxonomyList Returns the list of taxonomy instances. | [
"Gets",
"all",
"taxonomy",
"instances",
"of",
"the",
"Catalog",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/CNabuCatalog.php#L331-L341 | train |
nabu-3/core | nabu/data/catalog/CNabuCatalog.php | CNabuCatalog.getTags | public function getTags(bool $force = false)
{
if ($this->nb_catalog_tag_list->isEmpty() || $force) {
$this->nb_catalog_tag_list->clear();
$this->nb_catalog_tag_list->merge(
CNabuCatalogTag::getAllCatalogTags($this)
);
}
return $this->nb_catalog_tag_list;
} | php | public function getTags(bool $force = false)
{
if ($this->nb_catalog_tag_list->isEmpty() || $force) {
$this->nb_catalog_tag_list->clear();
$this->nb_catalog_tag_list->merge(
CNabuCatalogTag::getAllCatalogTags($this)
);
}
return $this->nb_catalog_tag_list;
} | [
"public",
"function",
"getTags",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_catalog_tag_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_catalog_tag_list",
"->",
"clear",
"... | Gets all tag instances of the Catalog.
@param bool $force If true, then reloads the list from the storage.
@return CNabuCatalogTagList Returns the list of tag instances. | [
"Gets",
"all",
"tag",
"instances",
"of",
"the",
"Catalog",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/CNabuCatalog.php#L357-L367 | train |
nabu-3/core | nabu/xml/site/CNabuXMLSiteMap.php | CNabuXMLSiteMap.setTarget | private function setTarget(SimpleXMLElement $element)
{
$target = $element->addChild('target');
switch ($this->nb_data_object->getUseURI()) {
case 'T':
if (($nb_site = $this->nb_data_object->getSite()) instanceof CNabuSite &&
($nb_site_target = $nb_site->getTarget($this->nb_data_object->getSiteTargetId())) instanceof CNabuSiteTarget
) {
$target->addAttribute('useURI', 'T');
$target->addAttribute('target', $nb_site_target->getHash());
} else {
error_log("Target not exists");
}
break;
case 'U':
$translations = $this->nb_data_object->getTranslations();
$urls = array();
$translations->iterate(function ($lang, $nb_translation) use (&$urls) {
$urls[$lang] = array(
'url' => $nb_translation->getURL(),
'match' => $nb_translation->getMatchURLFragment()
);
return true;
});
if (count($urls) > 0) {
$target->addAttribute('useURI', 'U');
foreach ($urls as $lang => $url) {
if (strlen($url) > 0) {
$nb_language = $this->nb_data_object->getLanguage($lang);
$address = $target->addChild('url');
$address->addAttribute('lang', $nb_language->getHash());
$address->addAttribute('url', $url['url']);
$address->addAttribute('match', $url['match']);
}
}
}
break;
default:
}
} | php | private function setTarget(SimpleXMLElement $element)
{
$target = $element->addChild('target');
switch ($this->nb_data_object->getUseURI()) {
case 'T':
if (($nb_site = $this->nb_data_object->getSite()) instanceof CNabuSite &&
($nb_site_target = $nb_site->getTarget($this->nb_data_object->getSiteTargetId())) instanceof CNabuSiteTarget
) {
$target->addAttribute('useURI', 'T');
$target->addAttribute('target', $nb_site_target->getHash());
} else {
error_log("Target not exists");
}
break;
case 'U':
$translations = $this->nb_data_object->getTranslations();
$urls = array();
$translations->iterate(function ($lang, $nb_translation) use (&$urls) {
$urls[$lang] = array(
'url' => $nb_translation->getURL(),
'match' => $nb_translation->getMatchURLFragment()
);
return true;
});
if (count($urls) > 0) {
$target->addAttribute('useURI', 'U');
foreach ($urls as $lang => $url) {
if (strlen($url) > 0) {
$nb_language = $this->nb_data_object->getLanguage($lang);
$address = $target->addChild('url');
$address->addAttribute('lang', $nb_language->getHash());
$address->addAttribute('url', $url['url']);
$address->addAttribute('match', $url['match']);
}
}
}
break;
default:
}
} | [
"private",
"function",
"setTarget",
"(",
"SimpleXMLElement",
"$",
"element",
")",
"{",
"$",
"target",
"=",
"$",
"element",
"->",
"addChild",
"(",
"'target'",
")",
";",
"switch",
"(",
"$",
"this",
"->",
"nb_data_object",
"->",
"getUseURI",
"(",
")",
")",
... | Set the target branch.
@param SimpleXMLElement $element Parent element to anidate branch. | [
"Set",
"the",
"target",
"branch",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/CNabuXMLSiteMap.php#L52-L91 | train |
nabu-3/core | nabu/xml/site/CNabuXMLSiteMap.php | CNabuXMLSiteMap.setSecurity | private function setSecurity(SimpleXMLElement $element)
{
$security = $element->addChild('security');
$xml_roles = new CNabuXMLSiteMapRoleList($this->nb_data_object->getRoles());
$xml_roles->build($security);
} | php | private function setSecurity(SimpleXMLElement $element)
{
$security = $element->addChild('security');
$xml_roles = new CNabuXMLSiteMapRoleList($this->nb_data_object->getRoles());
$xml_roles->build($security);
} | [
"private",
"function",
"setSecurity",
"(",
"SimpleXMLElement",
"$",
"element",
")",
"{",
"$",
"security",
"=",
"$",
"element",
"->",
"addChild",
"(",
"'security'",
")",
";",
"$",
"xml_roles",
"=",
"new",
"CNabuXMLSiteMapRoleList",
"(",
"$",
"this",
"->",
"nb... | Set the security branch.
@param SimpleXMLElement $element Parent element to anidate branch. | [
"Set",
"the",
"security",
"branch",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/CNabuXMLSiteMap.php#L97-L103 | train |
nabu-3/core | nabu/xml/site/CNabuXMLSiteMap.php | CNabuXMLSiteMap.setMapChilds | private function setMapChilds(SimpleXMLElement $element)
{
$nb_map_list = $this->nb_data_object->getChilds();
if ($nb_map_list->getSize() > 0) {
$xml_childs = new CNabuXMLSiteMapList($nb_map_list);
$xml_childs->build($element);
}
} | php | private function setMapChilds(SimpleXMLElement $element)
{
$nb_map_list = $this->nb_data_object->getChilds();
if ($nb_map_list->getSize() > 0) {
$xml_childs = new CNabuXMLSiteMapList($nb_map_list);
$xml_childs->build($element);
}
} | [
"private",
"function",
"setMapChilds",
"(",
"SimpleXMLElement",
"$",
"element",
")",
"{",
"$",
"nb_map_list",
"=",
"$",
"this",
"->",
"nb_data_object",
"->",
"getChilds",
"(",
")",
";",
"if",
"(",
"$",
"nb_map_list",
"->",
"getSize",
"(",
")",
">",
"0",
... | Set the child maps of this node.
@param SimpleXMLElement $element Parent element to anidate branch. | [
"Set",
"the",
"child",
"maps",
"of",
"this",
"node",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/CNabuXMLSiteMap.php#L109-L116 | train |
xtlsoft/NonDB | src/Components/Tool.php | Tool.checkImplement | public static function checkImplement($class, string $interface){
$ref = new \ReflectionClass($class);
$names = $ref->getInterfaceNames();
if(in_array($interface, $names)){
return true;
}else{
return false;
}
} | php | public static function checkImplement($class, string $interface){
$ref = new \ReflectionClass($class);
$names = $ref->getInterfaceNames();
if(in_array($interface, $names)){
return true;
}else{
return false;
}
} | [
"public",
"static",
"function",
"checkImplement",
"(",
"$",
"class",
",",
"string",
"$",
"interface",
")",
"{",
"$",
"ref",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"$",
"names",
"=",
"$",
"ref",
"->",
"getInterfaceNames",
"(",
... | Check the class implement
@param mixed $class
@param string $interface
@return void | [
"Check",
"the",
"class",
"implement"
] | 6599c13bb5feabe77d91764fdf3c24b786c777b2 | https://github.com/xtlsoft/NonDB/blob/6599c13bb5feabe77d91764fdf3c24b786c777b2/src/Components/Tool.php#L29-L37 | train |
xtlsoft/NonDB | src/Components/Dump.php | Dump.arrayToXML | protected static function arrayToXML($data, &$xml = null){
if($xml === null)
$xml = new \SimpleXMLElement("<?xml version=\"1.0\"?><nondb></nondb>");
foreach($data as $k=>$v){
if(is_array($v)){
$sub = $xml->addChild("$k");
self::arrayToXML($v, $sub);
}else{
$xml->addChild("$k", htmlspecialchars("$v"));
}
}
return $xml->asXML();
} | php | protected static function arrayToXML($data, &$xml = null){
if($xml === null)
$xml = new \SimpleXMLElement("<?xml version=\"1.0\"?><nondb></nondb>");
foreach($data as $k=>$v){
if(is_array($v)){
$sub = $xml->addChild("$k");
self::arrayToXML($v, $sub);
}else{
$xml->addChild("$k", htmlspecialchars("$v"));
}
}
return $xml->asXML();
} | [
"protected",
"static",
"function",
"arrayToXML",
"(",
"$",
"data",
",",
"&",
"$",
"xml",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"xml",
"===",
"null",
")",
"$",
"xml",
"=",
"new",
"\\",
"SimpleXMLElement",
"(",
"\"<?xml version=\\\"1.0\\\"?><nondb></nondb>\""... | Turn array to XML
@param array $data
@param \SimpleXMLElement &$xml
@return string | [
"Turn",
"array",
"to",
"XML"
] | 6599c13bb5feabe77d91764fdf3c24b786c777b2 | https://github.com/xtlsoft/NonDB/blob/6599c13bb5feabe77d91764fdf3c24b786c777b2/src/Components/Dump.php#L70-L85 | train |
rips/php-connector-bundle | Hydrators/Application/ProfileHydrator.php | ProfileHydrator.hydrateCollection | public static function hydrateCollection(array $profiles)
{
$hydrated = [];
foreach ($profiles as $profile) {
$hydrated[] = self::hydrate($profile);
}
return $hydrated;
} | php | public static function hydrateCollection(array $profiles)
{
$hydrated = [];
foreach ($profiles as $profile) {
$hydrated[] = self::hydrate($profile);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"profiles",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"profiles",
"as",
"$",
"profile",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",... | Hydrate a collection of profile objects into a collection of
ProfileEntity objects
@param stdClass[] $profiles
@return ProfileEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"profile",
"objects",
"into",
"a",
"collection",
"of",
"ProfileEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/ProfileHydrator.php#L29-L38 | train |
rips/php-connector-bundle | Hydrators/Application/ProfileHydrator.php | ProfileHydrator.hydrate | public static function hydrate(stdClass $profile)
{
$hydrated = new ProfileEntity();
if (isset($profile->id)) {
$hydrated->setId($profile->id);
}
if (isset($profile->name)) {
$hydrated->setName($profile->name);
}
if (isset($profile->setting)) {
$hydrated->setSetting(SettingHydrator::hydrate($profile->setting));
}
if (isset($profile->controllers) && is_array($profile->controllers)) {
$hydrated->setControllers(ControllerHydrator::hydrateCollection($profile->controllers));
}
if (isset($profile->sources) && is_array($profile->sources)) {
$hydrated->setSources(SourceHydrator::hydrateCollection($profile->sources));
}
if (isset($profile->sinks) && is_array($profile->sinks)) {
$hydrated->setSinks(SinkHydrator::hydrateCollection($profile->sinks));
}
if (isset($profile->validators) && is_array($profile->validators)) {
$hydrated->setValidators(ValidatorHydrator::hydrateCollection($profile->validators));
}
if (isset($profile->sanitizers) && is_array($profile->sanitizers)) {
$hydrated->setSanitizers(SanitizerHydrator::hydrateCollection($profile->sanitizers));
}
if (isset($profile->ignored_codes) && is_array($profile->ignored_codes)) {
$hydrated->setIgnoredCodes(IgnoredCodeHydrator::hydrateCollection($profile->ignored_codes));
}
if (isset($profile->ignored_locations) && is_array($profile->ignored_locations)) {
$hydrated->setIgnoredLocations(IgnoredLocationHydrator::hydrateCollection($profile->ignored_locations));
}
if (isset($profile->extensions) && is_array($profile->extensions)) {
$hydrated->setExtensions(ExtensionHydrator::hydrateCollection($profile->extensions));
}
if (isset($profile->application)) {
$hydrated->setApplication(ApplicationHydrator::hydrate($profile->application));
}
if (isset($profile->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($profile->created_by));
}
if (isset($profile->default)) {
$hydrated->setDefault($profile->default);
}
return $hydrated;
} | php | public static function hydrate(stdClass $profile)
{
$hydrated = new ProfileEntity();
if (isset($profile->id)) {
$hydrated->setId($profile->id);
}
if (isset($profile->name)) {
$hydrated->setName($profile->name);
}
if (isset($profile->setting)) {
$hydrated->setSetting(SettingHydrator::hydrate($profile->setting));
}
if (isset($profile->controllers) && is_array($profile->controllers)) {
$hydrated->setControllers(ControllerHydrator::hydrateCollection($profile->controllers));
}
if (isset($profile->sources) && is_array($profile->sources)) {
$hydrated->setSources(SourceHydrator::hydrateCollection($profile->sources));
}
if (isset($profile->sinks) && is_array($profile->sinks)) {
$hydrated->setSinks(SinkHydrator::hydrateCollection($profile->sinks));
}
if (isset($profile->validators) && is_array($profile->validators)) {
$hydrated->setValidators(ValidatorHydrator::hydrateCollection($profile->validators));
}
if (isset($profile->sanitizers) && is_array($profile->sanitizers)) {
$hydrated->setSanitizers(SanitizerHydrator::hydrateCollection($profile->sanitizers));
}
if (isset($profile->ignored_codes) && is_array($profile->ignored_codes)) {
$hydrated->setIgnoredCodes(IgnoredCodeHydrator::hydrateCollection($profile->ignored_codes));
}
if (isset($profile->ignored_locations) && is_array($profile->ignored_locations)) {
$hydrated->setIgnoredLocations(IgnoredLocationHydrator::hydrateCollection($profile->ignored_locations));
}
if (isset($profile->extensions) && is_array($profile->extensions)) {
$hydrated->setExtensions(ExtensionHydrator::hydrateCollection($profile->extensions));
}
if (isset($profile->application)) {
$hydrated->setApplication(ApplicationHydrator::hydrate($profile->application));
}
if (isset($profile->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($profile->created_by));
}
if (isset($profile->default)) {
$hydrated->setDefault($profile->default);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"profile",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ProfileEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"profile",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"("... | Hydrate a profile object into a ProfileEntity object
@param stdClass $profile
@return ProfileEntity | [
"Hydrate",
"a",
"profile",
"object",
"into",
"a",
"ProfileEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/ProfileHydrator.php#L46-L107 | train |
php-xapi/model | src/Verb.php | Verb.equals | public function equals(Verb $verb): bool
{
if (!$this->id->equals($verb->id)) {
return false;
}
if (null === $this->display && null === $verb->display) {
return true;
}
if (null !== $this->display xor null !== $verb->display) {
return false;
}
if (count($this->display) !== count($verb->getDisplay())) {
return false;
}
foreach ($this->display as $language => $value) {
if (!isset($verb->display[$language])) {
return false;
}
if ($value !== $verb->display[$language]) {
return false;
}
}
return true;
} | php | public function equals(Verb $verb): bool
{
if (!$this->id->equals($verb->id)) {
return false;
}
if (null === $this->display && null === $verb->display) {
return true;
}
if (null !== $this->display xor null !== $verb->display) {
return false;
}
if (count($this->display) !== count($verb->getDisplay())) {
return false;
}
foreach ($this->display as $language => $value) {
if (!isset($verb->display[$language])) {
return false;
}
if ($value !== $verb->display[$language]) {
return false;
}
}
return true;
} | [
"public",
"function",
"equals",
"(",
"Verb",
"$",
"verb",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"id",
"->",
"equals",
"(",
"$",
"verb",
"->",
"id",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"null",
"===",
"$",
... | Checks if another verb is equal.
Two verbs are equal if and only if all of their properties are equal. | [
"Checks",
"if",
"another",
"verb",
"is",
"equal",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/Verb.php#L51-L80 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/JavaHydrator.php | JavaHydrator.hydrateCollection | public static function hydrateCollection(array $javas)
{
$hydrated = [];
foreach ($javas as $java) {
$hydrated[] = self::hydrate($java);
}
return $hydrated;
} | php | public static function hydrateCollection(array $javas)
{
$hydrated = [];
foreach ($javas as $java) {
$hydrated[] = self::hydrate($java);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"javas",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"javas",
"as",
"$",
"java",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"(",
... | Hydrate a collection of java objects into a collection of
JavaEntity objects
@param stdClass[] $javas
@return JavaEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"java",
"objects",
"into",
"a",
"collection",
"of",
"JavaEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/JavaHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/JavaHydrator.php | JavaHydrator.hydrate | public static function hydrate(stdClass $java)
{
$hydrated = new JavaEntity();
if (isset($java->id)) {
$hydrated->setId($java->id);
}
if (isset($java->major_version)) {
$hydrated->setMajorVersion($java->major_version);
}
if (isset($java->minor_version)) {
$hydrated->setMinorVersion($java->minor_version);
}
if (isset($java->release_version)) {
$hydrated->setReleaseVersion($java->release_version);
}
if (isset($java->implementation)) {
$hydrated->setImplementation($java->implementation);
}
if (isset($java->setting)) {
$hydrated->setSetting(SettingHydrator::hydrate($java->setting));
}
return $hydrated;
} | php | public static function hydrate(stdClass $java)
{
$hydrated = new JavaEntity();
if (isset($java->id)) {
$hydrated->setId($java->id);
}
if (isset($java->major_version)) {
$hydrated->setMajorVersion($java->major_version);
}
if (isset($java->minor_version)) {
$hydrated->setMinorVersion($java->minor_version);
}
if (isset($java->release_version)) {
$hydrated->setReleaseVersion($java->release_version);
}
if (isset($java->implementation)) {
$hydrated->setImplementation($java->implementation);
}
if (isset($java->setting)) {
$hydrated->setSetting(SettingHydrator::hydrate($java->setting));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"java",
")",
"{",
"$",
"hydrated",
"=",
"new",
"JavaEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"java",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$",
... | Hydrate a java object into a JavaEntity object
@param \stdClass $java
@return JavaEntity | [
"Hydrate",
"a",
"java",
"object",
"into",
"a",
"JavaEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/JavaHydrator.php#L35-L64 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.