Open Journal Systems  3.3.0
Model.php
1 <?php
2 
4 
7 
11 class Model extends Collection
12 {
14  protected $structure;
15 
20  public function __construct(array $data = array(), Parameter $structure = null)
21  {
22  $this->data = $data;
23  $this->structure = $structure;
24  }
25 
31  public function getStructure()
32  {
33  return $this->structure ?: new Parameter();
34  }
35 
41  public function __toString()
42  {
43  $output = 'Debug output of ';
44  if ($this->structure) {
45  $output .= $this->structure->getName() . ' ';
46  }
47  $output .= 'model';
48  $output = str_repeat('=', strlen($output)) . "\n" . $output . "\n" . str_repeat('=', strlen($output)) . "\n\n";
49  $output .= "Model data\n-----------\n\n";
50  $output .= "This data can be retrieved from the model object using the get() method of the model "
51  . "(e.g. \$model->get(\$key)) or accessing the model like an associative array (e.g. \$model['key']).\n\n";
52  $lines = array_slice(explode("\n", trim(print_r($this->toArray(), true))), 2, -1);
53  $output .= implode("\n", $lines);
54 
55  if ($this->structure) {
56  $output .= "\n\nModel structure\n---------------\n\n";
57  $output .= "The following JSON document defines how the model was parsed from an HTTP response into the "
58  . "associative array structure you see above.\n\n";
59  $output .= ' ' . json_encode($this->structure->toArray()) . "\n\n";
60  }
61 
62  return $output . "\n";
63  }
64 }
Guzzle\Common\Collection\$data
$data
Definition: paymethod/paypal/lib/vendor/guzzle/guzzle/src/Guzzle/Common/Collection.php:17
Guzzle\Service\Resource\Model\$structure
$structure
Definition: Model.php:17
Guzzle\Service\Description\Parameter
Definition: Parameter.php:10
Guzzle\Service\Resource\Model
Definition: Model.php:11
Guzzle\Service\Resource\Model\__construct
__construct(array $data=array(), Parameter $structure=null)
Definition: Model.php:23
Guzzle\Service\Resource\Model\getStructure
getStructure()
Definition: Model.php:34
Guzzle\Service\Resource\Model\__toString
__toString()
Definition: Model.php:44
Guzzle\Service\Resource
Definition: AbstractResourceIteratorFactory.php:3
Guzzle\Common\Collection\toArray
toArray()
Definition: paymethod/paypal/lib/vendor/guzzle/guzzle/src/Guzzle/Common/Collection.php:58
Guzzle\Common\Collection
Definition: paymethod/paypal/lib/vendor/guzzle/guzzle/src/Guzzle/Common/Collection.php:11