Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793383
ArrayDisplay.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
ArrayDisplay.php
View Options
<?php
namespace
Keruald\Commands\Display
;
/**
* Class ArrayDisplay
*
* Intended to ease unit tests with a display capturing output in arrays.
*
* @package Keruald\Commands\Display
*/
class
ArrayDisplay
extends
Display
{
/**
* @var array
*/
private
$out
=
[];
/**
* @var array
*/
private
$error
=
[];
///
/// Implement Display
///
public
function
out
(
string
$message
)
:
void
{
$this
->
out
[]
=
$message
;
}
public
function
error
(
string
$message
)
:
void
{
$this
->
error
[]
=
$message
;
}
///
/// Getters
///
public
function
getOut
()
:
array
{
return
$this
->
out
;
}
public
function
getError
()
:
array
{
return
$this
->
error
;
}
///
/// Helper methods
///
public
function
clearOut
()
:
ArrayDisplay
{
$this
->
out
=
[];
return
$this
;
}
public
function
clearError
()
:
ArrayDisplay
{
$this
->
error
=
[];
return
$this
;
}
public
function
countOut
()
:
int
{
return
count
(
$this
->
out
);
}
public
function
countError
()
:
int
{
return
count
(
$this
->
error
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 21:45 (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2439559
Default Alt Text
ArrayDisplay.php (1 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment