Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2892021
PhutilArray.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhutilArray.php
View Options
<?php
/**
* Abstract base class for implementing objects that behave like arrays. This
* class wraps a basic array and provides trivial implementations for
* `Countable`, `ArrayAccess` and `Iterator`, so subclasses need only implement
* specializations.
*/
abstract
class
PhutilArray
extends
Phobject
implements
Countable
,
ArrayAccess
,
Iterator
{
protected
$data
=
array
(
)
;
public
function
__construct
(
array
$initial_value
=
array
(
)
)
{
$this
->
data
=
$initial_value
;
}
/* -( Conversion )--------------------------------------------------------- */
public
function
toArray
(
)
{
return
iterator_to_array
(
$this
,
true
)
;
}
/* -( Countable Interface )------------------------------------------------ */
#[\ReturnTypeWillChange]
public
function
count
(
)
{
return
count
(
$this
->
data
)
;
}
/* -( Iterator Interface )------------------------------------------------- */
#[\ReturnTypeWillChange]
public
function
current
(
)
{
return
current
(
$this
->
data
)
;
}
#[\ReturnTypeWillChange]
public
function
key
(
)
{
return
key
(
$this
->
data
)
;
}
#[\ReturnTypeWillChange]
public
function
next
(
)
{
return
next
(
$this
->
data
)
;
}
#[\ReturnTypeWillChange]
public
function
rewind
(
)
{
reset
(
$this
->
data
)
;
}
#[\ReturnTypeWillChange]
public
function
valid
(
)
{
return
(
key
(
$this
->
data
)
!==
null
)
;
}
/* -( ArrayAccess Interface )---------------------------------------------- */
#[\ReturnTypeWillChange]
public
function
offsetExists
(
$key
)
{
return
array_key_exists
(
$key
,
$this
->
data
)
;
}
#[\ReturnTypeWillChange]
public
function
offsetGet
(
$key
)
{
return
$this
->
data
[
$key
]
;
}
#[\ReturnTypeWillChange]
public
function
offsetSet
(
$key
,
$value
)
{
$this
->
data
[
$key
]
=
$value
;
}
#[\ReturnTypeWillChange]
public
function
offsetUnset
(
$key
)
{
unset
(
$this
->
data
[
$key
]
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 16:05 (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1114734
Default Alt Text
PhutilArray.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment