Open Journal Systems  3.3.0
COUNTER.php
1 <?php
2 
3 /*
4  * Copyright (c) 2015 University of Pittsburgh
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 namespace COUNTER {
72  class ReportBuilder {
73 
74  const COUNTER_NAMESPACE = 'http://www.niso.org/schemas/counter';
75 
83  protected function validateOneOf($object, $className) {
84  if (strpos($className, '\\') === FALSE) {
85  $expectedClassname = 'COUNTER\\'.$className;
86  } elseif (strpos($className, '\\') === 0) {
87  $expectedClassname = substr($className, 1);
88  } else {
89  $expectedClassname = $className;
90  }
91  if (is_null($object)) {
92  throw new \Exception('Invalid object. Expected "'.$expectedClassname.'", got "NULL"');
93  } elseif (is_array($object)) {
94  switch ($className) {
95  default:
96  throw new \Exception('Invalid class. Expected "'.$expectedClassname.'", got unparsable array');
97  }
98  } elseif (is_string($object)) {
99  switch ($className) {
100  case '\DateTime':
101  $date = date_create($object);
102  if ($date) {
103  return $date;
104  }
105  break;
106  default:
107  }
108  throw new \Exception('Invalid class. Expected "'.$expectedClassname.'", got unparsable string');
109  } elseif ($expectedClassname == get_class($object) || is_subclass_of($object, $expectedClassname)) {
110  return $object;
111  } else {
112  throw new \Exception('Invalid class. Expected "'.$expectedClassname.'", got "'.get_class($object).'"');
113  }
114  }
115 
123  protected function validateOneOrMoreOf($objects, $className) {
124  if (is_array($objects)) {
125  foreach ($objects as $object) {
126  $this->validateOneOf($object, $className);
127  }
128  return $objects;
129  } else {
130  return array($this->validateOneOf($objects, $className));
131  }
132  }
133 
141  protected function validateZeroOrMoreOf($objects, $className) {
142  if (empty($objects)) {
143  return;
144  } else {
145  return $this->validateOneOrMoreOf($objects, $className);
146  }
147  }
148 
156  protected function validateZeroOrOneOf($object, $className) {
157  if (empty($object)) {
158  return;
159  } else {
160  return $this->validateOneOf($object, $className);
161  }
162  }
163 
170  protected function validatePositiveInteger($int) {
171  $intval = intval($int);
172  if (!is_int($intval) || $intval < 0) {
173  throw new \Exception('Invalid positive integer: '.gettype($int).' value '.$int);
174  }
175  return $intval;
176  }
177 
184  protected function validateString($string) {
185  if (!is_string($string)) {
186  throw new \Exception('Invalid string: '.gettype($string));
187  }
188  return $string;
189  }
190 
197  protected function validateStrings($array) {
198  if (is_array($array)) {
199  foreach ($array as $string) {
200  $this->validateString($string);
201  }
202  return $array;
203  } elseif (is_string($array)) {
204  return array($array);
205  } elseif (!empty($array)) {
206  throw new \Exception('Invalid string array: '.gettype($array));
207  }
208  }
209 
215  protected static function isAssociative($array) {
216  return count(array_filter(array_keys($array), 'is_string')) > 0;
217  }
218 
226  protected function buildMultiple($classname, $array) {
227  if (!is_array($array)) {
228  return array();
229  }else if (self::isAssociative($array)) {
230  return $classname::build($array);
231  } else {
232  $elements = array();
233  foreach ($array as $element) {
234  $elements[] = $classname::build($element);
235  }
236  return $elements;
237  }
238  }
239 
245  protected function getItemDataTypes() {
246  return array('Journal', 'Database', 'Platform', 'Book', 'Collection', 'Multimedia', 'Article');
247  }
248 
253  protected function getIdentifierTypes() {
254  return array('Online_ISSN', 'Print_ISSN', 'Online_ISBN', 'Print_ISBN', 'DOI', 'Proprietary');
255  }
256 
261  protected function getContributorIdentifierTypes() {
262  return array('ORCID', 'ISNI', 'Proprietary');
263  }
264 
270  protected function getDateTypes() {
271  return array('PubDate', 'FirstAccessedOnline', 'Proprietary');
272  }
273 
279  protected function getAttributeTypes() {
280  return array('ArticleVersion', 'ArticleType', 'QualificationName', 'QualificationLevel');
281  }
282 
287  protected function getMetricTypes() {
288  return array('abstract', 'audio', 'data_set', 'ft_epub', 'ft_html', 'ft_html_mobile', 'ft_pdf', 'ft_pdf_mobile', 'ft_ps', 'ft_ps_mobile', 'ft_total', 'image', 'multimedia', 'no_license', 'other', 'podcast', 'record_view', 'reference', 'result_click', 'search_fed', 'search_reg', 'sectioned_html', 'toc', 'turnaway', 'video');
289  }
290 
295  protected function getCategories() {
296  return array('Requests', 'Searches', 'Access_denied');
297  }
298 
304  public function __toString() {
305  $doc = $this->asDOMDocument();
306  $doc->formatOutput = TRUE;
307  return $doc->saveXML();
308  }
309 
315  public function asDOMDocument() {
316  throw new Exception(get_class($this).' does not implement asDOMDocument()');
317  }
318 
325  public static function build($array) {
326  throw new \Exception('Failed to build '.get_called_class().' from data '.var_export($array, true));
327  }
328  }
329 
334  class Reports extends ReportBuilder {
335  /*
336  * @var array one or more COUNTER\Report objects
337  * @access private
338  */
339  private $report = array();
340 
347  public function __construct($reports) {
348  $this->report = $this->validateOneOrMoreOf($reports, 'Report');
349  }
350 
357  public static function build($array) {
358  if (is_array($array)) {
359  if (isset($array['Report'])) {
360  // Nicely structured associative array
361  $reports = parent::buildMultiple('COUNTER\Report', $array['Report']);
362  return new self($reports);
363  } elseif (!parent::isAssociative($array)) {
364  // Just an array of reports
365  $reports = parent::buildMultiple('COUNTER\Report', $array);
366  return new self($reports);
367  }
368  }
369  parent::build($array);
370  }
371 
378  public function addReport($report) {
379  $this->report[] = $this->validateOneOf($report, 'Report');
380  }
381 
386  public function getReports() {
387  return $this->report;
388  }
389 
394  public function asDOMDocument() {
395  $doc = new \DOMDocument();
396  $root = $doc->appendChild($doc->createElementNS(self::COUNTER_NAMESPACE, 'Reports'));
397  $xmlns = $doc->createAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation');
398  $xmlns->value = self::COUNTER_NAMESPACE.' http://www.niso.org/schemas/sushi/counter4_1.xsd';
399  $root->appendChild($xmlns);
400  foreach ($this->report as $rep) {
401  $root->appendChild($doc->importNode($rep->asDOMDocument()->documentElement, true));
402  }
403  return $doc;
404  }
405  }
406 
410  class Report extends ReportBuilder {
411  /*
412  * @var string Report attribute "Created"
413  * @access private
414  */
415  private $created;
416  /*
417  * @var string Report attribute "ID"
418  * @access private
419  */
420  private $id;
421  /*
422  * @var string Report attribute "Version"
423  * @access private
424  */
425  private $version;
426  /*
427  * @var string Report attribute "Name"
428  * @access private
429  */
430  private $name;
431  /*
432  * @var string Report attribute "Title"
433  * @access private
434  */
435  private $title;
436  /*
437  * @var COUNTER\Vendor
438  * @access private
439  */
440  private $vendor;
441  /*
442  * @var array one or more COUNTER\Customer objects
443  * @access private
444  */
445  private $customer;
446 
459  public function __construct($id, $version, $name, $title, $customers, $vendor, $created = '') {
460  foreach (array('id', 'version', 'name', 'title', 'created') as $arg) {
461  $this->$arg = $this->validateString($$arg);
462  }
463  if (!$created) {
464  $this->created = date("Y-m-d\Th:i:sP");
465  }
466  $this->vendor = $this->validateOneOf($vendor, 'Vendor');
467  $this->customer = $this->validateOneOrMoreOf($customers, 'Customer');
468  }
469 
476  public static function build($array) {
477  if (is_array($array)) {
478  if (isset($array['ID']) && isset($array['Version']) && isset($array['Name']) && isset($array['Title']) && isset($array['Customer']) && isset($array['Vendor'])) {
479  // Nicely structured associative array
480  $customers = parent::buildMultiple('COUNTER\Customer', $array['Customer']);
481  return new self(
482  $array['ID'],
483  $array['Version'],
484  $array['Name'],
485  $array['Title'],
486  $customers,
487  Vendor::build($array['Vendor']),
488  isset($array['Created']) ? $array['Created'] : ''
489  );
490  }
491  }
492  parent::build($array);
493  }
494 
499  public function asDOMDocument() {
500  $doc = new \DOMDocument();
501  $root = $doc->appendChild($doc->createElement('Report'));
502  foreach (array('Created', 'ID', 'Version', 'Name', 'Title') as $arg) {
503  $lcarg = strtolower($arg);
504  $attrAttr = $doc->createAttribute($arg);
505  $attrAttr->appendChild($doc->createTextNode($this->$lcarg));
506  $root->appendChild($attrAttr);
507  }
508  $root->appendChild($doc->importNode($this->vendor->asDOMDocument()->documentElement, true));
509  foreach ($this->customer as $customer) {
510  $root->appendChild($doc->importNode($customer->asDOMDocument()->documentElement, true));
511  }
512  return $doc;
513  }
514  }
515 
519  class Vendor extends ReportBuilder {
520  /*
521  * @var string Vendor element "Name"
522  * @access private
523  */
524  private $name;
525  /*
526  * @var string Vendor element "ID"
527  * @access private
528  */
529  private $id;
530  /*
531  * @var array zero or more COUNTER\Contact elements
532  * @access private
533  */
534  private $contact = array();
535  /*
536  * @var string Vendor element "WebSiteUrl"
537  * @access private
538  */
539  private $webSiteUrl;
540  /*
541  * @var string Vendor element "LogoUrl"
542  * @access private
543  */
544  private $logoUrl;
545 
556  public function __construct($id, $name = '', $contacts = array(), $webSiteUrl = '', $logoUrl = '') {
557  foreach (array('id', 'name', 'webSiteUrl', 'logoUrl') as $arg) {
558  $this->$arg = $this->validateString($$arg);
559  }
560  $this->contact = $this->validateZeroOrMoreOf($contacts, 'Contact');
561  }
562 
569  public static function build($array) {
570  if (is_array($array)) {
571  if (isset($array['ID'])) {
572  // Nicely structured associative array
573  $contacts = parent::buildMultiple('COUNTER\Contact', isset($array['Contact']) ? $array['Contact'] : array());
574  return new self(
575  $array['ID'],
576  isset($array['Name']) ? $array['Name'] : '',
577  $contacts,
578  isset($array['WebSiteUrl']) ? $array['WebSiteUrl'] : '',
579  isset($array['LogoUrl']) ? $array['LogoUrl'] : ''
580  );
581  }
582  }
583  parent::build($array);
584  }
585 
590  public function asDOMDocument() {
591  $doc = new \DOMDocument();
592  $root = $doc->appendChild($doc->createElement('Vendor'));
593  if ($this->name) {
594  $root->appendChild($doc->createElement('Name'))->appendChild($doc->createTextNode($this->name));
595  }
596  $root->appendChild($doc->createElement('ID'))->appendChild($doc->createTextNode($this->id));
597  if ($this->contact) {
598  foreach ($this->contact as $contact) {
599  $root->appendChild($doc->importNode($contact->asDOMDocument()->documentElement, true));
600  }
601  }
602  if ($this->webSiteUrl) {
603  $root->appendChild($doc->createElement('WebSiteUrl'))->appendChild($doc->createTextNode($this->webSiteUrl));
604  }
605  if ($this->logoUrl) {
606  $root->appendChild($doc->createElement('LogoUrl'))->appendChild($doc->createTextNode($this->logoUrl));
607  }
608  return $doc;
609  }
610  }
611 
615  class Contact extends ReportBuilder {
616  /*
617  * @var string Contact element "Contact"
618  * @access private
619  */
620  private $contact;
621  /*
622  * @var string Contact element "Email"
623  * @access private
624  */
625  private $email;
626 
634  public function __construct($contact = '', $email = '') {
635  foreach (array('contact', 'email') as $arg) {
636  $this->$arg = $this->validateString($$arg);
637  }
638  }
639 
646  public static function build($array) {
647  if (is_array($array)) {
648  if (isset($array['E-mail'])) {
649  $array['Email'] = $array['E-mail'];
650  unset($array['E-mail']);
651  }
652  if (isset($array['Contact']) || isset($array['Email'])) {
653  return new self($array['Contact'] ? $array['Contact'] : '', $array['Email'] ? $array['Email'] : '');
654  } elseif (count(array_keys($array)) == 1 && parent::isAssociative($array)) {
655  // Loosely structured associative array (name/email => name/email)
656  foreach ($array as $k => $v) {
657  if (filter_var($k, FILTER_VALIDATE_EMAIL)) {
658  // email => name
659  return new self($v, $k);
660  } else {
661  // name => email
662  return new self($k, $v);
663  }
664  }
665  } elseif (count(array_keys($array)) == 1 && !parent::isAssociative($array)) {
666  // Loosely array with a name or email
667  if (filter_var($k, FILTER_VALIDATE_EMAIL)) {
668  // email
669  return new self('', $array[0]);
670  } else {
671  // name
672  return new self($array[0]);
673  }
674  }
675  } elseif (is_string($array)) {
676  // Just a name or email
677  if (filter_var($array, FILTER_VALIDATE_EMAIL)) {
678  // email
679  return new self('', $array);
680  } else {
681  // name
682  return new self($array);
683  }
684  }
685  parent::build($array);
686  }
687 
692  public function asDOMDocument() {
693  $doc = new \DOMDocument();
694  $root = $doc->appendChild($doc->createElement('Contact'));
695  if ($this->contact) {
696  $root->appendChild($doc->createElement('Contact'))->appendChild($doc->createTextNode($this->contact));
697  }
698  if ($this->email) {
699  $root->appendChild($doc->createElement('E-mail'))->appendChild($doc->createTextNode($this->email));
700  }
701  return $doc;
702  }
703  }
704 
708  class Customer extends ReportBuilder {
709  /*
710  * @var string Customer element "Name"
711  * @access private
712  */
713  private $name;
714  /*
715  * @var string Customer element "ID"
716  * @access private
717  */
718  private $id;
719  /*
720  * @var array zero or more COUNTER\Contact elements
721  * @access private
722  */
723  private $contact;
724  /*
725  * @var string Customer element "WebSiteUrl"
726  * @access private
727  */
728  private $webSiteUrl;
729  /*
730  * @var string Customer element "LogoUrl"
731  * @access private
732  */
733  private $logoUrl;
734  /*
735  * @var string Customer element "Consortium"
736  * @access private
737  */
738  private $consortium;
739  /*
740  * @var array zero or more COUNTER\Identifier elements
741  * @access private
742  */
743  private $institutionalIdentifier;
744  /*
745  * @var array one or more COUNTER\ReportItem elements
746  * @access private
747  */
748  private $reportItems;
749 
763  public function __construct($id, $reportItems, $name = '', $contacts = array(), $webSiteUrl = '' , $logoUrl = '', $consortium = NULL, $institutionalIdentifier = array()) {
764  foreach (array('id', 'name', 'webSiteUrl', 'logoUrl') as $arg) {
765  $this->$arg = $this->validateString($$arg);
766  }
767  $this->reportItems = $this->validateOneOrMoreOf($reportItems, 'ReportItems');
768  $this->contact = $this->validateZeroOrMoreOf($contacts, 'Contact');
769  $this->consortium = $this->validateZeroOrOneOf($consortium, 'Consortium');
770  $this->institutionalIdentifier = $this->validateZeroOrMoreOf($institutionalIdentifier, 'Identifier');
771  }
772 
779  public static function build($array) {
780  if (is_array($array)) {
781  if (isset($array['ID']) && isset($array['ReportItems'])) {
782  // Nicely structured associative array
783  $items = parent::buildMultiple('COUNTER\ReportItems', $array['ReportItems']);
784  $ids = parent::buildMultiple('COUNTER\Identifier', isset($array['InstitutionalIdentifier']) ? $array['InstitutionalIdentifier'] : array());
785  $contacts = parent::buildMultiple('COUNTER\Contact', isset($array['Contact']) ? $array['Contact'] : array());
786  return new self(
787  $array['ID'],
788  $items,
789  isset($array['Name']) ? $array['Name'] : '',
790  $contacts,
791  isset($array['WebSiteUrl']) ? $array['WebSiteUrl'] : '',
792  isset($array['LogoUrl']) ? $array['LogoUrl'] : '',
793  isset($array['Consortium']) ? Consortium::build($array['Consortium']) : NULL,
794  $ids
795  );
796  }
797  }
798  parent::build($array);
799  }
800 
805  public function asDOMDocument() {
806  $doc = new \DOMDocument();
807  $root = $doc->appendChild($doc->createElement('Customer'));
808  if ($this->name) {
809  $root->appendChild($doc->createElement('Name'))->appendChild($doc->createTextNode($this->name));
810  }
811  $root->appendChild($doc->createElement('ID'))->appendChild($doc->createTextNode($this->id));
812  if ($this->contact) {
813  foreach ($this->contact as $contact) {
814  $root->appendChild($doc->importNode($contact->asDOMDocument()->documentElement, true));
815  }
816  }
817  if ($this->webSiteUrl) {
818  $root->appendChild($doc->createElement('WebSiteUrl'))->appendChild($doc->createTextNode($this->webSiteUrl));
819  }
820  if ($this->logoUrl) {
821  $root->appendChild($doc->createElement('LogoUrl'))->appendChild($doc->createTextNode($this->logoUrl));
822  }
823  if ($this->consortium) {
824  $root->appendChild($doc->importNode($this->consortium->asDOMDocument()->documentElement, true));
825  }
826  if ($this->institutionalIdentifier) {
827  foreach ($this->institutionalIdentifier as $id) {
828  $root->appendChild($doc->importNode($id->asDOMDocument()->documentElement, true));
829  }
830  }
831  foreach ($this->reportItems as $rep) {
832  $root->appendChild($doc->importNode($rep->asDOMDocument()->documentElement, true));
833  }
834  return $doc;
835  }
836  }
837 
841  class Consortium extends ReportBuilder {
842  /*
843  * @var string Consortium element "Code"
844  * @access private
845  */
846  private $code;
847  /*
848  * @var string Consortium element "WellKnownName"
849  * @access private
850  */
851  private $wellKnownName;
852 
853  /*
854  * Construct the object
855  * @param string $wellKnownName
856  * @param string $code optional
857  */
858  public function __construct($wellKnownName, $code = '') {
859  foreach (array('wellKnownName', 'code') as $arg) {
860  $this->$arg = $this->validateString($$arg);
861  }
862  }
863 
870  public static function build($array) {
871  if (is_array($array)) {
872  if (isset($array['WellKnownName'])) {
873  // Nicely structured associative array
874  return new self($array['WellKnownName'], $array['Code'] ? $array['Code'] : '');
875  } elseif (count(array_keys($array)) == 1 && parent::isAssociative($array)) {
876  // Loosely structured associative array (name => code)
877  foreach ($array as $k => $v) {
878  return new self($k, $v);
879  }
880  } elseif (count(array_keys($array)) == 1 && !parent::isAssociative($array)) {
881  // Loosely array with a name
882  return new self($array[0]);
883  }
884  } elseif (is_string($array)) {
885  // Just a name
886  return new self($array);
887  }
888  parent::build($array);
889  }
890 
895  public function asDOMDocument() {
896  $doc = new \DOMDocument();
897  $root = $doc->appendChild($doc->createElement('Consortium'));
898  if ($this->code) {
899  $root->appendChild($doc->createElement('Code'))->appendChild($doc->createTextNode($this->code));
900  }
901  $root->appendChild($doc->createElement('WellKnownName'))->appendChild($doc->createTextNode($this->wellKnownName));
902  return $doc;
903  }
904  }
905 
909  class ReportItems extends ReportBuilder {
910  /*
911  * @var COUNTER\ParentItem ReportItem element "ParentItem"
912  * @access private
913  */
914  private $parentItem;
915  /*
916  * @var array zero or more COUNTER\Identifier elements
917  * @access private
918  */
919  private $itemIdentifier;
920  /*
921  * @var array zero or more COUNTER\ItemContributor elements
922  * @access private
923  */
924  private $itemContributor;
925  /*
926  * @var array zero or more COUNTER\ItemDate elements
927  * @access private
928  */
929  private $itemDate;
930  /*
931  * @var array zero or more COUNTER\ItemAttribute elements
932  * @access private
933  */
934  private $itemAttribute;
935  /*
936  * @var string ReportItem element "ItemPlatform"
937  * @access private
938  */
939  private $itemPlatform;
940  /*
941  * @var string ReportItem element "ItemPublisher"
942  * @access private
943  */
944  private $itemPublisher;
945  /*
946  * @var string ReportItem element "ItemName"
947  * @access private
948  */
949  private $itemName;
950  /*
951  * @var COUNTER\ItemDataType ReportItem element "ItemData"
952  * @access private
953  */
954  private $itemDataType;
955  /*
956  * @var array one or more COUNTER\Metric elements
957  * @access private
958  */
959  private $itemPerformance;
960 
976  public function __construct($itemPlatform, $itemName, $itemDataType, $itemPerformance, $parentItem = NULL, $itemIdentifiers = array(), $itemContributors = array(), $itemDates = array(), $itemAttributes = array(), $itemPublisher = '') {
977  foreach (array('itemPlatform', 'itemPublisher', 'itemName', 'itemDataType') as $arg) {
978  $this->$arg = $this->validateString($$arg);
979  }
980  if (!in_array($itemDataType, $this->getItemDataTypes())) {
981  throw new \Exception('Invalid item data type: '.$itemDataType);
982  }
983  $this->itemPerformance = $this->validateOneOrMoreOf($itemPerformance, 'Metric');
984  $this->parentItem = $this->validateZeroOrOneOf($parentItem, 'ParentItem');
985  $this->itemIdentifier = $this->validateZeroOrMoreOf($itemIdentifiers, 'Identifier');
986  $this->itemContributor = $this->validateZeroOrMoreOf($itemContributors, 'ItemContributor');
987  $this->itemDate = $this->validateZeroOrMoreOf($itemDates, 'ItemDate');
988  $this->itemAttribute = $this->validateZeroOrMoreOf($itemAttributes, 'ItemAttribute');
989  }
990 
997  public static function build($array) {
998  if (is_array($array)) {
999  if (isset($array['ItemPlatform']) && isset($array['ItemName']) && isset($array['ItemDataType']) && isset($array['ItemPerformance'])) {
1000  // Nicely structured associative array
1001  $performance = parent::buildMultiple('COUNTER\Metric', $array['ItemPerformance']);
1002  $ids = parent::buildMultiple('COUNTER\Identifier', isset($array['ItemIdentifier']) ? $array['ItemIdentifier'] : array());
1003  $contributors = parent::buildMultiple('COUNTER\ItemContributor', isset($array['ItemContributor']) ? $array['ItemContributor'] : array());
1004  $dates = parent::buildMultiple('COUNTER\ItemDate', isset($array['ItemDate']) ? $array['ItemDate'] : array());
1005  $attributes = parent::buildMultiple('COUNTER\ItemAttribute', isset($array['ItemAttribute']) ? $array['ItemAttribute'] : array());
1006  return new self(
1007  $array['ItemPlatform'],
1008  $array['ItemName'],
1009  $array['ItemDataType'],
1010  $performance,
1011  isset($array['ParentItem']) ? ParentItem::build($array['ParentItem']) : NULL,
1012  $ids,
1013  $contributors,
1014  $dates,
1015  $attributes,
1016  isset($array['ItemPublisher']) ? $array['ItemPublisher'] : ''
1017  );
1018  }
1019  }
1020  parent::build($array);
1021  }
1022 
1027  public function asDOMDocument() {
1028  $doc = new \DOMDocument();
1029  $root = $doc->appendChild($doc->createElement('ReportItems'));
1030  if ($this->parentItem) {
1031  $root->appendChild($doc->importNode($this->parentItem->asDOMDocument()->documentElement, true));
1032  }
1033  if ($this->itemIdentifier) {
1034  foreach ($this->itemIdentifier as $id) {
1035  $root->appendChild($doc->importNode($id->asDOMDocument()->documentElement, true));
1036  }
1037  }
1038  if ($this->itemContributor) {
1039  foreach ($this->itemContributor as $contrib) {
1040  $root->appendChild($doc->importNode($contrib->asDOMDocument()->documentElement, true));
1041  }
1042  }
1043  if ($this->itemDate) {
1044  foreach ($this->itemDate as $date) {
1045  $root->appendChild($doc->importNode($date->asDOMDocument()->documentElement, true));
1046  }
1047  }
1048  if ($this->itemAttribute) {
1049  foreach ($this->itemAttribute as $attrib) {
1050  $root->appendChild($doc->importNode($attrib->asDOMDocument()->documentElement, true));
1051  }
1052  }
1053  $root->appendChild($doc->createElement('ItemPlatform'))->appendChild($doc->createTextNode($this->itemPlatform));
1054  if ($this->itemPublisher) {
1055  $root->appendChild($doc->createElement('ItemPublisher'))->appendChild($doc->createTextNode($this->itemPublisher));
1056  }
1057  $root->appendChild($doc->createElement('ItemName'))->appendChild($doc->createTextNode($this->itemName));
1058  $root->appendChild($doc->createElement('ItemDataType'))->appendChild($doc->createTextNode($this->itemDataType));
1059  foreach ($this->itemPerformance as $perf) {
1060  $root->appendChild($doc->importNode($perf->asDOMDocument()->documentElement, true));
1061  }
1062  return $doc;
1063  }
1064  }
1065 
1069  class ParentItem extends ReportBuilder {
1070  /*
1071  * @var array zero or more COUNTER\Identifier elements
1072  * @access private
1073  */
1074  private $itemIdentifier;
1075  /*
1076  * @var array zero or more COUNTER\ItemContributor elements
1077  * @access private
1078  */
1079  private $itemContributor;
1080  /*
1081  * @var array zero or more COUNTER\ItemDate elements
1082  * @access private
1083  */
1084  private $itemDate;
1085  /*
1086  * @var array zero or more COUNTER\ItemAttribute elements
1087  * @access private
1088  */
1089  private $itemAttribute;
1090  /*
1091  * @var string ParentItem element "ItemPublisher"
1092  * @access private
1093  */
1094  private $itemPublisher;
1095  /*
1096  * @var string ParentItem element "ItemName"
1097  * @access private
1098  */
1099  private $itemName;
1100  /*
1101  * @var COUNTER\DataType ParentItem element "ItemDataType"
1102  * @access private
1103  */
1104  private $itemDataType;
1105 
1118  public function __construct($itemName, $itemDataType, $itemIdentifiers = array(), $itemContributors = array(), $itemDates = array(), $itemAttributes = array(), $itemPublisher = '') {
1119  foreach (array('itemName', 'itemDataType', 'itemPublisher') as $arg) {
1120  $this->$arg = $this->validateString($$arg);
1121  }
1122  if (!in_array($itemDataType, $this->getItemDataTypes())) {
1123  throw new \Exception('Invalid type: '.$type);
1124  }
1125  $this->itemIdentifier = $this->validateZeroOrMoreOf($itemIdentifiers, 'Identifier');
1126  $this->itemContributor = $this->validateZeroOrMoreOf($itemContributors, 'ItemContributor');
1127  $this->itemDate = $this->validateZeroOrMoreOf($itemDates, 'ItemDate');
1128  $this->itemAttribute = $this->validateZeroOrMoreOf($itemAttributes, 'ItemAttribute');
1129  }
1130 
1137  public static function build($array) {
1138  if (is_array($array)) {
1139  if (isset($array['ItemName']) && isset($array['ItemDataType'])) {
1140  // Nicely structured associative array
1141  $ids = parent::buildMultiple('COUNTER\Identifier', isset($array['ItemIdentifier']) ? $array['ItemIdentifier']: array());
1142  $contributors = parent::buildMultiple('COUNTER\ItemContributor', isset($array['ItemContributor']) ? $array['ItemContributor'] : array());
1143  $dates = parent::buildMultiple('COUNTER\ItemDate', isset($array['ItemDate']) ? $array['ItemDate'] : array());
1144  $attributes = parent::buildMultiple('COUNTER\ItemAttribute', isset($array['ItemAttribute']) ? $array['ItemAttribute'] : array());
1145  return new self(
1146  $array['ItemName'],
1147  $array['ItemDataType'],
1148  $ids,
1149  $contributors,
1150  $dates,
1151  $attributes,
1152  isset($array['ItemPublisher']) ? $array['ItemPublisher'] : ''
1153  );
1154  }
1155  }
1156  parent::build($array);
1157  }
1158 
1163  public function asDOMDocument() {
1164  $doc = new \DOMDocument();
1165  $root = $doc->appendChild($doc->createElement('ParentItem'));
1166  if ($this->itemIdentifier) {
1167  foreach ($this->itemIdentifier as $id) {
1168  $root->appendChild($doc->importNode($id->asDOMDocument()->documentElement, true));
1169  }
1170  }
1171  if ($this->itemContributor) {
1172  foreach ($this->itemContributor as $contrib) {
1173  $root->appendChild($doc->importNode($contrib->asDOMDocument()->documentElement, true));
1174  }
1175  }
1176  if ($this->itemDate) {
1177  foreach ($this->itemDate as $date) {
1178  $root->appendChild($doc->importNode($date->asDOMDocument()->documentElement, true));
1179  }
1180  }
1181  if ($this->itemAttribute) {
1182  foreach ($this->itemAttribute as $attrib) {
1183  $root->appendChild($doc->importNode($attrib->asDOMDocument()->documentElement, true));
1184  }
1185  }
1186  if ($this->itemPublisher) {
1187  $root->appendChild($doc->createElement('ItemPublisher'))->appendChild($doc->createTextNode($this->itemPublisher));
1188  }
1189  $root->appendChild($doc->createElement('ItemName'))->appendChild($doc->createTextNode($this->itemName));
1190  $root->appendChild($doc->createElement('ItemDataType'))->appendChild($doc->createTextNode($this->itemDataType));
1191  return $doc;
1192  }
1193  }
1194 
1198  class ItemContributor extends ReportBuilder {
1199  /*
1200  * @var array zero or more COUNTER\ItemContributorID elements
1201  * @access private
1202  */
1203  private $itemContributorId;
1204  /*
1205  * @var string ItemContributor element "Name"
1206  * @access private
1207  */
1208  private $itemContributorName;
1209  /*
1210  * @var string ItemContributor element "Affiliation"
1211  * @access private
1212  */
1213  private $itemContributorAffiliation;
1214  /*
1215  * @var string ItemContributor element "Role"
1216  * @access private
1217  */
1218  private $itemContributorRole;
1219 
1229  public function __construct($itemContributorIds = array(), $itemContributorName = '', $itemContributorAffiliations = array(), $itemContributorRoles = array()) {
1230  $this->itemContributorId = $this->validateZeroOrMoreOf($itemContributorIds, 'ItemContributorId');
1231  $this->itemContributorName = $this->validateString($itemContributorName);
1232  $this->itemContributorAffiliation = $this->validateStrings($itemContributorAffiliations);
1233  $this->itemContributorRole = $this->validateStrings($itemContributorRoles);
1234  }
1235 
1242  public static function build($array) {
1243  if (is_array($array)) {
1244  if (isset($array['ItemContributorID']) || isset($array['ItemContributorName']) || isset($array['ItemContributorAffiliation']) || isset($array['ItemContributorRole'])) {
1245  // Nicely structured associative array
1246  $ids = parent::buildMultiple('COUNTER\ItemContributorId', isset($array['ItemContributorID']) ? $array['ItemContributorID'] : array());
1247  return new self(
1248  $ids,
1249  isset($array['ItemContributorName']) ? $array['ItemContributorName'] : '',
1250  isset($array['ItemContributorAffiliation']) ? $array['ItemContributorAffiliation'] : '',
1251  isset($array['ItemContributorRole']) ? $array['ItemContributorRole'] : ''
1252  );
1253  }
1254  }
1255  parent::build($array);
1256  }
1257 
1262  public function asDOMDocument() {
1263  $doc = new \DOMDocument();
1264  $root = $doc->appendChild($doc->createElement('ItemContributor'));
1265  if ($this->itemContributorId) {
1266  foreach ($this->itemContributorId as $id) {
1267  $root->appendChild($doc->importNode($id->asDOMDocument()->documentElement, true));
1268  }
1269  }
1270  if ($this->itemContributorName) {
1271  $root->appendChild($doc->createElement('ItemContributorName'))->appendChild($doc->createTextNode($this->itemContributorName));
1272  }
1273  if ($this->itemContributorAffiliation) {
1274  foreach ($this->itemContributorAffiliation as $affiliation) {
1275  $root->appendChild($doc->createElement('ItemContributorAffiliation', $affiliation));
1276  }
1277  }
1278  if ($this->itemContributorRole) {
1279  foreach ($this->itemContributorRole as $role) {
1280  $root->appendChild($doc->createElement('ItemContributorRole', $role));
1281  }
1282  }
1283  return $doc;
1284  }
1285  }
1286 
1290  class ItemContributorId extends ReportBuilder {
1291  /*
1292  * @var string ItemContributorID element "Type"
1293  * @access private
1294  */
1295  private $type;
1296  /*
1297  * @var string ItemContributorID element "Value"
1298  * @access private
1299  */
1300  private $value;
1301 
1309  public function __construct($type, $value) {
1310  foreach (array('type', 'value') as $arg) {
1311  $this->$arg = $this->validateString($$arg);
1312  }
1313  if (!in_array($type, $this->getContributorIdentifierTypes())) {
1314  throw new \Exception('Invalid type: '.$type);
1315  }
1316  }
1317 
1324  public static function build($array) {
1325  if (is_array($array)) {
1326  if (isset($array['Type']) && isset($array['Value'])) {
1327  // Nicely structured associative array
1328  return new self($array['Type'], $array['Value']);
1329  } elseif (count(array_keys($array)) == 1 && parent::isAssociative($array)) {
1330  // Loosely structured associative array (type => value)
1331  foreach ($array as $k => $v) {
1332  return new self($k, $v);
1333  }
1334  }
1335  }
1336  parent::build($array);
1337  }
1338 
1343  public function asDOMDocument() {
1344  $doc = new \DOMDocument();
1345  $root = $doc->appendChild($doc->createElement('ItemContributorID'));
1346  $root->appendChild($doc->createElement('Type'))->appendChild($doc->createTextNode($this->type));
1347  $root->appendChild($doc->createElement('Value'))->appendChild($doc->createTextNode($this->value));
1348  return $doc;
1349  }
1350  }
1351 
1355  class Identifier extends ReportBuilder {
1356  /*
1357  * @var string Identifier element "Type"
1358  * @access private
1359  */
1360  private $type;
1361  /*
1362  * @var string Identifier element "Type"
1363  * @access private
1364  */
1365  private $value;
1366 
1374  public function __construct($type, $value) {
1375  foreach (array('type', 'value') as $arg) {
1376  $this->$arg = $this->validateString($$arg);
1377  }
1378  if (!in_array($type, $this->getIdentifierTypes())) {
1379  throw new \Exception('Invalid type: '.$type);
1380  }
1381  }
1382 
1389  public static function build($array) {
1390  if (is_array($array)) {
1391  if (isset($array['Type']) && isset($array['Value'])) {
1392  // Nicely structured associative array
1393  return new self($array['Type'], $array['Value']);
1394  } elseif (count(array_keys($array)) == 1 && parent::isAssociative($array)) {
1395  // Loosely structured associative array (type => value)
1396  foreach ($array as $k => $v) {
1397  return new self($k, $v);
1398  }
1399  }
1400  }
1401  parent::build($array);
1402  }
1403 
1408  public function asDOMDocument() {
1409  $doc = new \DOMDocument();
1410  $root = $doc->appendChild($doc->createElement('ItemIdentifier'));
1411  $root->appendChild($doc->createElement('Type'))->appendChild($doc->createTextNode($this->type));
1412  $root->appendChild($doc->createElement('Value'))->appendChild($doc->createTextNode($this->value));
1413  return $doc;
1414  }
1415  }
1416 
1420  class ItemDate extends ReportBuilder{
1421  /*
1422  * @var string ItemDate element "Type"
1423  * @access private
1424  */
1425  private $type;
1426  /*
1427  * @var string ItemDate element "Value"
1428  * @access private
1429  */
1430  private $value;
1431 
1439  public function __construct($type, $value) {
1440  $this->type = $this->validateString($type);
1441  if (!in_array($type, $this->getDateTypes())) {
1442  throw new \Exception('Invalid type: '.$type);
1443  }
1444  $this->value = $this->validateOneOf($value, '\DateTime');
1445  }
1446 
1453  public static function build($array) {
1454  if (is_array($array)) {
1455  if (isset($array['Type']) && isset($array['Value'])) {
1456  // Nicely structured associative array
1457  return new self($array['Type'], $array['Value']);
1458  } elseif (count(array_keys($array)) == 1 && parent::isAssociative($array)) {
1459  // Loosely structured associative array (type => value)
1460  foreach ($array as $k => $v) {
1461  return new self($k, $v);
1462  }
1463  }
1464  }
1465  parent::build($array);
1466  }
1467 
1472  public function asDOMDocument() {
1473  $doc = new \DOMDocument();
1474  $root = $doc->appendChild($doc->createElement('ItemDate'));
1475  $root->appendChild($doc->createElement('Type'))->appendChild($doc->createTextNode($this->type));
1476  $root->appendChild($doc->createElement('Value'))->appendChild($doc->createTextNode(date_format($this->value, 'Y-m-d')));
1477  return $doc;
1478  }
1479  }
1480 
1484  class ItemAttribute extends ReportBuilder {
1485  /*
1486  * @var string ItemAttribute element "Type"
1487  * @access private
1488  */
1489  private $type;
1490  /*
1491  * @var string ItemAttribute element "Value"
1492  * @access private
1493  */
1494  private $value;
1495 
1503  public function __construct($type, $value) {
1504  foreach (array('type', 'value') as $arg) {
1505  $this->$arg = $this->validateString($$arg);
1506  }
1507  if (!in_array($type, $this->getAttributeTypes())) {
1508  throw new \Exception('Invalid type: '.$type);
1509  }
1510  }
1511 
1518  public static function build($array) {
1519  if (is_array($array)) {
1520  if (isset($array['Type']) && isset($array['Value'])) {
1521  // Nicely structured associative array
1522  return new self($array['Type'], $array['Value']);
1523  } elseif (count(array_keys($array)) == 1 && parent::isAssociative($array)) {
1524  // Loosely structured associative array (type => value)
1525  foreach ($array as $k => $v) {
1526  return new self($k, $v);
1527  }
1528  }
1529  }
1530  parent::build($array);
1531  }
1532 
1537  public function asDOMDocument() {
1538  $doc = new \DOMDocument();
1539  $root = $doc->appendChild($doc->createElement('ItemAttribute'));
1540  $root->appendChild($doc->createElement('Type'))->appendChild($doc->createTextNode($this->type));
1541  $root->appendChild($doc->createElement('Value'))->appendChild($doc->createTextNode($this->value));
1542  return $doc;
1543  }
1544  }
1545 
1549  class Metric extends ReportBuilder {
1550  /*
1551  * @var int Metric element "PubYr"
1552  * @access private
1553  */
1554  private $pubYr;
1555  /*
1556  * @var int Metric element "PubYrFrom"
1557  * @access private
1558  */
1559  private $pubYrFrom;
1560  /*
1561  * @var int Metric element "PubYrTo"
1562  * @access private
1563  */
1564  private $pubYrTo;
1565  /*
1566  * @var COUNTER\DateRange Metric element "Period"
1567  * @access private
1568  */
1569  private $period;
1570  /*
1571  * @var COUNTER\Category Metric element "Category"
1572  * @access private
1573  */
1574  private $category;
1575  /*
1576  * @var array one or more COUNTER\PerformanceCounter elements
1577  * @access private
1578  */
1579  private $instance;
1580 
1592  public function __construct($period, $category, $instances, $pubYrFrom = NULL, $pubYrTo = NULL, $pubYr = NULL) {
1593  $this->period = $this->validateOneOf($period, 'DateRange');
1594  $this->category = $this->validateString($category);
1595  if (!in_array($category, $this->getCategories())) {
1596  throw new \Exception('Invalid category: '.$category);
1597  }
1598  $this->instance = $this->validateOneOrMoreOf($instances, 'PerformanceCounter');
1599  if ($pubYrFrom) {
1600  $this->pubYrFrom = $this->validatePositiveInteger($pubYrFrom);
1601  }
1602  if ($pubYrTo) {
1603  $this->pubYrTo = $this->validatePositiveInteger($pubYrTo);
1604  }
1605  if ($pubYr) {
1606  $this->pubYr = $this->validatePositiveInteger($pubYr);
1607  }
1608  }
1616  public static function build($array) {
1617  if (is_array($array)) {
1618  if (isset($array['Period']) && isset($array['Instance']) && isset($array['Category'])) {
1619  // Nicely structured associative array
1620  $instances = parent::buildMultiple('COUNTER\PerformanceCounter', $array['Instance']);
1621  return new self(
1622  DateRange::build($array['Period']),
1623  $array['Category'],
1624  $instances,
1625  isset($array['PubYrFrom']) ? $array['PubYrFrom']: NULL,
1626  isset($array['PubYrTo']) ? $array['PubYrTo'] : NULL,
1627  isset($array['PubYr']) ? $array['PubYr'] : NULL
1628  );
1629  }
1630  }
1631  parent::build($array);
1632  }
1633 
1638  public function asDOMDocument() {
1639  $doc = new \DOMDocument();
1640  $root = $doc->appendChild($doc->createElement('ItemPerformance'));
1641  if ($this->period) {
1642  $root->appendChild($doc->importNode($this->period->asDOMDocument()->documentElement, true));
1643  }
1644  if ($this->category) {
1645  $root->appendChild($doc->createElement('Category'))->appendChild($doc->createTextNode($this->category));
1646  }
1647  foreach ($this->instance as $instance) {
1648  $root->appendChild($doc->importNode($instance->asDOMDocument()->documentElement, true));
1649  }
1650  foreach (array('pubYr', 'pubYrFrom', 'pubYrTo') as $pubYrKey) {
1651  if ($this->$pubYrKey) {
1652  $root->appendChild($doc->createElement(ucfirst($pubYrKey)))->appendChild($doc->createTextNode($this->$pubYrKey));
1653  $attr = $doc->createAttribute(ucfirst($pubYrKey));
1654  $attr->value = $this->$pubYrKey;
1655  $root->appendChild($attr);
1656  }
1657  }
1658  return $doc;
1659  }
1660 
1661  }
1662 
1666  class DateRange extends ReportBuilder {
1667  /*
1668  * @var \DateTime DateRange element "Begin"
1669  * @access private
1670  */
1671  private $begin;
1672  /*
1673  * @var \DateTime DateRange element "End"
1674  * @access private
1675  */
1676  private $end;
1677 
1685  public function __construct($begin, $end) {
1686  $this->begin = $this->validateOneOf($begin, '\DateTime');
1687  $this->end = $this->validateOneOf($end, '\DateTime');
1688  }
1689 
1696  public static function build($array) {
1697  if (is_array($array)) {
1698  if (isset($array['Begin']) && isset($array['End'])) {
1699  // Nicely structured associative array
1700  return new self($array['Begin'], $array['End']);
1701  } elseif (count(array_keys($array)) == 2 && !parent::isAssociative($array)) {
1702  // Unstructured array of two elements, assume begin and end dates
1703  return new self($array[0], $array[1]);
1704  }
1705  }
1706  parent::build($array);
1707  }
1708 
1713  public function asDOMDocument() {
1714  $doc = new \DOMDocument();
1715  $root = $doc->appendChild($doc->createElement('Period'));
1716  $root->appendChild($doc->createElement('Begin'))->appendChild($doc->createTextNode(date_format($this->begin, 'Y-m-d')));
1717  $root->appendChild($doc->createElement('End'))->appendChild($doc->createTextNode(date_format($this->end, 'Y-m-d')));
1718  return $doc;
1719  }
1720  }
1721 
1725  class PerformanceCounter extends ReportBuilder {
1726  /*
1727  * @var COUNTER\MetricType PerformanceCounter element "MetricType"
1728  * @access private
1729  */
1730  private $metricType;
1731  /*
1732  * @var int PerformanceCounter element "Count"
1733  * @access private
1734  */
1735  private $count;
1736 
1744  public function __construct($metricType, $count) {
1745  $this->metricType = $this->validateString($metricType);
1746  if (!in_array($metricType, $this->getMetricTypes())) {
1747  throw new \Exception('Invalid metric type: '.$metricType);
1748  }
1749  $this->count = $this->validatePositiveInteger($count);
1750  }
1751 
1758  public static function build($array) {
1759  if (is_array($array)) {
1760  if (isset($array['MetricType']) && isset($array['Count'])) {
1761  // Nicely structured associative array
1762  return new self($array['MetricType'], $array['Count']);
1763  } elseif (count(array_keys($array)) == 1 && parent::isAssociative($array)) {
1764  // Loosely structured associative array (type => count)
1765  foreach ($array as $k => $v) {
1766  return new self($k, $v);
1767  }
1768  }
1769  }
1770  parent::build($array);
1771  }
1777  public function asDOMDocument() {
1778  $doc = new \DOMDocument();
1779  $root = $doc->appendChild($doc->createElement('Instance'));
1780  $root->appendChild($doc->createElement('MetricType'))->appendChild($doc->createTextNode($this->metricType));
1781  $root->appendChild($doc->createElement('Count'))->appendChild($doc->createTextNode($this->count));
1782  return $doc;
1783  }
1784  }
1785 
1786 }
COUNTER\ItemDate\build
static build($array)
Definition: COUNTER.php:1609
COUNTER\Identifier\__construct
__construct($type, $value)
Definition: COUNTER.php:1524
COUNTER\ReportItems\__construct
__construct($itemPlatform, $itemName, $itemDataType, $itemPerformance, $parentItem=NULL, $itemIdentifiers=array(), $itemContributors=array(), $itemDates=array(), $itemAttributes=array(), $itemPublisher='')
Definition: COUNTER.php:1081
COUNTER\ReportBuilder\__toString
__toString()
Definition: COUNTER.php:304
COUNTER\ParentItem\__construct
__construct($itemName, $itemDataType, $itemIdentifiers=array(), $itemContributors=array(), $itemDates=array(), $itemAttributes=array(), $itemPublisher='')
Definition: COUNTER.php:1244
COUNTER\ReportBuilder\validateOneOrMoreOf
validateOneOrMoreOf($objects, $className)
Definition: COUNTER.php:123
COUNTER\Vendor\__construct
__construct($id, $name='', $contacts=array(), $webSiteUrl='', $logoUrl='')
Definition: COUNTER.php:595
COUNTER\ParentItem
Definition: COUNTER.php:1174
COUNTER\Identifier\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1558
COUNTER\Consortium\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:970
COUNTER\ItemAttribute
Definition: COUNTER.php:1640
COUNTER\PerformanceCounter\build
static build($array)
Definition: COUNTER.php:1950
COUNTER\ReportBuilder\COUNTER_NAMESPACE
const COUNTER_NAMESPACE
Definition: COUNTER.php:74
COUNTER\Consortium
Definition: COUNTER.php:910
COUNTER\ItemContributorId\build
static build($array)
Definition: COUNTER.php:1468
COUNTER\ParentItem\build
static build($array)
Definition: COUNTER.php:1263
COUNTER\Reports
Definition: COUNTER.php:334
COUNTER\Contact\__construct
__construct($contact='', $email='')
Definition: COUNTER.php:679
COUNTER\ReportBuilder\validateStrings
validateStrings($array)
Definition: COUNTER.php:197
COUNTER\Customer\build
static build($array)
Definition: COUNTER.php:848
COUNTER\Metric
Definition: COUNTER.php:1711
COUNTER\ReportBuilder\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:315
COUNTER\ReportBuilder\build
static build($array)
Definition: COUNTER.php:325
COUNTER\ItemAttribute\build
static build($array)
Definition: COUNTER.php:1680
COUNTER\Reports\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:397
COUNTER\ItemDate
Definition: COUNTER.php:1570
COUNTER\Identifier
Definition: COUNTER.php:1499
COUNTER\ItemContributorId
Definition: COUNTER.php:1428
COUNTER\Consortium\build
static build($array)
Definition: COUNTER.php:945
COUNTER\Customer\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:874
COUNTER\ReportBuilder\getIdentifierTypes
getIdentifierTypes()
Definition: COUNTER.php:253
COUNTER\ReportBuilder\validateZeroOrMoreOf
validateZeroOrMoreOf($objects, $className)
Definition: COUNTER.php:141
COUNTER\Report\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:523
COUNTER\Reports\build
static build($array)
Definition: COUNTER.php:360
COUNTER\Report\build
static build($array)
Definition: COUNTER.php:500
COUNTER\Metric\__construct
__construct($period, $category, $instances, $pubYrFrom=NULL, $pubYrTo=NULL, $pubYr=NULL)
Definition: COUNTER.php:1772
COUNTER\Vendor
Definition: COUNTER.php:543
COUNTER\Metric\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1818
COUNTER\Identifier\build
static build($array)
Definition: COUNTER.php:1539
COUNTER\ReportBuilder\getDateTypes
getDateTypes()
Definition: COUNTER.php:270
COUNTER\ItemContributor
Definition: COUNTER.php:1324
COUNTER\ItemDate\__construct
__construct($type, $value)
Definition: COUNTER.php:1595
COUNTER\ReportBuilder\getCategories
getCategories()
Definition: COUNTER.php:295
COUNTER\ReportBuilder\buildMultiple
buildMultiple($classname, $array)
Definition: COUNTER.php:226
COUNTER\DateRange\__construct
__construct($begin, $end)
Definition: COUNTER.php:1871
COUNTER\ItemContributorId\__construct
__construct($type, $value)
Definition: COUNTER.php:1453
COUNTER\ItemAttribute\__construct
__construct($type, $value)
Definition: COUNTER.php:1665
COUNTER\ReportBuilder\getItemDataTypes
getItemDataTypes()
Definition: COUNTER.php:245
COUNTER\ReportBuilder\validateOneOf
validateOneOf($object, $className)
Definition: COUNTER.php:83
COUNTER\Report\__construct
__construct($id, $version, $name, $title, $customers, $vendor, $created='')
Definition: COUNTER.php:483
COUNTER\Vendor\build
static build($array)
Definition: COUNTER.php:608
COUNTER\Customer
Definition: COUNTER.php:753
COUNTER\Contact\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:737
COUNTER\Consortium\__construct
__construct($wellKnownName, $code='')
Definition: COUNTER.php:933
COUNTER\DateRange
Definition: COUNTER.php:1846
COUNTER\ReportItems\build
static build($array)
Definition: COUNTER.php:1102
Seboettg\Collection\count
count()
Definition: ArrayListTrait.php:253
COUNTER\ReportBuilder\getAttributeTypes
getAttributeTypes()
Definition: COUNTER.php:279
COUNTER\ItemContributor\__construct
__construct($itemContributorIds=array(), $itemContributorName='', $itemContributorAffiliations=array(), $itemContributorRoles=array())
Definition: COUNTER.php:1367
COUNTER\ItemAttribute\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1699
COUNTER\Reports\addReport
addReport($report)
Definition: COUNTER.php:381
COUNTER\ReportItems
Definition: COUNTER.php:984
COUNTER\DateRange\build
static build($array)
Definition: COUNTER.php:1882
COUNTER\ReportBuilder\getMetricTypes
getMetricTypes()
Definition: COUNTER.php:287
COUNTER\ItemContributor\build
static build($array)
Definition: COUNTER.php:1380
COUNTER\ParentItem\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1289
COUNTER\ReportBuilder\getContributorIdentifierTypes
getContributorIdentifierTypes()
Definition: COUNTER.php:261
COUNTER\Customer\__construct
__construct($id, $reportItems, $name='', $contacts=array(), $webSiteUrl='', $logoUrl='', $consortium=NULL, $institutionalIdentifier=array())
Definition: COUNTER.php:832
COUNTER\PerformanceCounter
Definition: COUNTER.php:1911
COUNTER\DateRange\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1899
COUNTER\PerformanceCounter\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1969
COUNTER\ReportBuilder\validateZeroOrOneOf
validateZeroOrOneOf($object, $className)
Definition: COUNTER.php:156
COUNTER
Definition: COUNTER.php:20
COUNTER\ReportBuilder\isAssociative
static isAssociative($array)
Definition: COUNTER.php:215
COUNTER\ReportBuilder\validatePositiveInteger
validatePositiveInteger($int)
Definition: COUNTER.php:170
COUNTER\Contact
Definition: COUNTER.php:654
COUNTER\Reports\getReports
getReports()
Definition: COUNTER.php:389
COUNTER\ReportBuilder\validateString
validateString($string)
Definition: COUNTER.php:184
COUNTER\ItemDate\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1628
COUNTER\Reports\__construct
__construct($reports)
Definition: COUNTER.php:350
COUNTER\ReportItems\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1132
COUNTER\ItemContributorId\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1487
COUNTER\Metric\build
static build($array)
Definition: COUNTER.php:1796
COUNTER\ItemContributor\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:1400
COUNTER\Contact\build
static build($array)
Definition: COUNTER.php:691
COUNTER\Report
Definition: COUNTER.php:413
COUNTER\ReportBuilder
Definition: COUNTER.php:72
COUNTER\Vendor\asDOMDocument
asDOMDocument()
Definition: COUNTER.php:629
COUNTER\PerformanceCounter\__construct
__construct($metricType, $count)
Definition: COUNTER.php:1936