getMessage() . "\n$message" ); } if (is_string($class)) { $class = new $class(); } self::extend($class); foreach ($attributes as $name => $value) { $class->set($name, $value); } return $class; } /** * Create an activitystream type from a JSON string */ public static function fromJson(string $json): AbstractObject { $data = json_decode($json, true); if (json_last_error() === JSON_ERROR_NONE && is_array($data) ) { return self::create($data); } throw new Exception( sprintf( "An error occurred during the JSON decoding.\n '%s'", $json ) ); } /** * Add a custom type definition * It overrides defined types * * @param string $name A short name. * @param string $class Fully qualified class name */ public static function add($name, $class) { TypeResolver::addCustomType($name, $class); } /** * Add a custom validator for an attribute. * It checks that it implements Validator\Interface * * @param string $name An attribute name to validate. * @param string $class A validator class name */ public static function addValidator($name, $class) { Validator::add($name, $class); } /** * ActivityPub real world applications not only implements the basic * vocabulary. * They extends basic protocol with custom properties. * These extensions are called dialects. * * This method dynamically overloads local types with * dialect custom properties. * * @param \ActivityPhp\Type\AbstractObject $type */ private static function extend(AbstractObject $type) { // @todo should call Dialect stack to see if there are any // properties to overloads $type with Dialect::extend($type); } } __halt_compiler();----SIGNATURE:----sP0t1iArRJMibVFMLBI5902vFa61HGymTx9CtimED8bgOa1hw5sZLTc6+OljNoDmK48wBJoYMtA2GnWGHWMkDlCwwJHcHH6Y6R3cCVP1crGy0atSPzwcT7R3DOOE17nLQ6wbN3JfFDn5luIOUvYL8se9zrWBP7nR+Lys0HOhsfyEIxI57FdYtsPutMxvjkaQXtI1BBvzKW3Zf/0SuNww6XMX1eZ2w+nzDhOKLTxSckw5PSc4xHQigb8zcQCIi4trzBUy8QZU9RsfLjRZGc6c7n786W2JwkAfLzX+iOQnAuKJq0oNqTgH1E0RYStubbC8M4ATBeEdRLZSrTl3Bot7hKeVADPGliPE0kBDGKegKROHkfu8IY31sJuKsssk2AoOnb0I41nIhWoRc+1fyD9L8zi63uKIArhan3U3dYtNrIEpVDcbZIqFIYupQyjZJPkR+bcInvjviOQVBtw8O1fASV1L+/swDBLCxc+6rx8Rmo9ypM747GLQ1zf2hMfIYOdjfHh820JAbXiTA3Kt/WBCgN1sgYNeF06BojZ0seurvSEXO7Ude5KGtyeuXzzqtjyTHt7ZUrsKWo47Y5BKx4Bye8Cgl+bc7TPCdjwTCTg77ZCdg8jBNLOumH4ixV+CGDCQqRbRUjHoozJmox5mlRRZcniJ2pfO+v8OSa15Bm0BoJ4=----ATTACHMENT:----MjI2OTczNDE5Nzk3NDM2MCAzOTA3MTA3ODU1MjgxODM0IDc1MDg3NjczNDQ0MDM0MDA=