You are here

abstract class MatchObject in Bibliography Module 7.2

MatchObject Abstract Class

Hierarchy

Expanded class hierarchy of MatchObject

1 file declares its use of MatchObject
ContributorObject.php in lib/msrc-authortool/src/Analyzer/ContributorObject.php

File

lib/msrc-authortool/src/Nametools/MatchObject.php, line 14

Namespace

Nametools
View source
abstract class MatchObject {

  // --------------------------------------------------------------

  /**
   * Factory method
   *
   * @return MatchObject
   */
  public static function factory() {
    $classname = get_called_class();
    return new $classname();
  }

  // --------------------------------------------------------------

  /**
   * Set magic method prevents setting undefined variables
   *
   * @param string $item
   * @param string $value
   */
  public function __set($item, $val) {
    if (!in_array($item, array_keys(get_object_vars($this)))) {
      throw new \InvalidArgumentException("Undefined Property: {$item}");
    }
  }

  // --------------------------------------------------------------

  /**
   * To string magic method
   *
   * @return string
   */
  public function __toString() {
    return json_encode(get_object_vars($this));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MatchObject::factory public static function Factory method
MatchObject::__set public function Set magic method prevents setting undefined variables
MatchObject::__toString public function To string magic method