blob: 4598dc1970be2ee1cd0358df7b280fcf94edcc27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<?php
namespace App\Script;
use App\Model\Collection;
use Exception;
/**
* Handle output to CLI
*
* @author Phil Burton <phil@pgburton.com>
*/
class Output
{
/**
* Echo out the output data
*
* @author Phil Burton <phil@pgburton.com>
* @param Collection $collection
*/
public function printCollection(Collection $collection)
{
if (count($collection) === 0) {
echo "No results found\n";
return;
}
echo $collection->toString() . "\n";
}
/**
* Output the exception message
*
* @author Phil Burton <phil@pgburton.com>
* @param Exception $e
*/
public function printException(Exception $e)
{
echo "An unexpected exception occured:\n" . $e->getMessage() . "\n";
}
}
|