Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7402791
LooseTypeCheck.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
LooseTypeCheck.php
View Options
<?php
namespace
JsonSchema\Constraints\TypeCheck
;
class
LooseTypeCheck
implements
TypeCheckInterface
{
public
static
function
isObject
(
$value
)
{
return
is_object
(
$value
)
||
(
is_array
(
$value
)
&&
(
count
(
$value
)
==
0
||
self
::
isAssociativeArray
(
$value
)));
}
public
static
function
isArray
(
$value
)
{
return
is_array
(
$value
)
&&
(
count
(
$value
)
==
0
||
!
self
::
isAssociativeArray
(
$value
));
}
public
static
function
propertyGet
(
$value
,
$property
)
{
if
(
is_object
(
$value
))
{
return
$value
->{
$property
};
}
return
$value
[
$property
];
}
public
static
function
propertySet
(&
$value
,
$property
,
$data
)
{
if
(
is_object
(
$value
))
{
$value
->{
$property
}
=
$data
;
}
else
{
$value
[
$property
]
=
$data
;
}
}
public
static
function
propertyExists
(
$value
,
$property
)
{
if
(
is_object
(
$value
))
{
return
property_exists
(
$value
,
$property
);
}
return
array_key_exists
(
$property
,
$value
);
}
public
static
function
propertyCount
(
$value
)
{
if
(
is_object
(
$value
))
{
return
count
(
get_object_vars
(
$value
));
}
return
count
(
$value
);
}
/**
* Check if the provided array is associative or not
*
* @param array $arr
*
* @return bool
*/
private
static
function
isAssociativeArray
(
$arr
)
{
return
array_keys
(
$arr
)
!==
range
(
0
,
count
(
$arr
)
-
1
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 21, 18:16 (19 h, 19 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
68/85/5fd0eb2cb52ba4f4ee999ff77298
Default Alt Text
LooseTypeCheck.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment