You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
829 B

<?php
namespace OSM\Element\Member;
class Member {
public int $ref;
public string $role;
public static function createFromArray($array) {
assert(is_array($array));
$hasType = isset($array['type']);
assert($hasType);
$className = __NAMESPACE__.'\\'.ucfirst($array['type']);
$hasClass = class_exists($className);
$instance = new $className();
$hasRef = isset($array['ref']);
assert($hasRef);
$instance->ref = (int) $array['ref'];
$hasRole = isset($array['role']);
assert($hasRole);
$instance->role = (string) $array['role'];
$instance->completeFromArray($array);
return $instance;
}
public function isSame(Member $other): bool {
return ($this->ref === $other->ref);
}
}