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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
mikemirten/JsonApi | src/Document/Behaviour/IncludedResourcesContainer.php | IncludedResourcesContainer.includedResourcesToArray | protected function includedResourcesToArray(): array
{
$data = [];
foreach ($this->includedResources as $resource)
{
$data[] = $resource->toArray();
}
return $data;
} | php | protected function includedResourcesToArray(): array
{
$data = [];
foreach ($this->includedResources as $resource)
{
$data[] = $resource->toArray();
}
return $data;
} | [
"protected",
"function",
"includedResourcesToArray",
"(",
")",
":",
"array",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"includedResources",
"as",
"$",
"resource",
")",
"{",
"$",
"data",
"[",
"]",
"=",
"$",
"resource",
"->... | Cast included resources to an array
@return array | [
"Cast",
"included",
"resources",
"to",
"an",
"array"
] | a3c1baf8f753c040f24e4522495b7d34565e6560 | https://github.com/mikemirten/JsonApi/blob/a3c1baf8f753c040f24e4522495b7d34565e6560/src/Document/Behaviour/IncludedResourcesContainer.php#L60-L70 | train |
soosyze/framework | src/Components/Http/Stream.php | Stream.getContents | public function getContents()
{
$this->valideAttach()->valideRead();
if (($stream = stream_get_contents($this->stream)) === false) {
throw new \RuntimeException('An error occurred while reading the stream.');
}
return $stream;
} | php | public function getContents()
{
$this->valideAttach()->valideRead();
if (($stream = stream_get_contents($this->stream)) === false) {
throw new \RuntimeException('An error occurred while reading the stream.');
}
return $stream;
} | [
"public",
"function",
"getContents",
"(",
")",
"{",
"$",
"this",
"->",
"valideAttach",
"(",
")",
"->",
"valideRead",
"(",
")",
";",
"if",
"(",
"(",
"$",
"stream",
"=",
"stream_get_contents",
"(",
"$",
"this",
"->",
"stream",
")",
")",
"===",
"false",
... | Renvoie le contenu restant.
@throws \RuntimeException Une erreur c'est produit pendant la lecture du flux.
@return string | [
"Renvoie",
"le",
"contenu",
"restant",
"."
] | d8dec2155bf9bc1d8ded176b4b65c183e2082049 | https://github.com/soosyze/framework/blob/d8dec2155bf9bc1d8ded176b4b65c183e2082049/src/Components/Http/Stream.php#L328-L336 | train |
scherersoftware/cake-attachments | src/Model/Entity/Attachment.php | Attachment.toArray | public function toArray()
{
return [
'id' => $this->id,
'filename' => $this->filename,
'filetype' => $this->filetype,
'filesize' => $this->filesize,
'tags' => $this->tags,
'preview_url' => $this->previewUrl(),
'url' => $this->downloadUrl()
];
} | php | public function toArray()
{
return [
'id' => $this->id,
'filename' => $this->filename,
'filetype' => $this->filetype,
'filesize' => $this->filesize,
'tags' => $this->tags,
'preview_url' => $this->previewUrl(),
'url' => $this->downloadUrl()
];
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'filename'",
"=>",
"$",
"this",
"->",
"filename",
",",
"'filetype'",
"=>",
"$",
"this",
"->",
"filetype",
",",
"'filesize'",
"=>",
"$",
"this",
... | Array Representation, used for APIs
@return array | [
"Array",
"Representation",
"used",
"for",
"APIs"
] | 3571005fac399639d609e06a4b3cd445ee16d104 | https://github.com/scherersoftware/cake-attachments/blob/3571005fac399639d609e06a4b3cd445ee16d104/src/Model/Entity/Attachment.php#L117-L128 | train |
SplashSync/Php-Core | Router/Files.php | Files.detectFilePath | private static function detectFilePath($params)
{
if (isset($params->path) && !empty($params->path)) {
return $params->path;
}
if (isset($params->file) && !empty($params->file)) {
return $params->path;
}
return false;
} | php | private static function detectFilePath($params)
{
if (isset($params->path) && !empty($params->path)) {
return $params->path;
}
if (isset($params->file) && !empty($params->file)) {
return $params->path;
}
return false;
} | [
"private",
"static",
"function",
"detectFilePath",
"(",
"$",
"params",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"params",
"->",
"path",
")",
"&&",
"!",
"empty",
"(",
"$",
"params",
"->",
"path",
")",
")",
"{",
"return",
"$",
"params",
"->",
"path",
... | Detect File Path from Parameters.
@param ArrayObject $params
@return false|string | [
"Detect",
"File",
"Path",
"from",
"Parameters",
"."
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Router/Files.php#L139-L149 | train |
SplashSync/Php-Core | Models/Objects/ImagesTrait.php | ImagesTrait.images | public static function images()
{
// Helper Class Exists
if (isset(self::$ImagesHelper)) {
return self::$ImagesHelper;
}
// Initialize Class
self::$ImagesHelper = new ImagesHelper();
// Return Helper Class
return self::$ImagesHelper;
} | php | public static function images()
{
// Helper Class Exists
if (isset(self::$ImagesHelper)) {
return self::$ImagesHelper;
}
// Initialize Class
self::$ImagesHelper = new ImagesHelper();
// Return Helper Class
return self::$ImagesHelper;
} | [
"public",
"static",
"function",
"images",
"(",
")",
"{",
"// Helper Class Exists",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"ImagesHelper",
")",
")",
"{",
"return",
"self",
"::",
"$",
"ImagesHelper",
";",
"}",
"// Initialize Class",
"self",
"::",
"$",
"... | Get a singleton List Helper Class
@return ImagesHelper | [
"Get",
"a",
"singleton",
"List",
"Helper",
"Class"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Models/Objects/ImagesTrait.php#L37-L47 | train |
mikemirten/JsonApi | src/Mapper/Handler/DataTypeHandler/NativeTypesHandler.php | NativeTypesHandler.process | protected function process($value, string $type)
{
if ($type === 'integer') {
return (int) $value;
}
if ($type === 'float') {
return (float) $value;
}
if ($type === 'boolean') {
return (bool) $value;
}
return (string) $value;
} | php | protected function process($value, string $type)
{
if ($type === 'integer') {
return (int) $value;
}
if ($type === 'float') {
return (float) $value;
}
if ($type === 'boolean') {
return (bool) $value;
}
return (string) $value;
} | [
"protected",
"function",
"process",
"(",
"$",
"value",
",",
"string",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"'integer'",
")",
"{",
"return",
"(",
"int",
")",
"$",
"value",
";",
"}",
"if",
"(",
"$",
"type",
"===",
"'float'",
")",
"... | Process native type
@param mixed $value
@param string $type
@return mixed | [
"Process",
"native",
"type"
] | a3c1baf8f753c040f24e4522495b7d34565e6560 | https://github.com/mikemirten/JsonApi/blob/a3c1baf8f753c040f24e4522495b7d34565e6560/src/Mapper/Handler/DataTypeHandler/NativeTypesHandler.php#L36-L51 | train |
SplashSync/Php-Core | Client/Splash.php | Splash.commit | public static function commit($objectType, $local = null, $action = null, $user = '', $comment = '')
{
//====================================================================//
// Stack Trace
self::log()->trace();
//====================================================================//
// Verify this Object Class is Valid ==> No Action on this Node
if (false == Splash::object($objectType)) {
return true;
}
//====================================================================//
// Initiate Tasks parameters array
$params = self::getCommitParameters($objectType, $local, $action, $user, $comment);
//====================================================================//
// Add This Commit to Session Logs
static::$commited[] = $params;
//====================================================================//
// Verify this Object is Locked ==> No Action on this Node
if (!self::isCommitAllowed($objectType, $local, $action)) {
return true;
}
//====================================================================//
// Add Task to Ws Task List
Splash::ws()->addTask(
SPL_F_COMMIT,
$params,
Splash::trans('MsgSchRemoteCommit', (string) $action, $objectType, (string) Splash::count($local))
);
//====================================================================//
// Execute Task
$response = self::ws()->call(SPL_S_OBJECTS);
//====================================================================//
// Analyze NuSOAP results
return self::isCommitSuccess($response);
} | php | public static function commit($objectType, $local = null, $action = null, $user = '', $comment = '')
{
//====================================================================//
// Stack Trace
self::log()->trace();
//====================================================================//
// Verify this Object Class is Valid ==> No Action on this Node
if (false == Splash::object($objectType)) {
return true;
}
//====================================================================//
// Initiate Tasks parameters array
$params = self::getCommitParameters($objectType, $local, $action, $user, $comment);
//====================================================================//
// Add This Commit to Session Logs
static::$commited[] = $params;
//====================================================================//
// Verify this Object is Locked ==> No Action on this Node
if (!self::isCommitAllowed($objectType, $local, $action)) {
return true;
}
//====================================================================//
// Add Task to Ws Task List
Splash::ws()->addTask(
SPL_F_COMMIT,
$params,
Splash::trans('MsgSchRemoteCommit', (string) $action, $objectType, (string) Splash::count($local))
);
//====================================================================//
// Execute Task
$response = self::ws()->call(SPL_S_OBJECTS);
//====================================================================//
// Analyze NuSOAP results
return self::isCommitSuccess($response);
} | [
"public",
"static",
"function",
"commit",
"(",
"$",
"objectType",
",",
"$",
"local",
"=",
"null",
",",
"$",
"action",
"=",
"null",
",",
"$",
"user",
"=",
"''",
",",
"$",
"comment",
"=",
"''",
")",
"{",
"//=====================================================... | Submit an Update for a Local Object
@param string $objectType object Type Name
@param array|int|string $local object Local Id or Array of Local Id
@param string $action Action Type (SPL_A_UPDATE, or SPL_A_CREATE, or SPL_A_DELETE)
@param string $user User Name
@param string $comment Operation Comment for Historics
@return bool | [
"Submit",
"an",
"Update",
"for",
"a",
"Local",
"Object"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Client/Splash.php#L146-L180 | train |
SplashSync/Php-Core | Client/Splash.php | Splash.getCommitParameters | private static function getCommitParameters($objectType, $local = null, $action = null, $user = '', $comment = '')
{
$params = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
$params->type = $objectType; // Type of the Object
$params->id = $local; // Id of Modified object
$params->action = $action; // Action Type On this Object
$params->user = $user; // Operation User Name for Historics
$params->comment = $comment; // Operation Comment for Historics
return $params;
} | php | private static function getCommitParameters($objectType, $local = null, $action = null, $user = '', $comment = '')
{
$params = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
$params->type = $objectType; // Type of the Object
$params->id = $local; // Id of Modified object
$params->action = $action; // Action Type On this Object
$params->user = $user; // Operation User Name for Historics
$params->comment = $comment; // Operation Comment for Historics
return $params;
} | [
"private",
"static",
"function",
"getCommitParameters",
"(",
"$",
"objectType",
",",
"$",
"local",
"=",
"null",
",",
"$",
"action",
"=",
"null",
",",
"$",
"user",
"=",
"''",
",",
"$",
"comment",
"=",
"''",
")",
"{",
"$",
"params",
"=",
"new",
"ArrayO... | Build Call Parameters Array
@param string $objectType object Type Name
@param array|int|string $local object Local Id or Array of Local Id
@param string $action Action Type (SPL_A_UPDATE, or SPL_A_CREATE, or SPL_A_DELETE)
@param string $user User Name
@param string $comment Operation Comment for Historics
@return arrayObject | [
"Build",
"Call",
"Parameters",
"Array"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Client/Splash.php#L211-L220 | train |
SplashSync/Php-Core | Client/Splash.php | Splash.isCommitAllowed | private static function isCommitAllowed($objectType, $local = null, $action = null)
{
//====================================================================//
// Verify this Object is Locked ==> No Action on this Node
//====================================================================//
if (is_array($local)) {
foreach ($local as $value) {
if (Splash::object($objectType)->isLocked($value)) {
return false;
}
}
} else {
if (Splash::object($objectType)->isLocked($local)) {
return false;
}
}
//====================================================================//
// Verify Create Object is Locked ==> No Action on this Node
if ((SPL_A_CREATE === $action) && Splash::object($objectType)->isLocked()) {
return false;
}
//====================================================================//
// Verify if Travis Mode (PhpUnit) ==> No Commit Allowed
return !self::isTravisMode($objectType, $local, $action);
} | php | private static function isCommitAllowed($objectType, $local = null, $action = null)
{
//====================================================================//
// Verify this Object is Locked ==> No Action on this Node
//====================================================================//
if (is_array($local)) {
foreach ($local as $value) {
if (Splash::object($objectType)->isLocked($value)) {
return false;
}
}
} else {
if (Splash::object($objectType)->isLocked($local)) {
return false;
}
}
//====================================================================//
// Verify Create Object is Locked ==> No Action on this Node
if ((SPL_A_CREATE === $action) && Splash::object($objectType)->isLocked()) {
return false;
}
//====================================================================//
// Verify if Travis Mode (PhpUnit) ==> No Commit Allowed
return !self::isTravisMode($objectType, $local, $action);
} | [
"private",
"static",
"function",
"isCommitAllowed",
"(",
"$",
"objectType",
",",
"$",
"local",
"=",
"null",
",",
"$",
"action",
"=",
"null",
")",
"{",
"//====================================================================//",
"// Verify this Object is Locked ==> No Action on... | Check if Commit is Allowed Local Object
@param string $objectType object Type Name
@param array|int|string $local object Local Id or Array of Local Id
@param string $action Action Type (SPL_A_UPDATE, or SPL_A_CREATE, or SPL_A_DELETE)
@return bool | [
"Check",
"if",
"Commit",
"is",
"Allowed",
"Local",
"Object"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Client/Splash.php#L231-L255 | train |
SplashSync/Php-Core | Client/Splash.php | Splash.isTravisMode | private static function isTravisMode($objectType, $local, $action = null)
{
//====================================================================//
// Detect Travis from SERVER CONSTANTS
if (empty(Splash::input('SPLASH_TRAVIS'))) {
return false;
}
$objectIds = is_array($local) ? implode('|', $local) : $local;
self::log()->war('Module Commit Skipped ('.$objectType.', '.$action.', '.$objectIds.')');
return true;
} | php | private static function isTravisMode($objectType, $local, $action = null)
{
//====================================================================//
// Detect Travis from SERVER CONSTANTS
if (empty(Splash::input('SPLASH_TRAVIS'))) {
return false;
}
$objectIds = is_array($local) ? implode('|', $local) : $local;
self::log()->war('Module Commit Skipped ('.$objectType.', '.$action.', '.$objectIds.')');
return true;
} | [
"private",
"static",
"function",
"isTravisMode",
"(",
"$",
"objectType",
",",
"$",
"local",
",",
"$",
"action",
"=",
"null",
")",
"{",
"//====================================================================//",
"// Detect Travis from SERVER CONSTANTS",
"if",
"(",
"empty",
... | Check if Commit we Are in Travis Mode
@param string $objectType object Type Name
@param null|array|int|string $local object Local Id or Array of Local Id
@param string $action Action Type (SPL_A_UPDATE, or SPL_A_CREATE, or SPL_A_DELETE)
@return bool | [
"Check",
"if",
"Commit",
"we",
"Are",
"in",
"Travis",
"Mode"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Client/Splash.php#L266-L277 | train |
mikemirten/JsonApi | src/Mapper/Definition/Definition.php | Definition.merge | public function merge(self $definition)
{
if ($this->type === null && $definition->hasType()) {
$this->type = $definition->getType();
}
$this->mergeLinks($definition);
$this->mergeAttributes($definition);
$this->mergeRelationships($definition);
} | php | public function merge(self $definition)
{
if ($this->type === null && $definition->hasType()) {
$this->type = $definition->getType();
}
$this->mergeLinks($definition);
$this->mergeAttributes($definition);
$this->mergeRelationships($definition);
} | [
"public",
"function",
"merge",
"(",
"self",
"$",
"definition",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"===",
"null",
"&&",
"$",
"definition",
"->",
"hasType",
"(",
")",
")",
"{",
"$",
"this",
"->",
"type",
"=",
"$",
"definition",
"->",
"ge... | Merge a definition into this one
@param self $definition | [
"Merge",
"a",
"definition",
"into",
"this",
"one"
] | a3c1baf8f753c040f24e4522495b7d34565e6560 | https://github.com/mikemirten/JsonApi/blob/a3c1baf8f753c040f24e4522495b7d34565e6560/src/Mapper/Definition/Definition.php#L157-L166 | train |
SplashSync/Php-Core | Models/Helpers/ObjectsHelper.php | ObjectsHelper.encode | public static function encode($objectType, $objectId)
{
//====================================================================//
// Safety Checks
if (empty($objectType)) {
return false;
}
if (empty($objectId)) {
return false;
}
//====================================================================//
// Create & Return Field Id Data String
return $objectId.IDSPLIT.$objectType;
} | php | public static function encode($objectType, $objectId)
{
//====================================================================//
// Safety Checks
if (empty($objectType)) {
return false;
}
if (empty($objectId)) {
return false;
}
//====================================================================//
// Create & Return Field Id Data String
return $objectId.IDSPLIT.$objectType;
} | [
"public",
"static",
"function",
"encode",
"(",
"$",
"objectType",
",",
"$",
"objectId",
")",
"{",
"//====================================================================//",
"// Safety Checks",
"if",
"(",
"empty",
"(",
"$",
"objectType",
")",
")",
"{",
"return",
"fals... | Create an Object Identifier String
@param string $objectType Object Type Name.
@param string $objectId Object Identifier
@return false|string | [
"Create",
"an",
"Object",
"Identifier",
"String"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Models/Helpers/ObjectsHelper.php#L38-L52 | train |
SplashSync/Php-Core | Models/Helpers/ObjectsHelper.php | ObjectsHelper.load | public static function load($fieldData, $objectClass = null)
{
//====================================================================//
// Decode Object Type & Id
$objectType = self::objectType($fieldData);
$objectId = self::objectId($fieldData);
if (!$objectType || !$objectId) {
return null;
}
//====================================================================//
// Load Splash Object
$splashObject = Splash::object($objectType);
if (empty($splashObject)) {
return null;
}
//====================================================================//
// Ensure Splash Object uses InteliParserTrait
if (!in_array(IntelParserTrait::class, class_uses($splashObject), true)) {
return null;
}
if (!method_exists($splashObject, 'load')) {
return null;
}
//====================================================================//
// Load Remote Object
$remoteObject = $splashObject->load($objectId);
if (!$remoteObject) {
return null;
}
//====================================================================//
// Verify Remote Object
if (!empty($objectClass) && !($remoteObject instanceof $objectClass)) {
return null;
}
//====================================================================//
// Return Remote Object
return $remoteObject;
} | php | public static function load($fieldData, $objectClass = null)
{
//====================================================================//
// Decode Object Type & Id
$objectType = self::objectType($fieldData);
$objectId = self::objectId($fieldData);
if (!$objectType || !$objectId) {
return null;
}
//====================================================================//
// Load Splash Object
$splashObject = Splash::object($objectType);
if (empty($splashObject)) {
return null;
}
//====================================================================//
// Ensure Splash Object uses InteliParserTrait
if (!in_array(IntelParserTrait::class, class_uses($splashObject), true)) {
return null;
}
if (!method_exists($splashObject, 'load')) {
return null;
}
//====================================================================//
// Load Remote Object
$remoteObject = $splashObject->load($objectId);
if (!$remoteObject) {
return null;
}
//====================================================================//
// Verify Remote Object
if (!empty($objectClass) && !($remoteObject instanceof $objectClass)) {
return null;
}
//====================================================================//
// Return Remote Object
return $remoteObject;
} | [
"public",
"static",
"function",
"load",
"(",
"$",
"fieldData",
",",
"$",
"objectClass",
"=",
"null",
")",
"{",
"//====================================================================//",
"// Decode Object Type & Id",
"$",
"objectType",
"=",
"self",
"::",
"objectType",
"("... | Load a Target Remote Object using Splash Object Field Data
@param string $fieldData Object Identifier String.
@param null|mixed $objectClass
@return null|AbstractObject | [
"Load",
"a",
"Target",
"Remote",
"Object",
"using",
"Splash",
"Object",
"Field",
"Data"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Models/Helpers/ObjectsHelper.php#L91-L128 | train |
soosyze/framework | src/Components/Validator/Rules/File.php | File.getMime | protected function getMime(UploadedFileInterface $upload)
{
$file = $upload->getStream()->getMetadata('uri');
return (new \finfo(FILEINFO_MIME_TYPE))->file($file);
} | php | protected function getMime(UploadedFileInterface $upload)
{
$file = $upload->getStream()->getMetadata('uri');
return (new \finfo(FILEINFO_MIME_TYPE))->file($file);
} | [
"protected",
"function",
"getMime",
"(",
"UploadedFileInterface",
"$",
"upload",
")",
"{",
"$",
"file",
"=",
"$",
"upload",
"->",
"getStream",
"(",
")",
"->",
"getMetadata",
"(",
"'uri'",
")",
";",
"return",
"(",
"new",
"\\",
"finfo",
"(",
"FILEINFO_MIME_T... | Retourne le mimetype du fichier.
@param UploadedFileInterface $upload
@return string|false Minetype ou FALSE si une erreur s'est produite. | [
"Retourne",
"le",
"mimetype",
"du",
"fichier",
"."
] | d8dec2155bf9bc1d8ded176b4b65c183e2082049 | https://github.com/soosyze/framework/blob/d8dec2155bf9bc1d8ded176b4b65c183e2082049/src/Components/Validator/Rules/File.php#L110-L115 | train |
soosyze/framework | src/Components/Validator/Rules/File.php | File.getExtension | protected function getExtension(UploadedFileInterface $upload)
{
$filename = $filename = $upload->getClientFilename();
return strtolower(pathinfo($filename, PATHINFO_EXTENSION));
} | php | protected function getExtension(UploadedFileInterface $upload)
{
$filename = $filename = $upload->getClientFilename();
return strtolower(pathinfo($filename, PATHINFO_EXTENSION));
} | [
"protected",
"function",
"getExtension",
"(",
"UploadedFileInterface",
"$",
"upload",
")",
"{",
"$",
"filename",
"=",
"$",
"filename",
"=",
"$",
"upload",
"->",
"getClientFilename",
"(",
")",
";",
"return",
"strtolower",
"(",
"pathinfo",
"(",
"$",
"filename",
... | Retourne l'extension du fichier.
@param UploadedFileInterface $upload
@return @return string|false Extension du fichier ou FALSE si une erreur s'est produite. | [
"Retourne",
"l",
"extension",
"du",
"fichier",
"."
] | d8dec2155bf9bc1d8ded176b4b65c183e2082049 | https://github.com/soosyze/framework/blob/d8dec2155bf9bc1d8ded176b4b65c183e2082049/src/Components/Validator/Rules/File.php#L124-L129 | train |
wangxian/ephp | src/Hash/Encrypt.php | Encrypt.edcode | public static function edcode($string, $operation, $key = 'ePHP')
{
// ENCODE
$key_length = strlen($key);
$string = $operation == 'DECODE' ? \ePHP\Misc\Func::safe_b64decode($string) : substr(md5($string . $key), 0, 8) . $string;
$string_length = strlen($string);
$rndkey = $box = array();
$result = '';
for ($i = 0; $i <= 255; $i++) {
$rndkey[$i] = ord($key[$i % $key_length]);
$box[$i] = $i;
}
for ($j = $i = 0; $i < 256; $i++) {
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $box[$j];
$box[$j] = $tmp;
}
for ($a = $j = $i = 0; $i < $string_length; $i++) {
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
}
// DECODE
if ($operation == 'DECODE') {
if (substr($result, 0, 8) == substr(md5(substr($result, 8) . $key), 0, 8)) {
return substr($result, 8);
} else {
return '';
}
} else {
return \ePHP\Misc\Func::safe_b64encode($result);
}
} | php | public static function edcode($string, $operation, $key = 'ePHP')
{
// ENCODE
$key_length = strlen($key);
$string = $operation == 'DECODE' ? \ePHP\Misc\Func::safe_b64decode($string) : substr(md5($string . $key), 0, 8) . $string;
$string_length = strlen($string);
$rndkey = $box = array();
$result = '';
for ($i = 0; $i <= 255; $i++) {
$rndkey[$i] = ord($key[$i % $key_length]);
$box[$i] = $i;
}
for ($j = $i = 0; $i < 256; $i++) {
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $box[$j];
$box[$j] = $tmp;
}
for ($a = $j = $i = 0; $i < $string_length; $i++) {
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
}
// DECODE
if ($operation == 'DECODE') {
if (substr($result, 0, 8) == substr(md5(substr($result, 8) . $key), 0, 8)) {
return substr($result, 8);
} else {
return '';
}
} else {
return \ePHP\Misc\Func::safe_b64encode($result);
}
} | [
"public",
"static",
"function",
"edcode",
"(",
"$",
"string",
",",
"$",
"operation",
",",
"$",
"key",
"=",
"'ePHP'",
")",
"{",
"// ENCODE",
"$",
"key_length",
"=",
"strlen",
"(",
"$",
"key",
")",
";",
"$",
"string",
"=",
"$",
"operation",
"==",
"'DEC... | Others encode or decode
<code>
echo $str = edcode('1371817454', 'ENCODE','1');
echo edcode('XbfSC2GOpSTtwHwOIDW7Fg', 'DECODE','2000558');
</code>
@param string $string 密文
@param string $operation options DECODE | DECODE
@param string $key default 'ePHP'
@return string | [
"Others",
"encode",
"or",
"decode"
] | 697248ab098d8dc352de31ab0c64ea0fee1d7132 | https://github.com/wangxian/ephp/blob/697248ab098d8dc352de31ab0c64ea0fee1d7132/src/Hash/Encrypt.php#L57-L97 | train |
wangxian/ephp | src/Core/Controller.php | Controller.setHeader | protected function setHeader($key, $value)
{
if (SERVER_MODE === 'swoole') {
$GLOBALS['__$response']->header($key, $value);
} else {
if (!headers_sent()) {
header($key . ': '. $value);
}
}
} | php | protected function setHeader($key, $value)
{
if (SERVER_MODE === 'swoole') {
$GLOBALS['__$response']->header($key, $value);
} else {
if (!headers_sent()) {
header($key . ': '. $value);
}
}
} | [
"protected",
"function",
"setHeader",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"SERVER_MODE",
"===",
"'swoole'",
")",
"{",
"$",
"GLOBALS",
"[",
"'__$response'",
"]",
"->",
"header",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
... | Set response header
@param string $key
@param string $value
@return void | [
"Set",
"response",
"header"
] | 697248ab098d8dc352de31ab0c64ea0fee1d7132 | https://github.com/wangxian/ephp/blob/697248ab098d8dc352de31ab0c64ea0fee1d7132/src/Core/Controller.php#L93-L102 | train |
wangxian/ephp | src/Core/Controller.php | Controller.redirect | protected function redirect($url, $code = 302)
{
if (!headers_sent()) {
if (SERVER_MODE === 'swoole' ) {
$GLOBALS['__$response']->status($code);
} else if ($code == 301) {
header('HTTP/1.1 301 Moved Permanently');
} else {
header('HTTP/1.1 302 Found');
}
$this->setHeader("Location", $url);
$this->stopRun();
} else {
echo '<html><head><meta charset="UTF-8" /><title></title></head><body>';
echo '<script>window.location.href="'. $url .'";</script></body></html>';
$this->stopRun();
}
} | php | protected function redirect($url, $code = 302)
{
if (!headers_sent()) {
if (SERVER_MODE === 'swoole' ) {
$GLOBALS['__$response']->status($code);
} else if ($code == 301) {
header('HTTP/1.1 301 Moved Permanently');
} else {
header('HTTP/1.1 302 Found');
}
$this->setHeader("Location", $url);
$this->stopRun();
} else {
echo '<html><head><meta charset="UTF-8" /><title></title></head><body>';
echo '<script>window.location.href="'. $url .'";</script></body></html>';
$this->stopRun();
}
} | [
"protected",
"function",
"redirect",
"(",
"$",
"url",
",",
"$",
"code",
"=",
"302",
")",
"{",
"if",
"(",
"!",
"headers_sent",
"(",
")",
")",
"{",
"if",
"(",
"SERVER_MODE",
"===",
"'swoole'",
")",
"{",
"$",
"GLOBALS",
"[",
"'__$response'",
"]",
"->",
... | Redirect to url
Compatible swoole mode server container
@param string $url
@param int $code 301 or 302
@return void | [
"Redirect",
"to",
"url",
"Compatible",
"swoole",
"mode",
"server",
"container"
] | 697248ab098d8dc352de31ab0c64ea0fee1d7132 | https://github.com/wangxian/ephp/blob/697248ab098d8dc352de31ab0c64ea0fee1d7132/src/Core/Controller.php#L112-L130 | train |
wangxian/ephp | src/Model/DBPool.php | DBPool.init | public static function init($name)
{
if (empty(self::$instance[$name]) || !self::$instance[$name] instanceof self) {
self::$instance[$name] = new self();
self::$instance[$name]->queue = new \SplQueue();
}
return self::$instance[$name];
} | php | public static function init($name)
{
if (empty(self::$instance[$name]) || !self::$instance[$name] instanceof self) {
self::$instance[$name] = new self();
self::$instance[$name]->queue = new \SplQueue();
}
return self::$instance[$name];
} | [
"public",
"static",
"function",
"init",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"instance",
"[",
"$",
"name",
"]",
")",
"||",
"!",
"self",
"::",
"$",
"instance",
"[",
"$",
"name",
"]",
"instanceof",
"self",
")",
"{... | Dynamically handle calls to the class.
@return \ePHP\Model\Pool | [
"Dynamically",
"handle",
"calls",
"to",
"the",
"class",
"."
] | 697248ab098d8dc352de31ab0c64ea0fee1d7132 | https://github.com/wangxian/ephp/blob/697248ab098d8dc352de31ab0c64ea0fee1d7132/src/Model/DBPool.php#L44-L51 | train |
curiosity26/ODataQuery-PHP | src/ODataResource.php | ODataResource.orderBy | public function orderBy($orderBy = NULL) {
if (isset($orderBy)) {
$this->setOrderBy($orderBy);
return $this;
}
return $this->getOrderBy();
} | php | public function orderBy($orderBy = NULL) {
if (isset($orderBy)) {
$this->setOrderBy($orderBy);
return $this;
}
return $this->getOrderBy();
} | [
"public",
"function",
"orderBy",
"(",
"$",
"orderBy",
"=",
"NULL",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"orderBy",
")",
")",
"{",
"$",
"this",
"->",
"setOrderBy",
"(",
"$",
"orderBy",
")",
";",
"return",
"$",
"this",
";",
"}",
"return",
"$",
"... | Retained for backward compatibility
@param null $orderBy
@return $this
@deprecated | [
"Retained",
"for",
"backward",
"compatibility"
] | baaf8784922d07b53693d1cd818f94bf5b331594 | https://github.com/curiosity26/ODataQuery-PHP/blob/baaf8784922d07b53693d1cd818f94bf5b331594/src/ODataResource.php#L121-L127 | train |
soosyze/framework | src/Components/Validator/Rules/Image.php | Image.getDimensions | protected function getDimensions(UploadedFileInterface $upload)
{
$dimension = getimagesize($upload->getStream()->getMetadata('uri'));
return [
'width' => $dimension[ 0 ],
'height' => $dimension[ 1 ]
];
} | php | protected function getDimensions(UploadedFileInterface $upload)
{
$dimension = getimagesize($upload->getStream()->getMetadata('uri'));
return [
'width' => $dimension[ 0 ],
'height' => $dimension[ 1 ]
];
} | [
"protected",
"function",
"getDimensions",
"(",
"UploadedFileInterface",
"$",
"upload",
")",
"{",
"$",
"dimension",
"=",
"getimagesize",
"(",
"$",
"upload",
"->",
"getStream",
"(",
")",
"->",
"getMetadata",
"(",
"'uri'",
")",
")",
";",
"return",
"[",
"'width'... | Retourne les dimensions d'une image.
@param UploadedFileInterface $upload Image
@return int[] Dimensions | [
"Retourne",
"les",
"dimensions",
"d",
"une",
"image",
"."
] | d8dec2155bf9bc1d8ded176b4b65c183e2082049 | https://github.com/soosyze/framework/blob/d8dec2155bf9bc1d8ded176b4b65c183e2082049/src/Components/Validator/Rules/Image.php#L59-L67 | train |
soosyze/framework | src/Components/Validator/Rules/Image.php | Image.validMimeImage | private function validMimeImage($extension, $mimes)
{
if (is_array($mimes)) {
foreach ($mimes as $mime) {
if (!strstr($mime, 'image/')) {
throw new \InvalidArgumentException(htmlspecialchars(
"The extension $extension is not an image extension."
));
}
}
} else {
if (!strstr($mimes, 'image/')) {
throw new \InvalidArgumentException(htmlspecialchars(
"The extension $extension is not an image extension."
));
}
}
} | php | private function validMimeImage($extension, $mimes)
{
if (is_array($mimes)) {
foreach ($mimes as $mime) {
if (!strstr($mime, 'image/')) {
throw new \InvalidArgumentException(htmlspecialchars(
"The extension $extension is not an image extension."
));
}
}
} else {
if (!strstr($mimes, 'image/')) {
throw new \InvalidArgumentException(htmlspecialchars(
"The extension $extension is not an image extension."
));
}
}
} | [
"private",
"function",
"validMimeImage",
"(",
"$",
"extension",
",",
"$",
"mimes",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"mimes",
")",
")",
"{",
"foreach",
"(",
"$",
"mimes",
"as",
"$",
"mime",
")",
"{",
"if",
"(",
"!",
"strstr",
"(",
"$",
"... | Valide si un mimetype est celui d'une image.
@param string $extension
@param string|array $mimes Mimetype ou liste de mimetype.
@throws \InvalidArgumentException L'extension n'est pas une extension d'image. | [
"Valide",
"si",
"un",
"mimetype",
"est",
"celui",
"d",
"une",
"image",
"."
] | d8dec2155bf9bc1d8ded176b4b65c183e2082049 | https://github.com/soosyze/framework/blob/d8dec2155bf9bc1d8ded176b4b65c183e2082049/src/Components/Validator/Rules/Image.php#L94-L111 | train |
SplashSync/Php-Core | Models/Logger/FileExporterTrait.php | FileExporterTrait.addLogToFile | protected static function addLogToFile($message, $logType = 'Unknown')
{
//====================================================================//
// Safety Check
if (0 == Splash::configuration()->Logging) {
return true;
}
//====================================================================//
// Detect Log File Directory
$logfile = dirname(__DIR__).'/splash.log';
if (defined('SPLASH_DIR') && realpath(SPLASH_DIR)) {
$logfile = realpath(SPLASH_DIR).'/splash.log';
}
//====================================================================//
// Open Log File
$filefd = @fopen($logfile, 'a+');
//====================================================================//
// Write Log File
if ($filefd) {
$message = date('Y-m-d H:i:s').' '.sprintf('%-15s', $logType).$message;
fwrite($filefd, $message."\n");
fclose($filefd);
@chmod($logfile, 0604);
}
return true;
} | php | protected static function addLogToFile($message, $logType = 'Unknown')
{
//====================================================================//
// Safety Check
if (0 == Splash::configuration()->Logging) {
return true;
}
//====================================================================//
// Detect Log File Directory
$logfile = dirname(__DIR__).'/splash.log';
if (defined('SPLASH_DIR') && realpath(SPLASH_DIR)) {
$logfile = realpath(SPLASH_DIR).'/splash.log';
}
//====================================================================//
// Open Log File
$filefd = @fopen($logfile, 'a+');
//====================================================================//
// Write Log File
if ($filefd) {
$message = date('Y-m-d H:i:s').' '.sprintf('%-15s', $logType).$message;
fwrite($filefd, $message."\n");
fclose($filefd);
@chmod($logfile, 0604);
}
return true;
} | [
"protected",
"static",
"function",
"addLogToFile",
"(",
"$",
"message",
",",
"$",
"logType",
"=",
"'Unknown'",
")",
"{",
"//====================================================================//",
"// Safety Check",
"if",
"(",
"0",
"==",
"Splash",
"::",
"configuration",
... | Add a message to Log File
@param string $message Message text to log
@param string $logType Message Type
@return true | [
"Add",
"a",
"message",
"to",
"Log",
"File"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Models/Logger/FileExporterTrait.php#L35-L61 | train |
SplashSync/Php-Core | Models/Logger/FileExporterTrait.php | FileExporterTrait.addLogBlockToFile | protected static function addLogBlockToFile($msgArray, $logType = 'Unknown')
{
//====================================================================//
// Safety Check
if (false == Splash::configuration()->Logging) {
return true;
}
//====================================================================//
// Run a Messages List
if ((is_array($msgArray) || $msgArray instanceof Countable) && count($msgArray)) {
foreach ($msgArray as $message) {
//====================================================================//
// Add Message To Log File
self::addLogToFile(utf8_decode(html_entity_decode($message)), $logType);
}
}
return true;
} | php | protected static function addLogBlockToFile($msgArray, $logType = 'Unknown')
{
//====================================================================//
// Safety Check
if (false == Splash::configuration()->Logging) {
return true;
}
//====================================================================//
// Run a Messages List
if ((is_array($msgArray) || $msgArray instanceof Countable) && count($msgArray)) {
foreach ($msgArray as $message) {
//====================================================================//
// Add Message To Log File
self::addLogToFile(utf8_decode(html_entity_decode($message)), $logType);
}
}
return true;
} | [
"protected",
"static",
"function",
"addLogBlockToFile",
"(",
"$",
"msgArray",
",",
"$",
"logType",
"=",
"'Unknown'",
")",
"{",
"//====================================================================//",
"// Safety Check",
"if",
"(",
"false",
"==",
"Splash",
"::",
"configu... | Add a Messages Block to Log File
@param null|array|ArrayObject $msgArray Array of Message text to log
@param string $logType Message Type
@return true | [
"Add",
"a",
"Messages",
"Block",
"to",
"Log",
"File"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Models/Logger/FileExporterTrait.php#L71-L89 | train |
maximebf/ConsoleKit | src/ConsoleKit/Widgets/ProgressBar.php | ProgressBar.render | public function render()
{
$percentage = (double) ($this->value / $this->total);
$progress = floor($percentage * $this->size);
$output = "\r[" . str_repeat('=', $progress);
if ($progress < $this->size) {
$output .= ">" . str_repeat(' ', $this->size - $progress);
} else {
$output .= '=';
}
$output .= sprintf('] %s%% %s/%s', round($percentage * 100, 0), $this->value, $this->total);
if ($this->showRemainingTime) {
$speed = (time() - $this->startTime) / $this->value;
$remaining = number_format(round($speed * ($this->total - $this->value), 2), 2);
$output .= " - $remaining sec remaining";
}
return $output;
} | php | public function render()
{
$percentage = (double) ($this->value / $this->total);
$progress = floor($percentage * $this->size);
$output = "\r[" . str_repeat('=', $progress);
if ($progress < $this->size) {
$output .= ">" . str_repeat(' ', $this->size - $progress);
} else {
$output .= '=';
}
$output .= sprintf('] %s%% %s/%s', round($percentage * 100, 0), $this->value, $this->total);
if ($this->showRemainingTime) {
$speed = (time() - $this->startTime) / $this->value;
$remaining = number_format(round($speed * ($this->total - $this->value), 2), 2);
$output .= " - $remaining sec remaining";
}
return $output;
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"percentage",
"=",
"(",
"double",
")",
"(",
"$",
"this",
"->",
"value",
"/",
"$",
"this",
"->",
"total",
")",
";",
"$",
"progress",
"=",
"floor",
"(",
"$",
"percentage",
"*",
"$",
"this",
"->",
... | Generates the text to write for the current values
@return string | [
"Generates",
"the",
"text",
"to",
"write",
"for",
"the",
"current",
"values"
] | a05c0c5a4c48882599d59323314ac963a836d58f | https://github.com/maximebf/ConsoleKit/blob/a05c0c5a4c48882599d59323314ac963a836d58f/src/ConsoleKit/Widgets/ProgressBar.php#L150-L170 | train |
maximebf/ConsoleKit | src/ConsoleKit/Widgets/ProgressBar.php | ProgressBar.write | public function write()
{
if ($this->textWriter === null) {
throw new ConsoleException('No TextWriter object specified');
}
$this->textWriter->write($this->render());
return $this;
} | php | public function write()
{
if ($this->textWriter === null) {
throw new ConsoleException('No TextWriter object specified');
}
$this->textWriter->write($this->render());
return $this;
} | [
"public",
"function",
"write",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"textWriter",
"===",
"null",
")",
"{",
"throw",
"new",
"ConsoleException",
"(",
"'No TextWriter object specified'",
")",
";",
"}",
"$",
"this",
"->",
"textWriter",
"->",
"write",
"... | Writes the rendered progress bar to the text writer
@return ProgressBar | [
"Writes",
"the",
"rendered",
"progress",
"bar",
"to",
"the",
"text",
"writer"
] | a05c0c5a4c48882599d59323314ac963a836d58f | https://github.com/maximebf/ConsoleKit/blob/a05c0c5a4c48882599d59323314ac963a836d58f/src/ConsoleKit/Widgets/ProgressBar.php#L177-L184 | train |
SplashSync/Php-Core | Configurator/JsonConfigurator.php | JsonConfigurator.getConfigPath | private function getConfigPath()
{
//====================================================================//
// Load Module Configuration
$cfg = Splash::configuration();
//====================================================================//
// Check if Custom Configuration Path is Defined
$cfgPath = Splash::getLocalPath()."/configuration.json";
if (isset($cfg->ConfiguratorPath) && is_string($cfg->ConfiguratorPath)) {
$cfgPath = $cfg->ConfiguratorPath;
}
//====================================================================//
// Check if Custom Configuration File Exists
Splash::log()->deb("Try Loading Custom Configuration From: ".$cfgPath);
if (!is_file($cfgPath)) {
return false;
}
return $cfgPath;
} | php | private function getConfigPath()
{
//====================================================================//
// Load Module Configuration
$cfg = Splash::configuration();
//====================================================================//
// Check if Custom Configuration Path is Defined
$cfgPath = Splash::getLocalPath()."/configuration.json";
if (isset($cfg->ConfiguratorPath) && is_string($cfg->ConfiguratorPath)) {
$cfgPath = $cfg->ConfiguratorPath;
}
//====================================================================//
// Check if Custom Configuration File Exists
Splash::log()->deb("Try Loading Custom Configuration From: ".$cfgPath);
if (!is_file($cfgPath)) {
return false;
}
return $cfgPath;
} | [
"private",
"function",
"getConfigPath",
"(",
")",
"{",
"//====================================================================//",
"// Load Module Configuration",
"$",
"cfg",
"=",
"Splash",
"::",
"configuration",
"(",
")",
";",
"//==================================================... | Get Json Configuration File Path
return false|string False or Configuration File Path | [
"Get",
"Json",
"Configuration",
"File",
"Path"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Configurator/JsonConfigurator.php#L68-L87 | train |
SplashSync/Php-Core | Configurator/JsonConfigurator.php | JsonConfigurator.getConfigArray | private function getConfigArray($cfgPath)
{
//====================================================================//
// Check if Custom Configuration File Exists
if (!is_file($cfgPath)) {
return false;
}
//====================================================================//
// Load File Contents
$rawJson = file_get_contents($cfgPath);
if (!is_string($rawJson)) {
return false;
}
//====================================================================//
// Decode Json Contents
$json = json_decode($rawJson, true);
if (!is_array($json)) {
Splash::log()->war("Invalid Json Configuration. Overrides Skipped!");
return false;
}
Splash::log()->deb("Loaded Custom Configuration From: ".$cfgPath);
return $json;
} | php | private function getConfigArray($cfgPath)
{
//====================================================================//
// Check if Custom Configuration File Exists
if (!is_file($cfgPath)) {
return false;
}
//====================================================================//
// Load File Contents
$rawJson = file_get_contents($cfgPath);
if (!is_string($rawJson)) {
return false;
}
//====================================================================//
// Decode Json Contents
$json = json_decode($rawJson, true);
if (!is_array($json)) {
Splash::log()->war("Invalid Json Configuration. Overrides Skipped!");
return false;
}
Splash::log()->deb("Loaded Custom Configuration From: ".$cfgPath);
return $json;
} | [
"private",
"function",
"getConfigArray",
"(",
"$",
"cfgPath",
")",
"{",
"//====================================================================//",
"// Check if Custom Configuration File Exists",
"if",
"(",
"!",
"is_file",
"(",
"$",
"cfgPath",
")",
")",
"{",
"return",
"fal... | Load Configuration File
@param string $cfgPath Configuration File Path
return false|array False or Configuration Array | [
"Load",
"Configuration",
"File"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Configurator/JsonConfigurator.php#L96-L120 | train |
soosyze/framework | src/Container.php | Container.has | public function has($key)
{
if (!is_string($key)) {
throw new \InvalidArgumentException(htmlspecialchars(
"Get function only accepts strings. Input was: $key."
));
}
return isset($this->services[ $key ]) || isset($this->instances[ $key ]);
} | php | public function has($key)
{
if (!is_string($key)) {
throw new \InvalidArgumentException(htmlspecialchars(
"Get function only accepts strings. Input was: $key."
));
}
return isset($this->services[ $key ]) || isset($this->instances[ $key ]);
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"htmlspecialchars",
"(",
"\"Get function only accepts strings. Input was: $key.\"",
")",
"... | Si le service existe.
@param string $key Nom du service.
@throws \InvalidArgumentException La fonction get accepte uniquement les chaînes de caractères.
@return bool | [
"Si",
"le",
"service",
"existe",
"."
] | d8dec2155bf9bc1d8ded176b4b65c183e2082049 | https://github.com/soosyze/framework/blob/d8dec2155bf9bc1d8ded176b4b65c183e2082049/src/Container.php#L194-L203 | train |
soosyze/framework | src/Container.php | Container.loadHooks | protected function loadHooks(array $services)
{
foreach ($services as $service => $value) {
if (!isset($value[ 'hooks' ])) {
continue;
}
foreach ($value[ 'hooks' ] as $key => $hook) {
$this->hooks[ $key ][ $service ] = $hook;
}
}
} | php | protected function loadHooks(array $services)
{
foreach ($services as $service => $value) {
if (!isset($value[ 'hooks' ])) {
continue;
}
foreach ($value[ 'hooks' ] as $key => $hook) {
$this->hooks[ $key ][ $service ] = $hook;
}
}
} | [
"protected",
"function",
"loadHooks",
"(",
"array",
"$",
"services",
")",
"{",
"foreach",
"(",
"$",
"services",
"as",
"$",
"service",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"value",
"[",
"'hooks'",
"]",
")",
")",
"{",
"con... | Charge les hooks contenus dans les services.
@param array $services | [
"Charge",
"les",
"hooks",
"contenus",
"dans",
"les",
"services",
"."
] | d8dec2155bf9bc1d8ded176b4b65c183e2082049 | https://github.com/soosyze/framework/blob/d8dec2155bf9bc1d8ded176b4b65c183e2082049/src/Container.php#L264-L274 | train |
SplashSync/Php-Core | Models/Logger/HtmlExportsTrait.php | HtmlExportsTrait.getHtmlListItem | public function getHtmlListItem($message, $type = null)
{
switch ($type) {
case 'Error':
$color = '#FF3300';
$text = ' KO ';
break;
case 'Warning':
$color = '#FF9933';
$text = ' WAR ';
break;
default:
$color = '#006600';
$text = ' OK ';
break;
}
return '[<font color="'.$color.'">'.$text.'</font>] '.$message.PHP_EOL.'</br>';
} | php | public function getHtmlListItem($message, $type = null)
{
switch ($type) {
case 'Error':
$color = '#FF3300';
$text = ' KO ';
break;
case 'Warning':
$color = '#FF9933';
$text = ' WAR ';
break;
default:
$color = '#006600';
$text = ' OK ';
break;
}
return '[<font color="'.$color.'">'.$text.'</font>] '.$message.PHP_EOL.'</br>';
} | [
"public",
"function",
"getHtmlListItem",
"(",
"$",
"message",
",",
"$",
"type",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'Error'",
":",
"$",
"color",
"=",
"'#FF3300'",
";",
"$",
"text",
"=",
"' KO '",
";",
"break"... | Return WebServer Log Item in Html Checklist format
@param string $message Log message
@param string $type Message Type
@return string | [
"Return",
"WebServer",
"Log",
"Item",
"in",
"Html",
"Checklist",
"format"
] | f69724117b979e10eb38e72f7fe38611b5c3f830 | https://github.com/SplashSync/Php-Core/blob/f69724117b979e10eb38e72f7fe38611b5c3f830/Models/Logger/HtmlExportsTrait.php#L59-L80 | train |
mapbender/data-source | Component/DataStoreService.php | DataStoreService.get | public function get($name)
{
if (!isset($this->storeList[ $name ])) {
$configs = $this->getDataStoreDeclarations();
$this->storeList[ $name ] = new DataStore($this->container, $configs[ $name ]);
}
return $this->storeList[ $name ];
} | php | public function get($name)
{
if (!isset($this->storeList[ $name ])) {
$configs = $this->getDataStoreDeclarations();
$this->storeList[ $name ] = new DataStore($this->container, $configs[ $name ]);
}
return $this->storeList[ $name ];
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"storeList",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"configs",
"=",
"$",
"this",
"->",
"getDataStoreDeclarations",
"(",
")",
";",
"$",
"... | Get store by name
@param $name String data store name
@return DataStore|null | [
"Get",
"store",
"by",
"name"
] | b805e7ab487584fcf41475bb32cf6dbbe3f7c5ed | https://github.com/mapbender/data-source/blob/b805e7ab487584fcf41475bb32cf6dbbe3f7c5ed/Component/DataStoreService.php#L39-L46 | train |
payneteasy/php-library-payneteasy-api | source/PaynetEasy/PaynetEasyApi/PaymentData/QueryConfig.php | QueryConfig.setEndPoint | public function setEndPoint($endPoint)
{
if (strlen($this->getEndPointGroup()) > 0)
{
throw new RuntimeException(
"End point group has been already set. You can set either end point or end point group."
);
}
$this->endPoint = (int) $endPoint;
return $this;
} | php | public function setEndPoint($endPoint)
{
if (strlen($this->getEndPointGroup()) > 0)
{
throw new RuntimeException(
"End point group has been already set. You can set either end point or end point group."
);
}
$this->endPoint = (int) $endPoint;
return $this;
} | [
"public",
"function",
"setEndPoint",
"(",
"$",
"endPoint",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"getEndPointGroup",
"(",
")",
")",
">",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"End point group has been already set. You can set... | Set merchant end point
@param integer $endPoint Merchant end point
@return self | [
"Set",
"merchant",
"end",
"point"
] | e3484aa37b6594231f59b1f43523603aa704f093 | https://github.com/payneteasy/php-library-payneteasy-api/blob/e3484aa37b6594231f59b1f43523603aa704f093/source/PaynetEasy/PaynetEasyApi/PaymentData/QueryConfig.php#L107-L119 | train |
payneteasy/php-library-payneteasy-api | source/PaynetEasy/PaynetEasyApi/PaymentData/QueryConfig.php | QueryConfig.setEndPointGroup | function setEndPointGroup($endPointGroup) {
if (strlen($this->getEndPoint()) > 0)
{
throw new RuntimeException(
"End point has been already set. You can set either end point or end point group."
);
}
$this->endPointGroup = (int) $endPointGroup;
} | php | function setEndPointGroup($endPointGroup) {
if (strlen($this->getEndPoint()) > 0)
{
throw new RuntimeException(
"End point has been already set. You can set either end point or end point group."
);
}
$this->endPointGroup = (int) $endPointGroup;
} | [
"function",
"setEndPointGroup",
"(",
"$",
"endPointGroup",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"getEndPoint",
"(",
")",
")",
">",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"End point has been already set. You can set either end p... | Get merchant end point group
@return integer | [
"Get",
"merchant",
"end",
"point",
"group"
] | e3484aa37b6594231f59b1f43523603aa704f093 | https://github.com/payneteasy/php-library-payneteasy-api/blob/e3484aa37b6594231f59b1f43523603aa704f093/source/PaynetEasy/PaynetEasyApi/PaymentData/QueryConfig.php#L147-L156 | train |
payneteasy/php-library-payneteasy-api | source/PaynetEasy/PaynetEasyApi/PaymentData/QueryConfig.php | QueryConfig.setGatewayUrl | public function setGatewayUrl($gatewayUrl, $gatewayMode)
{
$this->checkGatewayMode($gatewayMode);
switch ($gatewayMode)
{
case self::GATEWAY_MODE_SANDBOX:
{
$this->setGatewayUrlSandbox($gatewayUrl);
break;
}
case self::GATEWAY_MODE_PRODUCTION:
{
$this->setGatewayUrlProduction($gatewayUrl);
break;
}
}
return $this;
} | php | public function setGatewayUrl($gatewayUrl, $gatewayMode)
{
$this->checkGatewayMode($gatewayMode);
switch ($gatewayMode)
{
case self::GATEWAY_MODE_SANDBOX:
{
$this->setGatewayUrlSandbox($gatewayUrl);
break;
}
case self::GATEWAY_MODE_PRODUCTION:
{
$this->setGatewayUrlProduction($gatewayUrl);
break;
}
}
return $this;
} | [
"public",
"function",
"setGatewayUrl",
"(",
"$",
"gatewayUrl",
",",
"$",
"gatewayMode",
")",
"{",
"$",
"this",
"->",
"checkGatewayMode",
"(",
"$",
"gatewayMode",
")",
";",
"switch",
"(",
"$",
"gatewayMode",
")",
"{",
"case",
"self",
"::",
"GATEWAY_MODE_SANDB... | Set gateway url for different gateway modes
@param string $gatewayUrl Gateway url
@param string $gatewayMode Mode for gateway url: sandbox, production
@return self | [
"Set",
"gateway",
"url",
"for",
"different",
"gateway",
"modes"
] | e3484aa37b6594231f59b1f43523603aa704f093 | https://github.com/payneteasy/php-library-payneteasy-api/blob/e3484aa37b6594231f59b1f43523603aa704f093/source/PaynetEasy/PaynetEasyApi/PaymentData/QueryConfig.php#L358-L377 | train |
payneteasy/php-library-payneteasy-api | source/PaynetEasy/PaynetEasyApi/PaymentData/QueryConfig.php | QueryConfig.getGatewayUrl | public function getGatewayUrl()
{
switch ($this->getGatewayMode())
{
case self::GATEWAY_MODE_SANDBOX:
{
return $this->getGatewayUrlSandbox();
}
case self::GATEWAY_MODE_PRODUCTION:
{
return $this->getGatewayUrlProduction();
}
default:
{
throw new RuntimeException('You must set gatewayMode property first');
}
}
} | php | public function getGatewayUrl()
{
switch ($this->getGatewayMode())
{
case self::GATEWAY_MODE_SANDBOX:
{
return $this->getGatewayUrlSandbox();
}
case self::GATEWAY_MODE_PRODUCTION:
{
return $this->getGatewayUrlProduction();
}
default:
{
throw new RuntimeException('You must set gatewayMode property first');
}
}
} | [
"public",
"function",
"getGatewayUrl",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getGatewayMode",
"(",
")",
")",
"{",
"case",
"self",
"::",
"GATEWAY_MODE_SANDBOX",
":",
"{",
"return",
"$",
"this",
"->",
"getGatewayUrlSandbox",
"(",
")",
";",
"}",
... | Get gateway url for current gateway mode
@return string Sandbox gateway url if gateway mode is sandbox,
production gateway url if gateway mode is production | [
"Get",
"gateway",
"url",
"for",
"current",
"gateway",
"mode"
] | e3484aa37b6594231f59b1f43523603aa704f093 | https://github.com/payneteasy/php-library-payneteasy-api/blob/e3484aa37b6594231f59b1f43523603aa704f093/source/PaynetEasy/PaynetEasyApi/PaymentData/QueryConfig.php#L385-L402 | train |
payneteasy/php-library-payneteasy-api | source/PaynetEasy/PaynetEasyApi/Util/PropertyAccessor.php | PropertyAccessor.getValue | static public function getValue($object, $propertyPath, $failOnError = true)
{
if (!is_object($object))
{
throw new RuntimeException('Object expected, ' . gettype($object) . ' given');
}
// immediately return value if propertyPath contains only one level
if (strpos($propertyPath, '.') === false)
{
return static::getByGetter($object, $propertyPath, $failOnError);
}
list($firstPropertyPath, $pathRest) = explode('.', $propertyPath, 2);
$firstObject = static::getByGetter($object, $firstPropertyPath, $failOnError);
// get value recursively while propertyPath has many levels
if (is_object($firstObject))
{
return static::getValue($firstObject, $pathRest, $failOnError);
}
elseif ($failOnError === true)
{
throw new RuntimeException("Object expected for property path '{$firstPropertyPath}', '" .
gettype($firstObject) . "' given");
}
} | php | static public function getValue($object, $propertyPath, $failOnError = true)
{
if (!is_object($object))
{
throw new RuntimeException('Object expected, ' . gettype($object) . ' given');
}
// immediately return value if propertyPath contains only one level
if (strpos($propertyPath, '.') === false)
{
return static::getByGetter($object, $propertyPath, $failOnError);
}
list($firstPropertyPath, $pathRest) = explode('.', $propertyPath, 2);
$firstObject = static::getByGetter($object, $firstPropertyPath, $failOnError);
// get value recursively while propertyPath has many levels
if (is_object($firstObject))
{
return static::getValue($firstObject, $pathRest, $failOnError);
}
elseif ($failOnError === true)
{
throw new RuntimeException("Object expected for property path '{$firstPropertyPath}', '" .
gettype($firstObject) . "' given");
}
} | [
"static",
"public",
"function",
"getValue",
"(",
"$",
"object",
",",
"$",
"propertyPath",
",",
"$",
"failOnError",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Object ex... | Get property value by property path.
@param object $object Object with data
@param string $propertyPath Path to property
@param boolean $failOnError Throw exception if error occurred or not
@return mixed|null Property value or null, if error occurred
@throws RuntimeException Property getter not found or parent property is not object | [
"Get",
"property",
"value",
"by",
"property",
"path",
"."
] | e3484aa37b6594231f59b1f43523603aa704f093 | https://github.com/payneteasy/php-library-payneteasy-api/blob/e3484aa37b6594231f59b1f43523603aa704f093/source/PaynetEasy/PaynetEasyApi/Util/PropertyAccessor.php#L20-L47 | train |
payneteasy/php-library-payneteasy-api | source/PaynetEasy/PaynetEasyApi/Util/PropertyAccessor.php | PropertyAccessor.setValue | static public function setValue($object, $propertyPath, $propertyValue, $failOnError = true)
{
if (!is_object($object))
{
throw new RuntimeException('Object expected, ' . gettype($object) . ' given');
}
// immediately return value if propertyPath contains only one level
if (strpos($propertyPath, '.') === false)
{
return static::setBySetter($object, $propertyPath, $propertyValue, $failOnError);
}
list($firstPropertyPath, $pathRest) = explode('.', $propertyPath, 2);
$firstObject = static::getByGetter($object, $firstPropertyPath, $failOnError);
// set value recursively while propertyPath has many levels
if (is_object($firstObject))
{
return static::setValue($firstObject, $pathRest, $propertyValue, $failOnError);
}
elseif ($failOnError === true)
{
throw new RuntimeException("Object expected for property path '{$firstPropertyPath}', '" .
gettype($firstObject) . "' given");
}
} | php | static public function setValue($object, $propertyPath, $propertyValue, $failOnError = true)
{
if (!is_object($object))
{
throw new RuntimeException('Object expected, ' . gettype($object) . ' given');
}
// immediately return value if propertyPath contains only one level
if (strpos($propertyPath, '.') === false)
{
return static::setBySetter($object, $propertyPath, $propertyValue, $failOnError);
}
list($firstPropertyPath, $pathRest) = explode('.', $propertyPath, 2);
$firstObject = static::getByGetter($object, $firstPropertyPath, $failOnError);
// set value recursively while propertyPath has many levels
if (is_object($firstObject))
{
return static::setValue($firstObject, $pathRest, $propertyValue, $failOnError);
}
elseif ($failOnError === true)
{
throw new RuntimeException("Object expected for property path '{$firstPropertyPath}', '" .
gettype($firstObject) . "' given");
}
} | [
"static",
"public",
"function",
"setValue",
"(",
"$",
"object",
",",
"$",
"propertyPath",
",",
"$",
"propertyValue",
",",
"$",
"failOnError",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"Runtim... | Set property value by property path.
@param object $object Object with data
@param string $propertyPath Path to property
@param mixed $propertyValue Value to set
@param boolean $failOnError Throw exception if error occurred or not
@return mixed|null Setter return value or null, if error occurred
@throws RuntimeException Property setter not found or parent property is not object | [
"Set",
"property",
"value",
"by",
"property",
"path",
"."
] | e3484aa37b6594231f59b1f43523603aa704f093 | https://github.com/payneteasy/php-library-payneteasy-api/blob/e3484aa37b6594231f59b1f43523603aa704f093/source/PaynetEasy/PaynetEasyApi/Util/PropertyAccessor.php#L61-L88 | train |
payneteasy/php-library-payneteasy-api | source/PaynetEasy/PaynetEasyApi/Util/PropertyAccessor.php | PropertyAccessor.getByGetter | static protected function getByGetter($object, $propertyName, $failOnUnknownGetter)
{
$getter = array($object, 'get' . $propertyName);
if (is_callable($getter))
{
return call_user_func($getter);
}
elseif ($failOnUnknownGetter === true)
{
throw new RuntimeException("Unknown getter for property '{$propertyName}'");
}
} | php | static protected function getByGetter($object, $propertyName, $failOnUnknownGetter)
{
$getter = array($object, 'get' . $propertyName);
if (is_callable($getter))
{
return call_user_func($getter);
}
elseif ($failOnUnknownGetter === true)
{
throw new RuntimeException("Unknown getter for property '{$propertyName}'");
}
} | [
"static",
"protected",
"function",
"getByGetter",
"(",
"$",
"object",
",",
"$",
"propertyName",
",",
"$",
"failOnUnknownGetter",
")",
"{",
"$",
"getter",
"=",
"array",
"(",
"$",
"object",
",",
"'get'",
".",
"$",
"propertyName",
")",
";",
"if",
"(",
"is_c... | Get property value by property name
@param object $object Object with data
@param string $propertyName Property name
@param boolean $failOnUnknownGetter Throw exception if getter not found or not
@return mixed|null Property value or null, if getter not found
@throws RuntimeException Property getter not found | [
"Get",
"property",
"value",
"by",
"property",
"name"
] | e3484aa37b6594231f59b1f43523603aa704f093 | https://github.com/payneteasy/php-library-payneteasy-api/blob/e3484aa37b6594231f59b1f43523603aa704f093/source/PaynetEasy/PaynetEasyApi/Util/PropertyAccessor.php#L101-L113 | train |
payneteasy/php-library-payneteasy-api | source/PaynetEasy/PaynetEasyApi/Util/PropertyAccessor.php | PropertyAccessor.setBySetter | static protected function setBySetter($object, $propertyName, $propertyValue, $failOnUnknownGetter)
{
$setter = array($object, 'set' . $propertyName);
if (is_callable($setter))
{
return call_user_func($setter, $propertyValue);
}
elseif ($failOnUnknownGetter === true)
{
throw new RuntimeException("Unknown setter for property '{$propertyName}'");
}
} | php | static protected function setBySetter($object, $propertyName, $propertyValue, $failOnUnknownGetter)
{
$setter = array($object, 'set' . $propertyName);
if (is_callable($setter))
{
return call_user_func($setter, $propertyValue);
}
elseif ($failOnUnknownGetter === true)
{
throw new RuntimeException("Unknown setter for property '{$propertyName}'");
}
} | [
"static",
"protected",
"function",
"setBySetter",
"(",
"$",
"object",
",",
"$",
"propertyName",
",",
"$",
"propertyValue",
",",
"$",
"failOnUnknownGetter",
")",
"{",
"$",
"setter",
"=",
"array",
"(",
"$",
"object",
",",
"'set'",
".",
"$",
"propertyName",
"... | Set property value by property name
@param object $object Object with data
@param string $propertyName Property name
@param mixed $propertyValue Value to set
@param boolean $failOnUnknownGetter Throw exception if setter not found or not
@return mixed|null Setter return value or null, if setter not found
@throws RuntimeException Property setter not found | [
"Set",
"property",
"value",
"by",
"property",
"name"
] | e3484aa37b6594231f59b1f43523603aa704f093 | https://github.com/payneteasy/php-library-payneteasy-api/blob/e3484aa37b6594231f59b1f43523603aa704f093/source/PaynetEasy/PaynetEasyApi/Util/PropertyAccessor.php#L127-L139 | train |
wangxian/ephp | src/Model/Mongodb.php | ModelMongodb._clear_var | protected function _clear_var()
{
$this->field = array();
$this->limit = '';
$this->skip = '';
$this->where = array();
$this->orderby = array();
$this->data = array();
} | php | protected function _clear_var()
{
$this->field = array();
$this->limit = '';
$this->skip = '';
$this->where = array();
$this->orderby = array();
$this->data = array();
} | [
"protected",
"function",
"_clear_var",
"(",
")",
"{",
"$",
"this",
"->",
"field",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"limit",
"=",
"''",
";",
"$",
"this",
"->",
"skip",
"=",
"''",
";",
"$",
"this",
"->",
"where",
"=",
"array",
"(",
... | Clear unused variable
@access protected
@return void | [
"Clear",
"unused",
"variable"
] | 697248ab098d8dc352de31ab0c64ea0fee1d7132 | https://github.com/wangxian/ephp/blob/697248ab098d8dc352de31ab0c64ea0fee1d7132/src/Model/Mongodb.php#L32-L40 | train |
mikemirten/JsonApi | src/Mapper/Handler/RelationshipHandler.php | RelationshipHandler.createIdentifierCollectionRelationship | protected function createIdentifierCollectionRelationship($object, RelationshipDefinition $definition, MappingContext $context): IdentifierCollectionRelationship
{
$relationship = new IdentifierCollectionRelationship();
$collection = $object->{$definition->getGetter()}();
$dataLimit = $definition->getDataLimit();
if ($dataLimit > 0) {
$collection = new \LimitIterator($collection, 0, $dataLimit);
}
$mapper = $context->getMapper();
foreach ($collection as $relatedObject)
{
$resource = $mapper->toResourceIdentifier($relatedObject);
$relationship->addIdentifier($resource);
}
return $relationship;
} | php | protected function createIdentifierCollectionRelationship($object, RelationshipDefinition $definition, MappingContext $context): IdentifierCollectionRelationship
{
$relationship = new IdentifierCollectionRelationship();
$collection = $object->{$definition->getGetter()}();
$dataLimit = $definition->getDataLimit();
if ($dataLimit > 0) {
$collection = new \LimitIterator($collection, 0, $dataLimit);
}
$mapper = $context->getMapper();
foreach ($collection as $relatedObject)
{
$resource = $mapper->toResourceIdentifier($relatedObject);
$relationship->addIdentifier($resource);
}
return $relationship;
} | [
"protected",
"function",
"createIdentifierCollectionRelationship",
"(",
"$",
"object",
",",
"RelationshipDefinition",
"$",
"definition",
",",
"MappingContext",
"$",
"context",
")",
":",
"IdentifierCollectionRelationship",
"{",
"$",
"relationship",
"=",
"new",
"IdentifierC... | Create relationship contains a collection of resource-identifiers
@param mixed $object
@param RelationshipDefinition $definition
@param MappingContext $context
@return IdentifierCollectionRelationship | [
"Create",
"relationship",
"contains",
"a",
"collection",
"of",
"resource",
"-",
"identifiers"
] | a3c1baf8f753c040f24e4522495b7d34565e6560 | https://github.com/mikemirten/JsonApi/blob/a3c1baf8f753c040f24e4522495b7d34565e6560/src/Mapper/Handler/RelationshipHandler.php#L112-L132 | train |
aimeos/ai-typo3 | lib/custom/src/MShop/Customer/Manager/Typo3.php | Typo3.createItem | public function createItem( array $values = [] )
{
$values['customer.siteid'] = $this->getContext()->getLocale()->getSiteId();
return $this->createItemBase( $values );
} | php | public function createItem( array $values = [] )
{
$values['customer.siteid'] = $this->getContext()->getLocale()->getSiteId();
return $this->createItemBase( $values );
} | [
"public",
"function",
"createItem",
"(",
"array",
"$",
"values",
"=",
"[",
"]",
")",
"{",
"$",
"values",
"[",
"'customer.siteid'",
"]",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
"->",
"getLocale",
"(",
")",
"->",
"getSiteId",
"(",
")",
";",
"re... | Creates a new empty item instance
@param array $values Values the item should be initialized with
@return \Aimeos\MShop\Customer\Item\Iface New site item object | [
"Creates",
"a",
"new",
"empty",
"item",
"instance"
] | 74902c312900c8c5659acd4e85fea61ed1cd7c9a | https://github.com/aimeos/ai-typo3/blob/74902c312900c8c5659acd4e85fea61ed1cd7c9a/lib/custom/src/MShop/Customer/Manager/Typo3.php#L363-L367 | train |
aimeos/ai-typo3 | lib/custom/src/MShop/Customer/Manager/Typo3.php | Typo3.deleteItems | public function deleteItems( array $ids )
{
$path = 'mshop/customer/manager/typo3/delete';
$this->deleteItemsBase( $ids, $path, false, 'uid' );
$manager = $this->getObject()->getSubManager( 'address' );
$search = $manager->createSearch()->setSlice( 0, 0x7fffffff );
$search->setConditions( $search->compare( '==', 'customer.address.parentid', $ids ) );
$manager->deleteItems( array_keys( $manager->searchItems( $search ) ) );
$manager = $this->getObject()->getSubManager( 'lists' );
$search = $manager->createSearch()->setSlice( 0, 0x7fffffff );
$search->setConditions( $search->compare( '==', 'customer.lists.parentid', $ids ) );
$manager->deleteItems( array_keys( $manager->searchItems( $search ) ) );
$manager = $this->getObject()->getSubManager( 'property' );
$search = $manager->createSearch()->setSlice( 0, 0x7fffffff );
$search->setConditions( $search->compare( '==', 'customer.property.parentid', $ids ) );
$manager->deleteItems( array_keys( $manager->searchItems( $search ) ) );
} | php | public function deleteItems( array $ids )
{
$path = 'mshop/customer/manager/typo3/delete';
$this->deleteItemsBase( $ids, $path, false, 'uid' );
$manager = $this->getObject()->getSubManager( 'address' );
$search = $manager->createSearch()->setSlice( 0, 0x7fffffff );
$search->setConditions( $search->compare( '==', 'customer.address.parentid', $ids ) );
$manager->deleteItems( array_keys( $manager->searchItems( $search ) ) );
$manager = $this->getObject()->getSubManager( 'lists' );
$search = $manager->createSearch()->setSlice( 0, 0x7fffffff );
$search->setConditions( $search->compare( '==', 'customer.lists.parentid', $ids ) );
$manager->deleteItems( array_keys( $manager->searchItems( $search ) ) );
$manager = $this->getObject()->getSubManager( 'property' );
$search = $manager->createSearch()->setSlice( 0, 0x7fffffff );
$search->setConditions( $search->compare( '==', 'customer.property.parentid', $ids ) );
$manager->deleteItems( array_keys( $manager->searchItems( $search ) ) );
} | [
"public",
"function",
"deleteItems",
"(",
"array",
"$",
"ids",
")",
"{",
"$",
"path",
"=",
"'mshop/customer/manager/typo3/delete'",
";",
"$",
"this",
"->",
"deleteItemsBase",
"(",
"$",
"ids",
",",
"$",
"path",
",",
"false",
",",
"'uid'",
")",
";",
"$",
"... | Deletes a customer item object from the permanent storage.
@param array $ids List of customer IDs | [
"Deletes",
"a",
"customer",
"item",
"object",
"from",
"the",
"permanent",
"storage",
"."
] | 74902c312900c8c5659acd4e85fea61ed1cd7c9a | https://github.com/aimeos/ai-typo3/blob/74902c312900c8c5659acd4e85fea61ed1cd7c9a/lib/custom/src/MShop/Customer/Manager/Typo3.php#L375-L394 | train |
aimeos/ai-typo3 | lib/custom/src/MShop/Customer/Manager/Typo3.php | Typo3.getSubManager | public function getSubManager( $manager, $name = null )
{
return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Typo3' : $name ) );
} | php | public function getSubManager( $manager, $name = null )
{
return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Typo3' : $name ) );
} | [
"public",
"function",
"getSubManager",
"(",
"$",
"manager",
",",
"$",
"name",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getSubManagerBase",
"(",
"'customer'",
",",
"$",
"manager",
",",
"(",
"$",
"name",
"===",
"null",
"?",
"'Typo3'",
":",
"$... | Returns a new manager for customer extensions
@param string $manager Name of the sub manager type in lower case
@param string|null $name Name of the implementation, will be from configuration (or Default) if null
@return mixed Manager for different extensions, e.g stock, tags, locations, etc. | [
"Returns",
"a",
"new",
"manager",
"for",
"customer",
"extensions"
] | 74902c312900c8c5659acd4e85fea61ed1cd7c9a | https://github.com/aimeos/ai-typo3/blob/74902c312900c8c5659acd4e85fea61ed1cd7c9a/lib/custom/src/MShop/Customer/Manager/Typo3.php#L658-L661 | train |
aimeos/ai-typo3 | lib/custom/src/MShop/Customer/Manager/Typo3.php | Typo3.getPasswordHelper | protected function getPasswordHelper()
{
if( $this->helper ) {
return $this->helper;
}
$classname = \Aimeos\MShop\Common\Helper\Password\Typo3::class;
if( class_exists( $classname ) === false ) {
throw new \Aimeos\MShop\Exception( sprintf( 'Class "%1$s" not available', $classname ) );
}
$context = $this->getContext();
$object = ( method_exists( $context, 'getHasherTypo3' ) ? $context->getHasherTypo3() : null );
$helper = new $classname( array( 'object' => $object ) );
return $this->helper = self::checkClass( \Aimeos\MShop\Common\Helper\Password\Iface::class, $helper );
} | php | protected function getPasswordHelper()
{
if( $this->helper ) {
return $this->helper;
}
$classname = \Aimeos\MShop\Common\Helper\Password\Typo3::class;
if( class_exists( $classname ) === false ) {
throw new \Aimeos\MShop\Exception( sprintf( 'Class "%1$s" not available', $classname ) );
}
$context = $this->getContext();
$object = ( method_exists( $context, 'getHasherTypo3' ) ? $context->getHasherTypo3() : null );
$helper = new $classname( array( 'object' => $object ) );
return $this->helper = self::checkClass( \Aimeos\MShop\Common\Helper\Password\Iface::class, $helper );
} | [
"protected",
"function",
"getPasswordHelper",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"helper",
")",
"{",
"return",
"$",
"this",
"->",
"helper",
";",
"}",
"$",
"classname",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Common",
"\\",
"Helper",
"\\",
... | Returns a password helper object based on the configuration.
@return \Aimeos\MShop\Common\Helper\Password\Iface Password helper object
@throws \Aimeos\MShop\Exception If the name is invalid or the class isn't found | [
"Returns",
"a",
"password",
"helper",
"object",
"based",
"on",
"the",
"configuration",
"."
] | 74902c312900c8c5659acd4e85fea61ed1cd7c9a | https://github.com/aimeos/ai-typo3/blob/74902c312900c8c5659acd4e85fea61ed1cd7c9a/lib/custom/src/MShop/Customer/Manager/Typo3.php#L719-L737 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.i | public static function i($options = array())
{
static $instance;
if (!isset($instance)) {
$instance = new self($options);
if (self::$_config['profiler']['showStart']) {
self::mark('jbdump::start');
}
}
return $instance;
} | php | public static function i($options = array())
{
static $instance;
if (!isset($instance)) {
$instance = new self($options);
if (self::$_config['profiler']['showStart']) {
self::mark('jbdump::start');
}
}
return $instance;
} | [
"public",
"static",
"function",
"i",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"static",
"$",
"instance",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instance",
")",
")",
"{",
"$",
"instance",
"=",
"new",
"self",
"(",
"$",
"options",
")... | Returns the global JBDump object, only creating it
if it doesn't already exist
@param array $options Initialization parameters
@return JBDump | [
"Returns",
"the",
"global",
"JBDump",
"object",
"only",
"creating",
"it",
"if",
"it",
"doesn",
"t",
"already",
"exist"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L365-L378 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.showErrors | public static function showErrors($reportLevel = -1)
{
if (!self::isDebug()) {
return false;
}
if ($reportLevel === null || $reportLevel === false) {
return false;
}
if ($reportLevel != 0) {
error_reporting($reportLevel);
ini_set('error_reporting', $reportLevel);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
} else {
error_reporting(0);
ini_set('error_reporting', 0);
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
}
return true;
} | php | public static function showErrors($reportLevel = -1)
{
if (!self::isDebug()) {
return false;
}
if ($reportLevel === null || $reportLevel === false) {
return false;
}
if ($reportLevel != 0) {
error_reporting($reportLevel);
ini_set('error_reporting', $reportLevel);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
} else {
error_reporting(0);
ini_set('error_reporting', 0);
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
}
return true;
} | [
"public",
"static",
"function",
"showErrors",
"(",
"$",
"reportLevel",
"=",
"-",
"1",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"reportLevel",
"===",
"null",
"||",
"$",
"repo... | Force show PHP error messages
@param $reportLevel error_reporting level
@return bool | [
"Force",
"show",
"PHP",
"error",
"messages"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L485-L509 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.maxTime | public static function maxTime($time = 600)
{
if (!self::isDebug()) {
return false;
}
ini_set('max_execution_time', $time);
set_time_limit($time);
return self::i();
} | php | public static function maxTime($time = 600)
{
if (!self::isDebug()) {
return false;
}
ini_set('max_execution_time', $time);
set_time_limit($time);
return self::i();
} | [
"public",
"static",
"function",
"maxTime",
"(",
"$",
"time",
"=",
"600",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"ini_set",
"(",
"'max_execution_time'",
",",
"$",
"time",
")",
";",
"set_time... | Set max execution time
@param integer $time Time limit in seconds
@return JBDump | [
"Set",
"max",
"execution",
"time"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L516-L526 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.setParams | public function setParams($data, $section = null)
{
if ($section) {
$newData = array($section => $data);
$data = $newData;
unset($newData);
}
if (isset($data['errors']['reporting'])) {
$this->showErrors($data['errors']['reporting']);
}
// set root directory
if (!isset($data['root']) && !self::$_config['root']) {
$data['root'] = $_SERVER['DOCUMENT_ROOT'];
}
// set log path
if (isset($data['log']['path']) && $data['log']['path']) {
$this->_logPath = $data['log']['path'];
} elseif (!self::$_config['log']['path'] || !$this->_logPath) {
$this->_logPath = dirname(__FILE__) . self::DS . 'logs';
}
// set log filename
$logFile = 'jbdump';
if (isset($data['log']['file']) && $data['log']['file']) {
$logFile = $data['log']['file'];
} elseif (!self::$_config['log']['file'] || !$this->_logfile) {
$logFile = 'jbdump';
}
$this->_logfile = $this->_logPath . self::DS . $logFile . '_' . date('Y.m.d') . '.log.php';
// merge new params with of config
foreach ($data as $key => $value) {
if (is_array($value)) {
foreach ($value as $keyInner => $valueInner) {
if (!isset(self::$_config[$key])) {
self::$_config[$key] = array();
}
self::$_config[$key][$keyInner] = $valueInner;
}
} else {
self::$_config[$key] = $value;
}
}
return $this;
} | php | public function setParams($data, $section = null)
{
if ($section) {
$newData = array($section => $data);
$data = $newData;
unset($newData);
}
if (isset($data['errors']['reporting'])) {
$this->showErrors($data['errors']['reporting']);
}
// set root directory
if (!isset($data['root']) && !self::$_config['root']) {
$data['root'] = $_SERVER['DOCUMENT_ROOT'];
}
// set log path
if (isset($data['log']['path']) && $data['log']['path']) {
$this->_logPath = $data['log']['path'];
} elseif (!self::$_config['log']['path'] || !$this->_logPath) {
$this->_logPath = dirname(__FILE__) . self::DS . 'logs';
}
// set log filename
$logFile = 'jbdump';
if (isset($data['log']['file']) && $data['log']['file']) {
$logFile = $data['log']['file'];
} elseif (!self::$_config['log']['file'] || !$this->_logfile) {
$logFile = 'jbdump';
}
$this->_logfile = $this->_logPath . self::DS . $logFile . '_' . date('Y.m.d') . '.log.php';
// merge new params with of config
foreach ($data as $key => $value) {
if (is_array($value)) {
foreach ($value as $keyInner => $valueInner) {
if (!isset(self::$_config[$key])) {
self::$_config[$key] = array();
}
self::$_config[$key][$keyInner] = $valueInner;
}
} else {
self::$_config[$key] = $value;
}
}
return $this;
} | [
"public",
"function",
"setParams",
"(",
"$",
"data",
",",
"$",
"section",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"section",
")",
"{",
"$",
"newData",
"=",
"array",
"(",
"$",
"section",
"=>",
"$",
"data",
")",
";",
"$",
"data",
"=",
"$",
"newData"... | Set debug parameters
@param array $data Params for debug, see self::$_config vars
@param string $section
@return JBDump | [
"Set",
"debug",
"parameters"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L554-L605 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.ip | public static function ip()
{
if (!self::isDebug()) {
return false;
}
$ip = self::getClientIP();
$data = array(
'ip' => $ip,
'host' => gethostbyaddr($ip),
'source' => '$_SERVER["' . self::getClientIP(true) . '"]',
'inet_pton' => inet_pton($ip),
'ip2long' => ip2long($ip),
);
return self::i()->dump($data, '! my IP = ' . $ip . ' !');
} | php | public static function ip()
{
if (!self::isDebug()) {
return false;
}
$ip = self::getClientIP();
$data = array(
'ip' => $ip,
'host' => gethostbyaddr($ip),
'source' => '$_SERVER["' . self::getClientIP(true) . '"]',
'inet_pton' => inet_pton($ip),
'ip2long' => ip2long($ip),
);
return self::i()->dump($data, '! my IP = ' . $ip . ' !');
} | [
"public",
"static",
"function",
"ip",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"ip",
"=",
"self",
"::",
"getClientIP",
"(",
")",
";",
"$",
"data",
"=",
"array",
"(",
"'ip'",
"... | Show client IP
@return JBDump | [
"Show",
"client",
"IP"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L611-L628 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.memory | public static function memory($formated = true)
{
if (!self::isDebug()) {
return false;
}
$memory = self::i()->_getMemory();
if ($formated) {
$memory = self::i()->_formatSize($memory);
}
return self::i()->dump($memory, '! memory !');
} | php | public static function memory($formated = true)
{
if (!self::isDebug()) {
return false;
}
$memory = self::i()->_getMemory();
if ($formated) {
$memory = self::i()->_formatSize($memory);
}
return self::i()->dump($memory, '! memory !');
} | [
"public",
"static",
"function",
"memory",
"(",
"$",
"formated",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"memory",
"=",
"self",
"::",
"i",
"(",
")",
"->",
"_getMemory",
... | Show current usage memory in filesize format
@return JBDump | [
"Show",
"current",
"usage",
"memory",
"in",
"filesize",
"format"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L775-L787 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.functions | public static function functions($showInternal = false)
{
if (!self::isDebug()) {
return false;
}
$functions = get_defined_functions();
if ($showInternal) {
$functions = $functions['internal'];
$type = 'internal';
} else {
$functions = $functions['user'];
$type = 'user';
}
return self::i()->dump($functions, '! functions (' . $type . ') !');
} | php | public static function functions($showInternal = false)
{
if (!self::isDebug()) {
return false;
}
$functions = get_defined_functions();
if ($showInternal) {
$functions = $functions['internal'];
$type = 'internal';
} else {
$functions = $functions['user'];
$type = 'user';
}
return self::i()->dump($functions, '! functions (' . $type . ') !');
} | [
"public",
"static",
"function",
"functions",
"(",
"$",
"showInternal",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"functions",
"=",
"get_defined_functions",
"(",
")",
";",
"if"... | Show defined functions
@param bool $showInternal Get only internal functions
@return JBDump | [
"Show",
"defined",
"functions"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L841-L857 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.defines | public static function defines($showAll = false)
{
if (!self::isDebug()) {
return false;
}
$defines = get_defined_constants(true);
if (!$showAll) {
$defines = (isset($defines['user'])) ? $defines['user'] : array();
}
return self::i()->dump($defines, '! defines !');
} | php | public static function defines($showAll = false)
{
if (!self::isDebug()) {
return false;
}
$defines = get_defined_constants(true);
if (!$showAll) {
$defines = (isset($defines['user'])) ? $defines['user'] : array();
}
return self::i()->dump($defines, '! defines !');
} | [
"public",
"static",
"function",
"defines",
"(",
"$",
"showAll",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"defines",
"=",
"get_defined_constants",
"(",
"true",
")",
";",
"if... | Show defined constants
@param bool $showAll Get only user defined functions
@return bool|JBDump | [
"Show",
"defined",
"constants"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L864-L876 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.extensions | public static function extensions($zend = false)
{
if (!self::isDebug()) {
return false;
}
return self::i()->dump(get_loaded_extensions($zend), '! extensions ' . ($zend ? '(Zend)' : '') . ' !');
} | php | public static function extensions($zend = false)
{
if (!self::isDebug()) {
return false;
}
return self::i()->dump(get_loaded_extensions($zend), '! extensions ' . ($zend ? '(Zend)' : '') . ' !');
} | [
"public",
"static",
"function",
"extensions",
"(",
"$",
"zend",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"self",
"::",
"i",
"(",
")",
"->",
"dump",
"(",
"get_loaded_... | Show loaded PHP extensions
@param bool $zend Get only Zend extensions
@return JBDump | [
"Show",
"loaded",
"PHP",
"extensions"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L883-L889 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.headers | public static function headers()
{
if (!self::isDebug()) {
return false;
}
if (function_exists('apache_request_headers')) {
$data = array(
'Request' => apache_request_headers(),
'Response' => apache_response_headers(),
'List' => headers_list()
);
} else {
$data = array(
'List' => headers_list()
);
}
if (headers_sent($filename, $linenum)) {
$data['Sent'] = 'Headers already sent in ' . self::i()->_getRalativePath($filename) . ':' . $linenum;
} else {
$data['Sent'] = false;
}
return self::i()->dump($data, '! headers !');
} | php | public static function headers()
{
if (!self::isDebug()) {
return false;
}
if (function_exists('apache_request_headers')) {
$data = array(
'Request' => apache_request_headers(),
'Response' => apache_response_headers(),
'List' => headers_list()
);
} else {
$data = array(
'List' => headers_list()
);
}
if (headers_sent($filename, $linenum)) {
$data['Sent'] = 'Headers already sent in ' . self::i()->_getRalativePath($filename) . ':' . $linenum;
} else {
$data['Sent'] = false;
}
return self::i()->dump($data, '! headers !');
} | [
"public",
"static",
"function",
"headers",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"function_exists",
"(",
"'apache_request_headers'",
")",
")",
"{",
"$",
"data",
"=",
"array",... | Show HTTP headers
@return JBDump | [
"Show",
"HTTP",
"headers"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L895-L921 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.path | public static function path()
{
if (!self::isDebug()) {
return false;
}
$result = array(
'get_include_path' => explode(PATH_SEPARATOR, trim(get_include_path(), PATH_SEPARATOR)),
'$_SERVER[PATH]' => explode(PATH_SEPARATOR, trim($_SERVER['PATH'], PATH_SEPARATOR))
);
return self::i()->dump($result, '! paths !');
} | php | public static function path()
{
if (!self::isDebug()) {
return false;
}
$result = array(
'get_include_path' => explode(PATH_SEPARATOR, trim(get_include_path(), PATH_SEPARATOR)),
'$_SERVER[PATH]' => explode(PATH_SEPARATOR, trim($_SERVER['PATH'], PATH_SEPARATOR))
);
return self::i()->dump($result, '! paths !');
} | [
"public",
"static",
"function",
"path",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"result",
"=",
"array",
"(",
"'get_include_path'",
"=>",
"explode",
"(",
"PATH_SEPARATOR",
",",
"trim"... | Show included and system paths
@return JBDump | [
"Show",
"included",
"and",
"system",
"paths"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L968-L980 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.json | public static function json($json, $name = '...')
{
if (!self::isDebug()) {
return false;
}
$jsonData = json_decode($json);
$result = self::i()->_jsonEncode($jsonData);
return self::i()->dump($result, $name);
} | php | public static function json($json, $name = '...')
{
if (!self::isDebug()) {
return false;
}
$jsonData = json_decode($json);
$result = self::i()->_jsonEncode($jsonData);
return self::i()->dump($result, $name);
} | [
"public",
"static",
"function",
"json",
"(",
"$",
"json",
",",
"$",
"name",
"=",
"'...'",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"jsonData",
"=",
"json_decode",
"(",
"$",
"json",
"... | Convert JSON format to human readability
@param $json
@param string $name
@return bool|JBDump | [
"Convert",
"JSON",
"format",
"to",
"human",
"readability"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1045-L1055 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.timestamp | public static function timestamp($timestamp = null)
{
if (!self::isDebug()) {
return false;
}
$date = date(DATE_RFC822, $timestamp);
return self::i()->dump($date, $timestamp . ' sec = ');
} | php | public static function timestamp($timestamp = null)
{
if (!self::isDebug()) {
return false;
}
$date = date(DATE_RFC822, $timestamp);
return self::i()->dump($date, $timestamp . ' sec = ');
} | [
"public",
"static",
"function",
"timestamp",
"(",
"$",
"timestamp",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"date",
"=",
"date",
"(",
"DATE_RFC822",
",",
"$",
"timestamp",
... | Convert timestamp to normal date, in DATE_RFC822 format
@param null|integer $timestamp Time in Unix timestamp format
@return bool|JBDump | [
"Convert",
"timestamp",
"to",
"normal",
"date",
"in",
"DATE_RFC822",
"format"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1105-L1113 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.locale | public static function locale()
{
if (!self::isDebug()) {
return false;
}
ob_start();
@system('locale -a');
$locale = explode(PHP_EOL, trim(ob_get_contents()));
ob_end_clean();
$result = array(
'list' => $locale,
'conv' => @localeconv()
);
return self::i()->dump($result, '! locale info !');
} | php | public static function locale()
{
if (!self::isDebug()) {
return false;
}
ob_start();
@system('locale -a');
$locale = explode(PHP_EOL, trim(ob_get_contents()));
ob_end_clean();
$result = array(
'list' => $locale,
'conv' => @localeconv()
);
return self::i()->dump($result, '! locale info !');
} | [
"public",
"static",
"function",
"locale",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"ob_start",
"(",
")",
";",
"@",
"system",
"(",
"'locale -a'",
")",
";",
"$",
"locale",
"=",
"explode"... | Find all locale in system
list - only for linux like systems
@return JBDump | [
"Find",
"all",
"locale",
"in",
"system",
"list",
"-",
"only",
"for",
"linux",
"like",
"systems"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1230-L1247 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.timezone | public static function timezone()
{
if (!self::isDebug()) {
return false;
}
$data = date_default_timezone_get();
return self::i()->dump($data, '! timezone !');
} | php | public static function timezone()
{
if (!self::isDebug()) {
return false;
}
$data = date_default_timezone_get();
return self::i()->dump($data, '! timezone !');
} | [
"public",
"static",
"function",
"timezone",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"data",
"=",
"date_default_timezone_get",
"(",
")",
";",
"return",
"self",
"::",
"i",
"(",
")",
... | Show date default timezone
@return JBDump | [
"Show",
"date",
"default",
"timezone"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1253-L1261 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.print_r | public static function print_r($var, $varname = '...', $params = array())
{
if (!self::isDebug()) {
return false;
}
$output = print_r($var, true);
$_this = self::i();
$_this->_dumpRenderHtml($output, $varname, $params);
return $_this;
} | php | public static function print_r($var, $varname = '...', $params = array())
{
if (!self::isDebug()) {
return false;
}
$output = print_r($var, true);
$_this = self::i();
$_this->_dumpRenderHtml($output, $varname, $params);
return $_this;
} | [
"public",
"static",
"function",
"print_r",
"(",
"$",
"var",
",",
"$",
"varname",
"=",
"'...'",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
... | Wrapper for PHP print_r function
@param mixed $var The variable to dump
@param string $varname Label to prepend to output
@param array $params Echo output if true
@return bool|JBDump | [
"Wrapper",
"for",
"PHP",
"print_r",
"function"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1270-L1282 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.phpArray | public static function phpArray($var, $varname = 'varName', $isReturn = false)
{
if (!self::isDebug()) {
return false;
}
$output = JBDump_array2php::toString($var, $varname);
if ($isReturn) {
return $output;
}
$_this = self::i();
$_this->_dumpRenderHtml($output, $varname, $params);
return $_this;
} | php | public static function phpArray($var, $varname = 'varName', $isReturn = false)
{
if (!self::isDebug()) {
return false;
}
$output = JBDump_array2php::toString($var, $varname);
if ($isReturn) {
return $output;
}
$_this = self::i();
$_this->_dumpRenderHtml($output, $varname, $params);
return $_this;
} | [
"public",
"static",
"function",
"phpArray",
"(",
"$",
"var",
",",
"$",
"varname",
"=",
"'varName'",
",",
"$",
"isReturn",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"output... | Render variable as phpArray
@param mixed $var
@param string $name
@param bool $isReturn
@return mixed | [
"Render",
"variable",
"as",
"phpArray"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1291-L1306 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.var_dump | public static function var_dump($var, $varname = '...', $params = array())
{
if (!self::isDebug()) {
return false;
}
// var_dump the variable into a buffer and keep the output
ob_start();
var_dump($var);
$output = ob_get_clean();
$_this = self::i();
// neaten the newlines and indents
$output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
//if (!extension_loaded('xdebug')) {
$output = $_this->_htmlChars($output);
//}
$_this->_dumpRenderHtml($output, $varname . '::html', $params);
return $_this;
} | php | public static function var_dump($var, $varname = '...', $params = array())
{
if (!self::isDebug()) {
return false;
}
// var_dump the variable into a buffer and keep the output
ob_start();
var_dump($var);
$output = ob_get_clean();
$_this = self::i();
// neaten the newlines and indents
$output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
//if (!extension_loaded('xdebug')) {
$output = $_this->_htmlChars($output);
//}
$_this->_dumpRenderHtml($output, $varname . '::html', $params);
return $_this;
} | [
"public",
"static",
"function",
"var_dump",
"(",
"$",
"var",
",",
"$",
"varname",
"=",
"'...'",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"// va... | Wrapper for PHP var_dump function
@param mixed $var The variable to dump
@param string $varname Echo output if true
@param array $params Additionls params
@return bool|JBDump | [
"Wrapper",
"for",
"PHP",
"var_dump",
"function"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1315-L1336 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.trace | public static function trace($trace = null, $addObject = false)
{
if (!self::isDebug()) {
return false;
}
$_this = self::i();
$trace = $trace ? $trace : debug_backtrace($addObject);
unset($trace[0]);
$result = $_this->convertTrace($trace, $addObject);
return $_this->dump($result, '! backtrace !');
} | php | public static function trace($trace = null, $addObject = false)
{
if (!self::isDebug()) {
return false;
}
$_this = self::i();
$trace = $trace ? $trace : debug_backtrace($addObject);
unset($trace[0]);
$result = $_this->convertTrace($trace, $addObject);
return $_this->dump($result, '! backtrace !');
} | [
"public",
"static",
"function",
"trace",
"(",
"$",
"trace",
"=",
"null",
",",
"$",
"addObject",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"_this",
"=",
"self",
"::",
"i"... | Get system backtrace in formated view
@param bool $trace Custom php backtrace
@param bool $addObject Show objects in result
@return JBDump | [
"Get",
"system",
"backtrace",
"in",
"formated",
"view"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1344-L1358 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.extInfo | public static function extInfo($extensionName)
{
$result = self::_getExtension($extensionName);
if ($result) {
$extensionName = $result['name'];
}
return self::i()->dump($result, '! extension (' . $extensionName . ') !');
} | php | public static function extInfo($extensionName)
{
$result = self::_getExtension($extensionName);
if ($result) {
$extensionName = $result['name'];
}
return self::i()->dump($result, '! extension (' . $extensionName . ') !');
} | [
"public",
"static",
"function",
"extInfo",
"(",
"$",
"extensionName",
")",
"{",
"$",
"result",
"=",
"self",
"::",
"_getExtension",
"(",
"$",
"extensionName",
")",
";",
"if",
"(",
"$",
"result",
")",
"{",
"$",
"extensionName",
"=",
"$",
"result",
"[",
"... | Dump all info about extension
@param string $extensionName Extension name
@return JBDump | [
"Dump",
"all",
"info",
"about",
"extension"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1420-L1429 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.pathInfo | public static function pathInfo($file)
{
$result = self::_pathInfo($file);
return self::i()->dump($result, '! pathInfo (' . $file . ') !');
} | php | public static function pathInfo($file)
{
$result = self::_pathInfo($file);
return self::i()->dump($result, '! pathInfo (' . $file . ') !');
} | [
"public",
"static",
"function",
"pathInfo",
"(",
"$",
"file",
")",
"{",
"$",
"result",
"=",
"self",
"::",
"_pathInfo",
"(",
"$",
"file",
")",
";",
"return",
"self",
"::",
"i",
"(",
")",
"->",
"dump",
"(",
"$",
"result",
",",
"'! pathInfo ('",
".",
... | Dump all file info
@param string $file path to file
@return JBDump | [
"Dump",
"all",
"file",
"info"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1436-L1440 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.funcInfo | public static function funcInfo($functionName)
{
$result = self::_getFunction($functionName);
if ($result) {
$functionName = $result['name'];
}
return self::i()->dump($result, '! function (' . $functionName . ') !');
} | php | public static function funcInfo($functionName)
{
$result = self::_getFunction($functionName);
if ($result) {
$functionName = $result['name'];
}
return self::i()->dump($result, '! function (' . $functionName . ') !');
} | [
"public",
"static",
"function",
"funcInfo",
"(",
"$",
"functionName",
")",
"{",
"$",
"result",
"=",
"self",
"::",
"_getFunction",
"(",
"$",
"functionName",
")",
";",
"if",
"(",
"$",
"result",
")",
"{",
"$",
"functionName",
"=",
"$",
"result",
"[",
"'na... | Dump all info about function
@param string|Closure $functionName Closure or function name
@return JBDump | [
"Dump",
"all",
"info",
"about",
"function"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1447-L1454 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.microtime | public static function microtime()
{
$_this = self::i();
if (!$_this->isDebug()) {
return false;
}
$data = $_this->_microtime();
return $_this->dump($data, '! current microtime !');
} | php | public static function microtime()
{
$_this = self::i();
if (!$_this->isDebug()) {
return false;
}
$data = $_this->_microtime();
return $_this->dump($data, '! current microtime !');
} | [
"public",
"static",
"function",
"microtime",
"(",
")",
"{",
"$",
"_this",
"=",
"self",
"::",
"i",
"(",
")",
";",
"if",
"(",
"!",
"$",
"_this",
"->",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"data",
"=",
"$",
"_this",
"->... | Show current microtime
@return JBDump | [
"Show",
"current",
"microtime"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1460-L1470 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.mark | public static function mark($label = '')
{
$_this = self::i();
if (!$_this->isDebug()) {
return false;
}
$current = $_this->_microtime() - $_this->_start;
$memory = self::_getMemory();
$trace = debug_backtrace();
$markInfo = array(
'time' => $current,
'timeDiff' => $current - $_this->_prevTime,
'memory' => $memory,
'memoryDiff' => $memory - $_this->_prevMemory,
'trace' => $_this->_getSourcePath($trace, true),
'label' => $label,
);
$_this->_bufferInfo[] = $markInfo;
if ((int)self::$_config['profiler']['render'] & self::PROFILER_RENDER_FILE) {
$_this->log(self::_profilerFormatMark($markInfo), 'mark #');
}
$_this->_prevTime = $current;
$_this->_prevMemory = $memory;
return $_this;
} | php | public static function mark($label = '')
{
$_this = self::i();
if (!$_this->isDebug()) {
return false;
}
$current = $_this->_microtime() - $_this->_start;
$memory = self::_getMemory();
$trace = debug_backtrace();
$markInfo = array(
'time' => $current,
'timeDiff' => $current - $_this->_prevTime,
'memory' => $memory,
'memoryDiff' => $memory - $_this->_prevMemory,
'trace' => $_this->_getSourcePath($trace, true),
'label' => $label,
);
$_this->_bufferInfo[] = $markInfo;
if ((int)self::$_config['profiler']['render'] & self::PROFILER_RENDER_FILE) {
$_this->log(self::_profilerFormatMark($markInfo), 'mark #');
}
$_this->_prevTime = $current;
$_this->_prevMemory = $memory;
return $_this;
} | [
"public",
"static",
"function",
"mark",
"(",
"$",
"label",
"=",
"''",
")",
"{",
"$",
"_this",
"=",
"self",
"::",
"i",
"(",
")",
";",
"if",
"(",
"!",
"$",
"_this",
"->",
"isDebug",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"current",... | Output a time mark
The mark is returned as text current profiler status
@param string $label A label for the time mark
@return JBDump | [
"Output",
"a",
"time",
"mark",
"The",
"mark",
"is",
"returned",
"as",
"text",
"current",
"profiler",
"status"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1619-L1649 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.profiler | public function profiler($mode = 1)
{
if ($this->isDebug() && count($this->_bufferInfo) > 2 && $mode) {
$mode = (int)$mode;
if ($mode && self::isAjax()) {
if ($mode & self::PROFILER_RENDER_TOTAL) {
$this->_profilerRenderTotal();
}
} else {
if ($mode & self::PROFILER_RENDER_TABLE) {
$this->_profilerRenderTable();
}
if ($mode & self::PROFILER_RENDER_CHART) {
$this->_profilerRenderChart();
}
if ($mode & self::PROFILER_RENDER_TOTAL) {
$this->_profilerRenderTotal();
}
if ($mode & self::PROFILER_RENDER_ECHO) {
$this->_profilerRenderEcho();
}
}
}
} | php | public function profiler($mode = 1)
{
if ($this->isDebug() && count($this->_bufferInfo) > 2 && $mode) {
$mode = (int)$mode;
if ($mode && self::isAjax()) {
if ($mode & self::PROFILER_RENDER_TOTAL) {
$this->_profilerRenderTotal();
}
} else {
if ($mode & self::PROFILER_RENDER_TABLE) {
$this->_profilerRenderTable();
}
if ($mode & self::PROFILER_RENDER_CHART) {
$this->_profilerRenderChart();
}
if ($mode & self::PROFILER_RENDER_TOTAL) {
$this->_profilerRenderTotal();
}
if ($mode & self::PROFILER_RENDER_ECHO) {
$this->_profilerRenderEcho();
}
}
}
} | [
"public",
"function",
"profiler",
"(",
"$",
"mode",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDebug",
"(",
")",
"&&",
"count",
"(",
"$",
"this",
"->",
"_bufferInfo",
")",
">",
"2",
"&&",
"$",
"mode",
")",
"{",
"$",
"mode",
"=",
"(",
... | Show profiler result
@param int $mode Render mode
@return JBDump | [
"Show",
"profiler",
"result"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1656-L1685 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._profilerFormatMemory | protected static function _profilerFormatMemory($memoryBytes, $addMeasure = false)
{
$bytes = round($memoryBytes / 1024 / 1024, 3);
if ($addMeasure) {
$bytes .= ' MB';
}
return $bytes;
} | php | protected static function _profilerFormatMemory($memoryBytes, $addMeasure = false)
{
$bytes = round($memoryBytes / 1024 / 1024, 3);
if ($addMeasure) {
$bytes .= ' MB';
}
return $bytes;
} | [
"protected",
"static",
"function",
"_profilerFormatMemory",
"(",
"$",
"memoryBytes",
",",
"$",
"addMeasure",
"=",
"false",
")",
"{",
"$",
"bytes",
"=",
"round",
"(",
"$",
"memoryBytes",
"/",
"1024",
"/",
"1024",
",",
"3",
")",
";",
"if",
"(",
"$",
"add... | Convert profiler memory value to usability view
@param int $memoryBytes
@param bool $addMeasure
@return float | [
"Convert",
"profiler",
"memory",
"value",
"to",
"usability",
"view"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1722-L1731 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._profilerFormatTime | protected static function _profilerFormatTime($time, $addMeasure = false, $round = 0)
{
$time = round($time * 1000, $round);
if ($addMeasure) {
$time .= ' ms';
}
return $time;
} | php | protected static function _profilerFormatTime($time, $addMeasure = false, $round = 0)
{
$time = round($time * 1000, $round);
if ($addMeasure) {
$time .= ' ms';
}
return $time;
} | [
"protected",
"static",
"function",
"_profilerFormatTime",
"(",
"$",
"time",
",",
"$",
"addMeasure",
"=",
"false",
",",
"$",
"round",
"=",
"0",
")",
"{",
"$",
"time",
"=",
"round",
"(",
"$",
"time",
"*",
"1000",
",",
"$",
"round",
")",
";",
"if",
"(... | Convert profiler time value to usability view
@param $time
@param bool $addMeasure
@return float | [
"Convert",
"profiler",
"time",
"value",
"to",
"usability",
"view"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1739-L1748 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._profilerFormatMark | protected static function _profilerFormatMark(array $mark)
{
return sprintf("%0.3f sec (+%.3f); %0.3f MB (%s%0.3f) - %s",
(float)$mark['time'],
(float)$mark['timeDiff'],
($mark['memory'] / 1024 / 1024),
($mark['memoryDiff'] / 1024 / 1024 >= 0) ? '+' : '',
($mark['memoryDiff'] / 1024 / 1024),
$mark['label']
);
} | php | protected static function _profilerFormatMark(array $mark)
{
return sprintf("%0.3f sec (+%.3f); %0.3f MB (%s%0.3f) - %s",
(float)$mark['time'],
(float)$mark['timeDiff'],
($mark['memory'] / 1024 / 1024),
($mark['memoryDiff'] / 1024 / 1024 >= 0) ? '+' : '',
($mark['memoryDiff'] / 1024 / 1024),
$mark['label']
);
} | [
"protected",
"static",
"function",
"_profilerFormatMark",
"(",
"array",
"$",
"mark",
")",
"{",
"return",
"sprintf",
"(",
"\"%0.3f sec (+%.3f); %0.3f MB (%s%0.3f) - %s\"",
",",
"(",
"float",
")",
"$",
"mark",
"[",
"'time'",
"]",
",",
"(",
"float",
")",
"$",
"ma... | Convert profiler mark to string
@param array $mark
@return string | [
"Convert",
"profiler",
"mark",
"to",
"string"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1755-L1765 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._profilerRenderTotal | protected function _profilerRenderTotal()
{
reset($this->_bufferInfo);
$first = current($this->_bufferInfo);
$last = end($this->_bufferInfo);
$memoryPeak = memory_get_peak_usage(true);
$memoryDeltas = $timeDeltas = array();
foreach ($this->_bufferInfo as $oneMark) {
$memoryDeltas[] = $oneMark['memoryDiff'];
$timeDeltas[] = $oneMark['timeDiff'];
}
$totalInfo = array();
$totalInfo[] = '- Points: ' . count($this->_bufferInfo);
$totalInfo[] = '-------- Time (ms)';
$totalInfo[] = '- Max delta, msec: ' . self::_profilerFormatTime(max($timeDeltas));
$totalInfo[] = '- Min delta, msec: ' . self::_profilerFormatTime(min($timeDeltas));
$totalInfo[] = '- Total delta, msec: ' . self::_profilerFormatTime(($last['time'] - $first['time']));
$totalInfo[] = '- Limit, sec: ' . ini_get('max_execution_time');
$totalInfo[] = '-------- Memory (MB)';
$totalInfo[] = '- Max delta: ' . self::_profilerFormatMemory(max($memoryDeltas));
$totalInfo[] = '- Min delta: ' . self::_profilerFormatMemory(min($memoryDeltas));
$totalInfo[] = '- Usage on peak: ' . $this->_formatSize($memoryPeak) . ' (' . $memoryPeak . ')';
$totalInfo[] = '- Total delta: ' . self::_profilerFormatMemory($last['memory'] - $first['memory']);
$totalInfo[] = '- Limit: ' . ini_get('memory_limit');
if (self::isAjax()) {
$this->_dumpRenderLog($totalInfo, 'Profiler total');
} else {
$totalInfo = PHP_EOL . "\t" . implode(PHP_EOL . "\t", $totalInfo) . PHP_EOL;
$this->_dumpRenderLite($totalInfo, '! <b>profiler total info</b> !');
}
} | php | protected function _profilerRenderTotal()
{
reset($this->_bufferInfo);
$first = current($this->_bufferInfo);
$last = end($this->_bufferInfo);
$memoryPeak = memory_get_peak_usage(true);
$memoryDeltas = $timeDeltas = array();
foreach ($this->_bufferInfo as $oneMark) {
$memoryDeltas[] = $oneMark['memoryDiff'];
$timeDeltas[] = $oneMark['timeDiff'];
}
$totalInfo = array();
$totalInfo[] = '- Points: ' . count($this->_bufferInfo);
$totalInfo[] = '-------- Time (ms)';
$totalInfo[] = '- Max delta, msec: ' . self::_profilerFormatTime(max($timeDeltas));
$totalInfo[] = '- Min delta, msec: ' . self::_profilerFormatTime(min($timeDeltas));
$totalInfo[] = '- Total delta, msec: ' . self::_profilerFormatTime(($last['time'] - $first['time']));
$totalInfo[] = '- Limit, sec: ' . ini_get('max_execution_time');
$totalInfo[] = '-------- Memory (MB)';
$totalInfo[] = '- Max delta: ' . self::_profilerFormatMemory(max($memoryDeltas));
$totalInfo[] = '- Min delta: ' . self::_profilerFormatMemory(min($memoryDeltas));
$totalInfo[] = '- Usage on peak: ' . $this->_formatSize($memoryPeak) . ' (' . $memoryPeak . ')';
$totalInfo[] = '- Total delta: ' . self::_profilerFormatMemory($last['memory'] - $first['memory']);
$totalInfo[] = '- Limit: ' . ini_get('memory_limit');
if (self::isAjax()) {
$this->_dumpRenderLog($totalInfo, 'Profiler total');
} else {
$totalInfo = PHP_EOL . "\t" . implode(PHP_EOL . "\t", $totalInfo) . PHP_EOL;
$this->_dumpRenderLite($totalInfo, '! <b>profiler total info</b> !');
}
} | [
"protected",
"function",
"_profilerRenderTotal",
"(",
")",
"{",
"reset",
"(",
"$",
"this",
"->",
"_bufferInfo",
")",
";",
"$",
"first",
"=",
"current",
"(",
"$",
"this",
"->",
"_bufferInfo",
")",
";",
"$",
"last",
"=",
"end",
"(",
"$",
"this",
"->",
... | Profiler render - total info | [
"Profiler",
"render",
"-",
"total",
"info"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1770-L1803 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._profilerRenderFile | protected function _profilerRenderFile()
{
$this->log('-------------------------------------------------------', 'Profiler start');
foreach ($this->_bufferInfo as $key => $mark) {
$this->log(self::_profilerFormatMark($mark));
}
$this->log('-------------------------------------------------------', 'Profiler end');
} | php | protected function _profilerRenderFile()
{
$this->log('-------------------------------------------------------', 'Profiler start');
foreach ($this->_bufferInfo as $key => $mark) {
$this->log(self::_profilerFormatMark($mark));
}
$this->log('-------------------------------------------------------', 'Profiler end');
} | [
"protected",
"function",
"_profilerRenderFile",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'-------------------------------------------------------'",
",",
"'Profiler start'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_bufferInfo",
"as",
"$",
"key",
"=>",
... | Profile render - to log file | [
"Profile",
"render",
"-",
"to",
"log",
"file"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1808-L1815 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._profilerRenderEcho | protected function _profilerRenderEcho()
{
$output = PHP_EOL;
foreach ($this->_bufferInfo as $key => $mark) {
$output .= "\t" . self::_profilerFormatMark($mark) . PHP_EOL;
}
$this->_dumpRenderLite($output, '! profiler !');
} | php | protected function _profilerRenderEcho()
{
$output = PHP_EOL;
foreach ($this->_bufferInfo as $key => $mark) {
$output .= "\t" . self::_profilerFormatMark($mark) . PHP_EOL;
}
$this->_dumpRenderLite($output, '! profiler !');
} | [
"protected",
"function",
"_profilerRenderEcho",
"(",
")",
"{",
"$",
"output",
"=",
"PHP_EOL",
";",
"foreach",
"(",
"$",
"this",
"->",
"_bufferInfo",
"as",
"$",
"key",
"=>",
"$",
"mark",
")",
"{",
"$",
"output",
".=",
"\"\\t\"",
".",
"self",
"::",
"_pro... | Profile render - echo lite | [
"Profile",
"render",
"-",
"echo",
"lite"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1820-L1827 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._dumpRenderHtml | protected function _dumpRenderHtml($data, $varname = '...', $params = array())
{
$this->_currentDepth = 0;
$this->_initAssets();
if (isset($params['trace'])) {
$this->_trace = $params['trace'];
} else {
$this->_trace = debug_backtrace();
}
$text = $this->_getSourceFunction($this->_trace);
$path = $this->_getSourcePath($this->_trace);
?>
<div id="jbdump">
<ul class="jbnode">
<?php $this->_dump($data, $varname); ?>
<li class="jbfooter">
<div class="jbversion">
<a href="<?php echo $this->_site; ?>" target="_blank">JBDump v<?php echo self::VERSION; ?></a>
</div>
<?php if (self::$_config['showCall']) : ?>
<div class="jbpath"><?php echo $text . ' ' . $path; ?></div>
<?php endif; ?>
</li>
</ul>
</div>
<?php
} | php | protected function _dumpRenderHtml($data, $varname = '...', $params = array())
{
$this->_currentDepth = 0;
$this->_initAssets();
if (isset($params['trace'])) {
$this->_trace = $params['trace'];
} else {
$this->_trace = debug_backtrace();
}
$text = $this->_getSourceFunction($this->_trace);
$path = $this->_getSourcePath($this->_trace);
?>
<div id="jbdump">
<ul class="jbnode">
<?php $this->_dump($data, $varname); ?>
<li class="jbfooter">
<div class="jbversion">
<a href="<?php echo $this->_site; ?>" target="_blank">JBDump v<?php echo self::VERSION; ?></a>
</div>
<?php if (self::$_config['showCall']) : ?>
<div class="jbpath"><?php echo $text . ' ' . $path; ?></div>
<?php endif; ?>
</li>
</ul>
</div>
<?php
} | [
"protected",
"function",
"_dumpRenderHtml",
"(",
"$",
"data",
",",
"$",
"varname",
"=",
"'...'",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_currentDepth",
"=",
"0",
";",
"$",
"this",
"->",
"_initAssets",
"(",
")",
";",... | Dump render - HTML
@param mixed $data
@param string $varname
@param array $params | [
"Dump",
"render",
"-",
"HTML"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L1989-L2017 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._dumpRenderLite | protected function _dumpRenderLite($data, $varname = '...', $params = array())
{
if (is_bool($data)) {
$data = $data ? 'TRUE' : 'FALSE';
} elseif (is_null($data)) {
$data = 'NULL';
}
if (is_string($data) && strlen($data) == 0) {
$printrOut = '""';
} else {
$printrOut = print_r($data, true);
}
if (!self::isCli()) {
$printrOut = $this->_htmlChars($printrOut);
}
if (self::isAjax()) {
$printrOut = str_replace('] =>', '] =>', $printrOut);
}
$output = array();
if (!self::isCli()) {
$output[] = '<pre>------------------------------' . PHP_EOL;
}
$output[] = $varname . ' = ';
$output[] = rtrim($printrOut, PHP_EOL);
if (!self::isCli()) {
$output[] = PHP_EOL . '------------------------------</pre>' . PHP_EOL;
} else {
$output[] = PHP_EOL;
}
if (!self::isAjax()) {
echo '<pre class="jbdump" style="text-align: left;">' . implode('', $output) . '</pre>' . PHP_EOL;
} else {
echo implode('', $output);
}
} | php | protected function _dumpRenderLite($data, $varname = '...', $params = array())
{
if (is_bool($data)) {
$data = $data ? 'TRUE' : 'FALSE';
} elseif (is_null($data)) {
$data = 'NULL';
}
if (is_string($data) && strlen($data) == 0) {
$printrOut = '""';
} else {
$printrOut = print_r($data, true);
}
if (!self::isCli()) {
$printrOut = $this->_htmlChars($printrOut);
}
if (self::isAjax()) {
$printrOut = str_replace('] =>', '] =>', $printrOut);
}
$output = array();
if (!self::isCli()) {
$output[] = '<pre>------------------------------' . PHP_EOL;
}
$output[] = $varname . ' = ';
$output[] = rtrim($printrOut, PHP_EOL);
if (!self::isCli()) {
$output[] = PHP_EOL . '------------------------------</pre>' . PHP_EOL;
} else {
$output[] = PHP_EOL;
}
if (!self::isAjax()) {
echo '<pre class="jbdump" style="text-align: left;">' . implode('', $output) . '</pre>' . PHP_EOL;
} else {
echo implode('', $output);
}
} | [
"protected",
"function",
"_dumpRenderLite",
"(",
"$",
"data",
",",
"$",
"varname",
"=",
"'...'",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"$",
"data",
"?",
"'TR... | Dump render - Lite mode
@param mixed $data
@param string $varname
@param array $params | [
"Dump",
"render",
"-",
"Lite",
"mode"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2025-L2066 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.hash | public static function hash($data)
{
$result = array();
foreach (hash_algos() as $algoritm) {
$result[$algoritm] = hash($algoritm, $data, false);
}
return self::i()->dump($result, '! hash !');
} | php | public static function hash($data)
{
$result = array();
foreach (hash_algos() as $algoritm) {
$result[$algoritm] = hash($algoritm, $data, false);
}
return self::i()->dump($result, '! hash !');
} | [
"public",
"static",
"function",
"hash",
"(",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"hash_algos",
"(",
")",
"as",
"$",
"algoritm",
")",
"{",
"$",
"result",
"[",
"$",
"algoritm",
"]",
"=",
"hash",
"(",
"... | Get all available hash from data
@param string $data Data from get hash
@return JBDump | [
"Get",
"all",
"available",
"hash",
"from",
"data"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2120-L2127 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._getMemory | protected static function _getMemory()
{
if (function_exists('memory_get_usage')) {
return memory_get_usage();
} else {
$output = array();
$pid = getmypid();
if (substr(PHP_OS, 0, 3) == 'WIN') {
@exec('tasklist /FI "PID eq ' . $pid . '" /FO LIST', $output);
if (!isset($output[5])) {
$output[5] = null;
}
return (int)substr($output[5], strpos($output[5], ':') + 1);
} else {
@exec("ps -o rss -p $pid", $output);
return $output[1] * 1024;
}
}
} | php | protected static function _getMemory()
{
if (function_exists('memory_get_usage')) {
return memory_get_usage();
} else {
$output = array();
$pid = getmypid();
if (substr(PHP_OS, 0, 3) == 'WIN') {
@exec('tasklist /FI "PID eq ' . $pid . '" /FO LIST', $output);
if (!isset($output[5])) {
$output[5] = null;
}
return (int)substr($output[5], strpos($output[5], ':') + 1);
} else {
@exec("ps -o rss -p $pid", $output);
return $output[1] * 1024;
}
}
} | [
"protected",
"static",
"function",
"_getMemory",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'memory_get_usage'",
")",
")",
"{",
"return",
"memory_get_usage",
"(",
")",
";",
"}",
"else",
"{",
"$",
"output",
"=",
"array",
"(",
")",
";",
"$",
"pid",... | Get current usage memory
@return int | [
"Get",
"current",
"usage",
"memory"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2133-L2152 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._dump | protected function _dump($data, $name = '...')
{
$varType = strtolower(getType($data));
$advType = false;
if ($varType == 'string' && preg_match('#(.*)::(.*)#', $name, $matches)) {
$matches[2] = trim(strToLower($matches[2]));
if ($this->_strlen($matches[2]) > 0) {
$advType = $matches[2];
}
$name = $matches[1];
}
if ($this->_strlen($name) > 80) {
$name = substr($name, 0, 80) . '...';
}
if ($varType == 'null') {
$this->_null($name);
} elseif ($varType == 'boolean') {
$this->_boolean($data, $name, $advType);
} elseif ($varType == 'integer') {
$this->_integer($data, $name, $advType);
} elseif ($varType == 'double') {
$this->_float($data, $name, $advType);
} elseif ($varType == 'string') {
$this->_string($data, $name, $advType);
} elseif ($varType == 'array') {
if ($this->_currentDepth <= self::$_config['dump']['maxDepth']) {
$this->_currentDepth++;
$this->_array($data, $name, $advType);
$this->_currentDepth--;
} else {
$this->_maxDepth($data, $name, $advType);
}
} elseif ($varType == 'object') {
if ($this->_currentDepth <= self::$_config['dump']['maxDepth']) {
$this->_currentDepth++;
if (get_class($data) == 'Closure') {
$this->_closure($data, $name, $advType);
} else {
$this->_object($data, $name, $advType);
}
$this->_currentDepth--;
} else {
$this->_maxDepth($data, $name);
}
} elseif ($varType == 'resource') {
$this->_resource($data, $name, $advType);
} else {
$this->_undefined($data, $name, $advType);
}
return $this;
} | php | protected function _dump($data, $name = '...')
{
$varType = strtolower(getType($data));
$advType = false;
if ($varType == 'string' && preg_match('#(.*)::(.*)#', $name, $matches)) {
$matches[2] = trim(strToLower($matches[2]));
if ($this->_strlen($matches[2]) > 0) {
$advType = $matches[2];
}
$name = $matches[1];
}
if ($this->_strlen($name) > 80) {
$name = substr($name, 0, 80) . '...';
}
if ($varType == 'null') {
$this->_null($name);
} elseif ($varType == 'boolean') {
$this->_boolean($data, $name, $advType);
} elseif ($varType == 'integer') {
$this->_integer($data, $name, $advType);
} elseif ($varType == 'double') {
$this->_float($data, $name, $advType);
} elseif ($varType == 'string') {
$this->_string($data, $name, $advType);
} elseif ($varType == 'array') {
if ($this->_currentDepth <= self::$_config['dump']['maxDepth']) {
$this->_currentDepth++;
$this->_array($data, $name, $advType);
$this->_currentDepth--;
} else {
$this->_maxDepth($data, $name, $advType);
}
} elseif ($varType == 'object') {
if ($this->_currentDepth <= self::$_config['dump']['maxDepth']) {
$this->_currentDepth++;
if (get_class($data) == 'Closure') {
$this->_closure($data, $name, $advType);
} else {
$this->_object($data, $name, $advType);
}
$this->_currentDepth--;
} else {
$this->_maxDepth($data, $name);
}
} elseif ($varType == 'resource') {
$this->_resource($data, $name, $advType);
} else {
$this->_undefined($data, $name, $advType);
}
return $this;
} | [
"protected",
"function",
"_dump",
"(",
"$",
"data",
",",
"$",
"name",
"=",
"'...'",
")",
"{",
"$",
"varType",
"=",
"strtolower",
"(",
"getType",
"(",
"$",
"data",
")",
")",
";",
"$",
"advType",
"=",
"false",
";",
"if",
"(",
"$",
"varType",
"==",
... | Maps type variable to a function
@param mixed $data Mixed data for dump
@param string $name Variable name
@return JBDump | [
"Maps",
"type",
"variable",
"to",
"a",
"function"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2177-L2241 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._vars | protected function _vars($data, $isExpanded = false)
{
$_is_object = is_object($data);
?>
<div class="jbnest" style="<?php echo $isExpanded ? 'display:block' : 'display:none'; ?>">
<ul class="jbnode">
<?php
$keys = ($_is_object) ? array_keys(@get_object_vars($data)) : array_keys($data);
// sorting
if (self::$_config['sort']['object'] && $_is_object) {
sort($keys);
} elseif (self::$_config['sort']['array']) {
sort($keys);
}
// get entries
foreach ($keys as $key) {
$value = null;
if ($_is_object && property_exists($data, $key)) {
$value = $data->$key;
} else {
if (is_array($data) && array_key_exists($key, $data)) {
$value = $data[$key];
}
}
$this->_dump($value, $key);
}
// get methods
if ($_is_object && self::$_config['dump']['showMethods']) {
if ($methods = $this->_getMethods($data)) {
$this->_dump($methods, '<! methods of "' . get_class($data) . '" !>');
}
}
?>
</ul>
</div>
<?php
} | php | protected function _vars($data, $isExpanded = false)
{
$_is_object = is_object($data);
?>
<div class="jbnest" style="<?php echo $isExpanded ? 'display:block' : 'display:none'; ?>">
<ul class="jbnode">
<?php
$keys = ($_is_object) ? array_keys(@get_object_vars($data)) : array_keys($data);
// sorting
if (self::$_config['sort']['object'] && $_is_object) {
sort($keys);
} elseif (self::$_config['sort']['array']) {
sort($keys);
}
// get entries
foreach ($keys as $key) {
$value = null;
if ($_is_object && property_exists($data, $key)) {
$value = $data->$key;
} else {
if (is_array($data) && array_key_exists($key, $data)) {
$value = $data[$key];
}
}
$this->_dump($value, $key);
}
// get methods
if ($_is_object && self::$_config['dump']['showMethods']) {
if ($methods = $this->_getMethods($data)) {
$this->_dump($methods, '<! methods of "' . get_class($data) . '" !>');
}
}
?>
</ul>
</div>
<?php
} | [
"protected",
"function",
"_vars",
"(",
"$",
"data",
",",
"$",
"isExpanded",
"=",
"false",
")",
"{",
"$",
"_is_object",
"=",
"is_object",
"(",
"$",
"data",
")",
";",
"?>\r\n <div class=\"jbnest\" style=\"<?php",
"echo",
"$",
"isExpanded",
"?",
"'display:bl... | Render HTML for object and array
@param array|object $data Variablevalue
@param bool $isExpanded Flag is current block expanded
@return void | [
"Render",
"HTML",
"for",
"object",
"and",
"array"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2249-L2290 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._resource | protected function _resource($data, $name)
{
$data = get_resource_type($data);
$this->_renderNode('Resource', $name, $data);
} | php | protected function _resource($data, $name)
{
$data = get_resource_type($data);
$this->_renderNode('Resource', $name, $data);
} | [
"protected",
"function",
"_resource",
"(",
"$",
"data",
",",
"$",
"name",
")",
"{",
"$",
"data",
"=",
"get_resource_type",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"_renderNode",
"(",
"'Resource'",
",",
"$",
"name",
",",
"$",
"data",
")",
";",
... | Render HTML for resource type
@param resource $data Variable
@param string $name Variable name
@return void | [
"Render",
"HTML",
"for",
"resource",
"type"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2349-L2353 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._strlen | protected function _strlen($string)
{
$encoding = function_exists('mb_detect_encoding') ? mb_detect_encoding($string) : false;
return $encoding ? mb_strlen($string, $encoding) : strlen($string);
} | php | protected function _strlen($string)
{
$encoding = function_exists('mb_detect_encoding') ? mb_detect_encoding($string) : false;
return $encoding ? mb_strlen($string, $encoding) : strlen($string);
} | [
"protected",
"function",
"_strlen",
"(",
"$",
"string",
")",
"{",
"$",
"encoding",
"=",
"function_exists",
"(",
"'mb_detect_encoding'",
")",
"?",
"mb_detect_encoding",
"(",
"$",
"string",
")",
":",
"false",
";",
"return",
"$",
"encoding",
"?",
"mb_strlen",
"... | Get valid string length
@param string $string Some string
@return int | [
"Get",
"valid",
"string",
"length"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2360-L2364 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._string | protected function _string($data, $name, $advType = '')
{
$dataLength = $this->_strlen($data);
$_extra = false;
if ($advType == 'html') {
$_extra = true;
$_ = 'HTML Code';
$data = '<pre class="jbpreview">' . $data . '</pre>';
} elseif ($advType == 'source') {
$data = trim($data);
if ($data && strpos($data, '<?') !== 0) {
$_ = 'PHP Code';
$_extra = true;
$data = "<?php" . PHP_EOL . PHP_EOL . $data;
$data = '<pre class="jbpreview">' . highlight_string($data, true) . '</pre>';
} else {
$_ = '// code not found';
$data = null;
}
} else {
$_ = $data;
if (!(
strpos($data, "\r") === false &&
strpos($data, "\n") === false &&
strpos($data, " ") === false &&
strpos($data, "\t") === false
)
) {
$_extra = true;
} else {
$_extra = false;
}
if ($this->_strlen($data)) {
if ($this->_strlen($data) > self::$_config['dump']['stringLength']) {
if (function_exists('mb_substr')) {
$_ = mb_substr($data, 0, self::$_config['dump']['stringLength'] - 3) . '...';
} else {
$_ = substr($data, 0, self::$_config['dump']['stringLength'] - 3) . '...';
}
$_extra = true;
}
$_ = $this->_htmlChars($_);
$data = '<textarea readonly="readonly" class="jbpreview">' . $this->_htmlChars($data) . '</textarea>';
}
}
?>
<li class="jbchild">
<div
class="jbelement <?php echo $_extra ? ' jbexpand' : ''; ?>" <?php if ($_extra) { ?> onClick="jbdump.toggle(this);"<?php } ?>>
<span class="jbname"><?php echo $name; ?></span>
(<span class="jbtype jbtype-string">String</span>, <?php echo $dataLength; ?>)
<span class="jbvalue"><?php echo $_; ?></span>
</div>
<?php if ($_extra) { ?>
<div class="jbnest" style="display:none;">
<ul class="jbnode">
<li class="jbchild"><?php echo $data; ?></li>
</ul>
</div>
<?php } ?>
</li>
<?php
} | php | protected function _string($data, $name, $advType = '')
{
$dataLength = $this->_strlen($data);
$_extra = false;
if ($advType == 'html') {
$_extra = true;
$_ = 'HTML Code';
$data = '<pre class="jbpreview">' . $data . '</pre>';
} elseif ($advType == 'source') {
$data = trim($data);
if ($data && strpos($data, '<?') !== 0) {
$_ = 'PHP Code';
$_extra = true;
$data = "<?php" . PHP_EOL . PHP_EOL . $data;
$data = '<pre class="jbpreview">' . highlight_string($data, true) . '</pre>';
} else {
$_ = '// code not found';
$data = null;
}
} else {
$_ = $data;
if (!(
strpos($data, "\r") === false &&
strpos($data, "\n") === false &&
strpos($data, " ") === false &&
strpos($data, "\t") === false
)
) {
$_extra = true;
} else {
$_extra = false;
}
if ($this->_strlen($data)) {
if ($this->_strlen($data) > self::$_config['dump']['stringLength']) {
if (function_exists('mb_substr')) {
$_ = mb_substr($data, 0, self::$_config['dump']['stringLength'] - 3) . '...';
} else {
$_ = substr($data, 0, self::$_config['dump']['stringLength'] - 3) . '...';
}
$_extra = true;
}
$_ = $this->_htmlChars($_);
$data = '<textarea readonly="readonly" class="jbpreview">' . $this->_htmlChars($data) . '</textarea>';
}
}
?>
<li class="jbchild">
<div
class="jbelement <?php echo $_extra ? ' jbexpand' : ''; ?>" <?php if ($_extra) { ?> onClick="jbdump.toggle(this);"<?php } ?>>
<span class="jbname"><?php echo $name; ?></span>
(<span class="jbtype jbtype-string">String</span>, <?php echo $dataLength; ?>)
<span class="jbvalue"><?php echo $_; ?></span>
</div>
<?php if ($_extra) { ?>
<div class="jbnest" style="display:none;">
<ul class="jbnode">
<li class="jbchild"><?php echo $data; ?></li>
</ul>
</div>
<?php } ?>
</li>
<?php
} | [
"protected",
"function",
"_string",
"(",
"$",
"data",
",",
"$",
"name",
",",
"$",
"advType",
"=",
"''",
")",
"{",
"$",
"dataLength",
"=",
"$",
"this",
"->",
"_strlen",
"(",
"$",
"data",
")",
";",
"$",
"_extra",
"=",
"false",
";",
"if",
"(",
"$",
... | Render HTML for string type
@param string $data Variable
@param string $name Variable name
@param string $advType String type (parse mode)
@return void | [
"Render",
"HTML",
"for",
"string",
"type"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2373-L2445 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._array | protected function _array(array $data, $name)
{
$isExpanded = $this->_isExpandedLevel();
if (0 === strpos($name, '<! methods of "')) {
$isExpanded = false;
}
?>
<li class="jbchild">
<div
class="jbelement<?php echo count((array)$data) > 0 ? ' jbexpand' : ''; ?> <?= $isExpanded ? 'jbopened' : ''; ?>"
<?php if (count((array)$data) > 0) { ?> onClick="jbdump.toggle(this);"<?php } ?>>
<span class="jbname"><?php echo $name; ?></span> (<span
class="jbtype jbtype-array">Array</span>, <?php echo count((array)$data); ?>)
</div>
<?php if (count((array)$data)) {
$this->_vars($data, $isExpanded);
} ?>
</li>
<?php
} | php | protected function _array(array $data, $name)
{
$isExpanded = $this->_isExpandedLevel();
if (0 === strpos($name, '<! methods of "')) {
$isExpanded = false;
}
?>
<li class="jbchild">
<div
class="jbelement<?php echo count((array)$data) > 0 ? ' jbexpand' : ''; ?> <?= $isExpanded ? 'jbopened' : ''; ?>"
<?php if (count((array)$data) > 0) { ?> onClick="jbdump.toggle(this);"<?php } ?>>
<span class="jbname"><?php echo $name; ?></span> (<span
class="jbtype jbtype-array">Array</span>, <?php echo count((array)$data); ?>)
</div>
<?php if (count((array)$data)) {
$this->_vars($data, $isExpanded);
} ?>
</li>
<?php
} | [
"protected",
"function",
"_array",
"(",
"array",
"$",
"data",
",",
"$",
"name",
")",
"{",
"$",
"isExpanded",
"=",
"$",
"this",
"->",
"_isExpandedLevel",
"(",
")",
";",
"if",
"(",
"0",
"===",
"strpos",
"(",
"$",
"name",
",",
"'<! methods of \"'",
")"... | Render HTML for array type
@param array $data Variable
@param string $name Variable name
@return void | [
"Render",
"HTML",
"for",
"array",
"type"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2453-L2474 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._object | protected function _object($data, $name)
{
static $objectIdList = array();
$objectId = spl_object_hash($data);
if (!isset($objectIdList[$objectId])) {
$objectIdList[$objectId] = count($objectIdList);
}
$count = count(@get_object_vars($data));
$isExpand = $count > 0 || self::$_config['dump']['showMethods'];
$isExpanded = $this->_isExpandedLevel();
?>
<li class="jbchild">
<div class="jbelement<?php echo $isExpand ? ' jbexpand' : ''; ?> <?= $isExpanded ? 'jbopened' : ''; ?>"
<?php if ($isExpand) { ?> onClick="jbdump.toggle(this);"<?php } ?>>
<span class="jbname" title="splHash=<?php echo $objectId;?>"><?php echo $name; ?></span>
(
<span class="jbtype jbtype-object"><?php echo get_class($data); ?></span>
<span style="text-decoration: underline;" title="splHash=<?php echo $objectId;?>">id:<?php echo $objectIdList[$objectId];?></span>,
l:<?php echo $count; ?>
)
</div>
<?php if ($isExpand) {
$this->_vars($data, $isExpanded);
} ?>
<?php
} | php | protected function _object($data, $name)
{
static $objectIdList = array();
$objectId = spl_object_hash($data);
if (!isset($objectIdList[$objectId])) {
$objectIdList[$objectId] = count($objectIdList);
}
$count = count(@get_object_vars($data));
$isExpand = $count > 0 || self::$_config['dump']['showMethods'];
$isExpanded = $this->_isExpandedLevel();
?>
<li class="jbchild">
<div class="jbelement<?php echo $isExpand ? ' jbexpand' : ''; ?> <?= $isExpanded ? 'jbopened' : ''; ?>"
<?php if ($isExpand) { ?> onClick="jbdump.toggle(this);"<?php } ?>>
<span class="jbname" title="splHash=<?php echo $objectId;?>"><?php echo $name; ?></span>
(
<span class="jbtype jbtype-object"><?php echo get_class($data); ?></span>
<span style="text-decoration: underline;" title="splHash=<?php echo $objectId;?>">id:<?php echo $objectIdList[$objectId];?></span>,
l:<?php echo $count; ?>
)
</div>
<?php if ($isExpand) {
$this->_vars($data, $isExpanded);
} ?>
<?php
} | [
"protected",
"function",
"_object",
"(",
"$",
"data",
",",
"$",
"name",
")",
"{",
"static",
"$",
"objectIdList",
"=",
"array",
"(",
")",
";",
"$",
"objectId",
"=",
"spl_object_hash",
"(",
"$",
"data",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"o... | Render HTML for object type
@param object $data Variable
@param string $name Variable name
@return void | [
"Render",
"HTML",
"for",
"object",
"type"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2482-L2511 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._closure | protected function _closure($data, $name)
{
$isExpanded = $this->_isExpandedLevel();
?>
<li class="jbchild">
<div
class="jbelement<?php echo count((array)$data) > 0 ? ' jbexpand' : ''; ?> <?= $isExpanded ? 'jbopened' : ''; ?>"
<?php if (count((array)$data) > 0) { ?> onClick="jbdump.toggle(this);"<?php } ?>>
<span class="jbname"><?php echo $name; ?></span> (<span class="jbtype jbtype-closure">Closure</span>)
<span class="jbvalue"><?php echo get_class($data); ?></span>
</div>
<?php $this->_vars($this->_getFunction($data), $isExpanded); ?>
</li>
<?php
} | php | protected function _closure($data, $name)
{
$isExpanded = $this->_isExpandedLevel();
?>
<li class="jbchild">
<div
class="jbelement<?php echo count((array)$data) > 0 ? ' jbexpand' : ''; ?> <?= $isExpanded ? 'jbopened' : ''; ?>"
<?php if (count((array)$data) > 0) { ?> onClick="jbdump.toggle(this);"<?php } ?>>
<span class="jbname"><?php echo $name; ?></span> (<span class="jbtype jbtype-closure">Closure</span>)
<span class="jbvalue"><?php echo get_class($data); ?></span>
</div>
<?php $this->_vars($this->_getFunction($data), $isExpanded); ?>
</li>
<?php
} | [
"protected",
"function",
"_closure",
"(",
"$",
"data",
",",
"$",
"name",
")",
"{",
"$",
"isExpanded",
"=",
"$",
"this",
"->",
"_isExpandedLevel",
"(",
")",
";",
"?>\r\n <li class=\"jbchild\">\r\n <div\r\n class=\"jbelement<?php",
"echo",
... | Render HTML for closure type
@param object $data Variable
@param string $name Variable name
@return void | [
"Render",
"HTML",
"for",
"closure",
"type"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2519-L2534 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._renderNode | protected function _renderNode($type, $name, $data)
{
$typeAlias = str_replace(' ', '-', strtolower($type));
?>
<li class="jbchild">
<div class="jbelement">
<span class="jbname"><?php echo $name; ?></span>
(<span class="jbtype jbtype-<?php echo $typeAlias; ?>"><?php echo $type; ?></span>)
<span class="jbvalue"><?php echo $data; ?></span>
</div>
</li>
<?php
} | php | protected function _renderNode($type, $name, $data)
{
$typeAlias = str_replace(' ', '-', strtolower($type));
?>
<li class="jbchild">
<div class="jbelement">
<span class="jbname"><?php echo $name; ?></span>
(<span class="jbtype jbtype-<?php echo $typeAlias; ?>"><?php echo $type; ?></span>)
<span class="jbvalue"><?php echo $data; ?></span>
</div>
</li>
<?php
} | [
"protected",
"function",
"_renderNode",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"data",
")",
"{",
"$",
"typeAlias",
"=",
"str_replace",
"(",
"' '",
",",
"'-'",
",",
"strtolower",
"(",
"$",
"type",
")",
")",
";",
"?>\r\n <li class=\"jbchild\">\... | Render HTML for undefined variable
@param string $type Variable type
@param mixed $data Variable
@param string $name Variable name
@return void | [
"Render",
"HTML",
"for",
"undefined",
"variable"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2566-L2578 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.getClientIP | public static function getClientIP($getSource = false)
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
$source = 'HTTP_CLIENT_IP';
} elseif (!empty($_SERVER['HTTP_X_REAL_IP'])) {
$ip = $_SERVER['HTTP_X_REAL_IP'];
$source = 'HTTP_X_REAL_IP';
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
$source = 'HTTP_X_FORWARDED_FOR';
} elseif (!empty($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
$source = 'REMOTE_ADDR';
} else {
$ip = '0.0.0.0';
$source = 'undefined';
}
if ($getSource) {
return $source;
} else {
return $ip;
}
} | php | public static function getClientIP($getSource = false)
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
$source = 'HTTP_CLIENT_IP';
} elseif (!empty($_SERVER['HTTP_X_REAL_IP'])) {
$ip = $_SERVER['HTTP_X_REAL_IP'];
$source = 'HTTP_X_REAL_IP';
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
$source = 'HTTP_X_FORWARDED_FOR';
} elseif (!empty($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
$source = 'REMOTE_ADDR';
} else {
$ip = '0.0.0.0';
$source = 'undefined';
}
if ($getSource) {
return $source;
} else {
return $ip;
}
} | [
"public",
"static",
"function",
"getClientIP",
"(",
"$",
"getSource",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SERVER",
"[",
"'HTTP_CLIENT_IP'",
"]",
")",
")",
"{",
"$",
"ip",
"=",
"$",
"_SERVER",
"[",
"'HTTP_CLIENT_IP'",
"]",
";",
... | Get the IP number of differnt ways
@param bool $getSource
@return string | [
"Get",
"the",
"IP",
"number",
"of",
"differnt",
"ways"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2585-L2613 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._getRalativePath | protected function _getRalativePath($path)
{
if ($path) {
$rootPath = str_replace(array('/', '\\'), '/', self::$_config['root']);
$path = str_replace(array('/', '\\'), '/', $path);
$path = str_replace($rootPath, '/', $path);
$path = str_replace('//', '/', $path);
$path = trim($path, '/');
}
return $path;
} | php | protected function _getRalativePath($path)
{
if ($path) {
$rootPath = str_replace(array('/', '\\'), '/', self::$_config['root']);
$path = str_replace(array('/', '\\'), '/', $path);
$path = str_replace($rootPath, '/', $path);
$path = str_replace('//', '/', $path);
$path = trim($path, '/');
}
return $path;
} | [
"protected",
"function",
"_getRalativePath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"path",
")",
"{",
"$",
"rootPath",
"=",
"str_replace",
"(",
"array",
"(",
"'/'",
",",
"'\\\\'",
")",
",",
"'/'",
",",
"self",
"::",
"$",
"_config",
"[",
"'root'"... | Get relative path from absolute
@param string $path Absolute filepath
@return string | [
"Get",
"relative",
"path",
"from",
"absolute"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2620-L2631 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._getOneTrace | protected function _getOneTrace($info, $addObject = false)
{
$_this = self::i();
$_tmp = array();
if (isset($info['file'])) {
$_tmp['file'] = $_this->_getRalativePath($info['file']) . ' : ' . $info['line'];
} else {
$info['file'] = false;
}
if ($info['function'] != 'include' && $info['function'] != 'include_once' && $info['function'] != 'require'
&& $info['function'] != 'require_once'
) {
if (isset($info['type']) && isset($info['class'])) {
$_tmp['func'] = $info['class']
. ' ' . $info['type']
. ' ' . $info['function'] . '()';
} else {
$_tmp['func'] = $info['function'] . '()';
}
$args = isset($info['args']) ? $info['args'] : array();
if (self::$_config['showArgs'] || $addObject) {
$_tmp['args'] = isset($info['args']) ? $info['args'] : array();
} else {
$_tmp['count_args'] = count($args);
}
} else {
$_tmp['func'] = $info['function'];
}
if (isset($info['object']) && (self::$_config['showArgs'] || $addObject)) {
$_tmp['obj'] = $info['object'];
}
return $_tmp;
} | php | protected function _getOneTrace($info, $addObject = false)
{
$_this = self::i();
$_tmp = array();
if (isset($info['file'])) {
$_tmp['file'] = $_this->_getRalativePath($info['file']) . ' : ' . $info['line'];
} else {
$info['file'] = false;
}
if ($info['function'] != 'include' && $info['function'] != 'include_once' && $info['function'] != 'require'
&& $info['function'] != 'require_once'
) {
if (isset($info['type']) && isset($info['class'])) {
$_tmp['func'] = $info['class']
. ' ' . $info['type']
. ' ' . $info['function'] . '()';
} else {
$_tmp['func'] = $info['function'] . '()';
}
$args = isset($info['args']) ? $info['args'] : array();
if (self::$_config['showArgs'] || $addObject) {
$_tmp['args'] = isset($info['args']) ? $info['args'] : array();
} else {
$_tmp['count_args'] = count($args);
}
} else {
$_tmp['func'] = $info['function'];
}
if (isset($info['object']) && (self::$_config['showArgs'] || $addObject)) {
$_tmp['obj'] = $info['object'];
}
return $_tmp;
} | [
"protected",
"function",
"_getOneTrace",
"(",
"$",
"info",
",",
"$",
"addObject",
"=",
"false",
")",
"{",
"$",
"_this",
"=",
"self",
"::",
"i",
"(",
")",
";",
"$",
"_tmp",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"info",
"[",
... | Get formated one trace info
@param array $info One trace element
@param bool $addObject Add object to result (low perfomance)
@return array | [
"Get",
"formated",
"one",
"trace",
"info"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2639-L2680 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._formatSize | protected static function _formatSize($bytes)
{
$exp = 0;
$value = 0;
$symbol = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
if ($bytes > 0) {
$exp = floor(log($bytes) / log(1024));
$value = ($bytes / pow(1024, floor($exp)));
}
return sprintf('%.2f ' . $symbol[$exp], $value);
} | php | protected static function _formatSize($bytes)
{
$exp = 0;
$value = 0;
$symbol = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
if ($bytes > 0) {
$exp = floor(log($bytes) / log(1024));
$value = ($bytes / pow(1024, floor($exp)));
}
return sprintf('%.2f ' . $symbol[$exp], $value);
} | [
"protected",
"static",
"function",
"_formatSize",
"(",
"$",
"bytes",
")",
"{",
"$",
"exp",
"=",
"0",
";",
"$",
"value",
"=",
"0",
";",
"$",
"symbol",
"=",
"array",
"(",
"'B'",
",",
"'KB'",
",",
"'MB'",
",",
"'GB'",
",",
"'TB'",
",",
"'PB'",
",",
... | Convert filesize to formated string
@param integer $bytes Count bytes
@return string | [
"Convert",
"filesize",
"to",
"formated",
"string"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2687-L2699 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._getSourceFunction | protected function _getSourceFunction($trace)
{
$lastTrace = $this->_getLastTrace($trace);
if (isset($lastTrace['function']) || isset($lastTrace['class'])) {
$args = '';
if (isset($lastTrace['args'])) {
$args = '( ' . count($lastTrace['args']) . ' args' . ' )';
}
if (isset($lastTrace['class'])) {
$function = $lastTrace['class'] . ' ' . $lastTrace['type'] . ' ' . $lastTrace['function'] . ' ' . $args;
} else {
$function = $lastTrace['function'] . ' ' . $args;
}
return 'Function: ' . $function . '<br />';
}
return '';
} | php | protected function _getSourceFunction($trace)
{
$lastTrace = $this->_getLastTrace($trace);
if (isset($lastTrace['function']) || isset($lastTrace['class'])) {
$args = '';
if (isset($lastTrace['args'])) {
$args = '( ' . count($lastTrace['args']) . ' args' . ' )';
}
if (isset($lastTrace['class'])) {
$function = $lastTrace['class'] . ' ' . $lastTrace['type'] . ' ' . $lastTrace['function'] . ' ' . $args;
} else {
$function = $lastTrace['function'] . ' ' . $args;
}
return 'Function: ' . $function . '<br />';
}
return '';
} | [
"protected",
"function",
"_getSourceFunction",
"(",
"$",
"trace",
")",
"{",
"$",
"lastTrace",
"=",
"$",
"this",
"->",
"_getLastTrace",
"(",
"$",
"trace",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"lastTrace",
"[",
"'function'",
"]",
")",
"||",
"isset",
"... | Get last function name and it params from backtrace
@param array $trace Backtrace
@return string | [
"Get",
"last",
"function",
"name",
"and",
"it",
"params",
"from",
"backtrace"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2706-L2727 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._getSourcePath | protected function _getSourcePath($trace, $fileOnly = false)
{
$path = '';
$currentTrace = $this->_getLastTrace($trace);
if (isset($currentTrace['file'])) {
$path = $this->_getRalativePath($currentTrace['file']);
if ($fileOnly && $path) {
$path = pathinfo($path, PATHINFO_BASENAME);
}
if (isset($currentTrace['line']) && $path) {
$path = $path . ':' . $currentTrace['line'];
}
}
if (!$path) {
$path = 'undefined:0';
}
return $path;
} | php | protected function _getSourcePath($trace, $fileOnly = false)
{
$path = '';
$currentTrace = $this->_getLastTrace($trace);
if (isset($currentTrace['file'])) {
$path = $this->_getRalativePath($currentTrace['file']);
if ($fileOnly && $path) {
$path = pathinfo($path, PATHINFO_BASENAME);
}
if (isset($currentTrace['line']) && $path) {
$path = $path . ':' . $currentTrace['line'];
}
}
if (!$path) {
$path = 'undefined:0';
}
return $path;
} | [
"protected",
"function",
"_getSourcePath",
"(",
"$",
"trace",
",",
"$",
"fileOnly",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"''",
";",
"$",
"currentTrace",
"=",
"$",
"this",
"->",
"_getLastTrace",
"(",
"$",
"trace",
")",
";",
"if",
"(",
"isset",
"(... | Get last source path from backtrace
@param array $trace Backtrace
@param bool $fileOnly Show filename only
@return string | [
"Get",
"last",
"source",
"path",
"from",
"backtrace"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2735-L2757 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._getLastTrace | protected function _getLastTrace($trace)
{
// current filename info
$curFile = pathinfo(__FILE__, PATHINFO_BASENAME);
$curFileLength = $this->_strlen($curFile);
$meta = array();
$j = 0;
for ($i = 0; $trace && $i < sizeof($trace); $i++) {
$j = $i;
if (isset($trace[$i]['class'])
&& isset($trace[$i]['file'])
&& ($trace[$i]['class'] == 'JBDump')
&& (substr($trace[$i]['file'], -$curFileLength, $curFileLength) == $curFile)
) {
} elseif (isset($trace[$i]['class'])
&& isset($trace[$i + 1]['file'])
&& isset($trace[$i]['file'])
&& $trace[$i]['class'] == 'JBDump'
&& (substr($trace[$i]['file'], -$curFileLength, $curFileLength) == $curFile)
) {
} elseif (isset($trace[$i]['file'])
&& (substr($trace[$i]['file'], -$curFileLength, $curFileLength) == $curFile)
) {
} else {
// found!
$meta['file'] = isset($trace[$i]['file']) ? $trace[$i]['file'] : '';
$meta['line'] = isset($trace[$i]['line']) ? $trace[$i]['line'] : '';
break;
}
}
// get functions
if (isset($trace[$j + 1])) {
$result = $trace[$j + 1];
$result['line'] = $meta['line'];
$result['file'] = $meta['file'];
} else {
$result = $meta;
}
return $result;
} | php | protected function _getLastTrace($trace)
{
// current filename info
$curFile = pathinfo(__FILE__, PATHINFO_BASENAME);
$curFileLength = $this->_strlen($curFile);
$meta = array();
$j = 0;
for ($i = 0; $trace && $i < sizeof($trace); $i++) {
$j = $i;
if (isset($trace[$i]['class'])
&& isset($trace[$i]['file'])
&& ($trace[$i]['class'] == 'JBDump')
&& (substr($trace[$i]['file'], -$curFileLength, $curFileLength) == $curFile)
) {
} elseif (isset($trace[$i]['class'])
&& isset($trace[$i + 1]['file'])
&& isset($trace[$i]['file'])
&& $trace[$i]['class'] == 'JBDump'
&& (substr($trace[$i]['file'], -$curFileLength, $curFileLength) == $curFile)
) {
} elseif (isset($trace[$i]['file'])
&& (substr($trace[$i]['file'], -$curFileLength, $curFileLength) == $curFile)
) {
} else {
// found!
$meta['file'] = isset($trace[$i]['file']) ? $trace[$i]['file'] : '';
$meta['line'] = isset($trace[$i]['line']) ? $trace[$i]['line'] : '';
break;
}
}
// get functions
if (isset($trace[$j + 1])) {
$result = $trace[$j + 1];
$result['line'] = $meta['line'];
$result['file'] = $meta['file'];
} else {
$result = $meta;
}
return $result;
} | [
"protected",
"function",
"_getLastTrace",
"(",
"$",
"trace",
")",
"{",
"// current filename info\r",
"$",
"curFile",
"=",
"pathinfo",
"(",
"__FILE__",
",",
"PATHINFO_BASENAME",
")",
";",
"$",
"curFileLength",
"=",
"$",
"this",
"->",
"_strlen",
"(",
"$",
"curFi... | Get Last trace info
@param array $trace Backtrace
@return array | [
"Get",
"Last",
"trace",
"info"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2764-L2809 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._getMethods | protected function _getMethods($object)
{
if (is_string($object)) {
$className = $object;
} else {
$className = get_class($object);
}
$methods = get_class_methods($className);
if (self::$_config['sort']['methods']) {
sort($methods);
}
return $methods;
} | php | protected function _getMethods($object)
{
if (is_string($object)) {
$className = $object;
} else {
$className = get_class($object);
}
$methods = get_class_methods($className);
if (self::$_config['sort']['methods']) {
sort($methods);
}
return $methods;
} | [
"protected",
"function",
"_getMethods",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"object",
")",
")",
"{",
"$",
"className",
"=",
"$",
"object",
";",
"}",
"else",
"{",
"$",
"className",
"=",
"get_class",
"(",
"$",
"object",
")",... | Get object methods
@param object $object Backtrace
@return array | [
"Get",
"object",
"methods"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L2816-L2829 | train |
JBZoo/JBDump | class.jbdump.php | JBDump.convertTrace | public function convertTrace($trace, $addObject = false)
{
$result = array();
if (is_array($trace)) {
foreach ($trace as $key => $info) {
$oneTrace = self::i()->_getOneTrace($info, $addObject);
$file = 'undefined';
if (isset($oneTrace['file'])) {
$file = $oneTrace['file'];
}
$result['#' . ($key - 1) . ' ' . $oneTrace['func']] = $file;
}
}
return $result;
} | php | public function convertTrace($trace, $addObject = false)
{
$result = array();
if (is_array($trace)) {
foreach ($trace as $key => $info) {
$oneTrace = self::i()->_getOneTrace($info, $addObject);
$file = 'undefined';
if (isset($oneTrace['file'])) {
$file = $oneTrace['file'];
}
$result['#' . ($key - 1) . ' ' . $oneTrace['func']] = $file;
}
}
return $result;
} | [
"public",
"function",
"convertTrace",
"(",
"$",
"trace",
",",
"$",
"addObject",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"trace",
")",
")",
"{",
"foreach",
"(",
"$",
"trace",
"as",
"$",
... | Convert trace information to readable
@param array $trace Standard debug backtrace data
@param bool $addObject
@return array | [
"Convert",
"trace",
"information",
"to",
"readable"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L3246-L3263 | train |
JBZoo/JBDump | class.jbdump.php | JBDump._getErrorTypes | protected static function _getErrorTypes()
{
$errType = array(
E_ERROR => 'Error',
E_WARNING => 'Warning',
E_PARSE => 'Parsing Error',
E_NOTICE => 'Notice',
E_CORE_ERROR => 'Core Error',
E_CORE_WARNING => 'Core Warning',
E_COMPILE_ERROR => 'Compile Error',
E_COMPILE_WARNING => 'Compile Warning',
E_USER_ERROR => 'User Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Runtime Notice',
E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
);
if (defined('E_DEPRECATED')) {
$errType[E_DEPRECATED] = 'Deprecated';
$errType[E_USER_DEPRECATED] = 'User Deprecated';
}
$errType[E_ALL] = 'All errors';
return $errType;
} | php | protected static function _getErrorTypes()
{
$errType = array(
E_ERROR => 'Error',
E_WARNING => 'Warning',
E_PARSE => 'Parsing Error',
E_NOTICE => 'Notice',
E_CORE_ERROR => 'Core Error',
E_CORE_WARNING => 'Core Warning',
E_COMPILE_ERROR => 'Compile Error',
E_COMPILE_WARNING => 'Compile Warning',
E_USER_ERROR => 'User Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Runtime Notice',
E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
);
if (defined('E_DEPRECATED')) {
$errType[E_DEPRECATED] = 'Deprecated';
$errType[E_USER_DEPRECATED] = 'User Deprecated';
}
$errType[E_ALL] = 'All errors';
return $errType;
} | [
"protected",
"static",
"function",
"_getErrorTypes",
"(",
")",
"{",
"$",
"errType",
"=",
"array",
"(",
"E_ERROR",
"=>",
"'Error'",
",",
"E_WARNING",
"=>",
"'Warning'",
",",
"E_PARSE",
"=>",
"'Parsing Error'",
",",
"E_NOTICE",
"=>",
"'Notice'",
",",
"E_CORE_ERR... | Get PHP error types
@return array | [
"Get",
"PHP",
"error",
"types"
] | 2129dd19755c031361d4ec7699521c5df9d5e433 | https://github.com/JBZoo/JBDump/blob/2129dd19755c031361d4ec7699521c5df9d5e433/class.jbdump.php#L3269-L3295 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.