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:----kvFW5LS3EbfpbgoA+VVqcLbQqPBZ1vQuI68gwNyl+jbE8kM6StShXfoNrP07U2nUBfIDhuGv6aVc/RyxQH7yVzp5GYjChavoBjtlzQ8ohsPu7BZ37g057QJTv67TEvQuUmpZSVRCdR8tll497svJ24eQUForIllNym4+SpCoTU55qCj3ZOmEdPnpU6Aqq8XObIfPs9Di7Phb0xEbM/fHbfpJimqKLdDMBy7mY8LQBQSNKl1QTQMF8Oa2vuBtifpL0hGnkflsFwDlqMjgv1DhOoGb5GXsJSt0mMn2FKNHbsAI6yIgM+788Y2ygKhbUA8sUs3isGHkP4gNM2/EAZ4ur4OFSA9v4qsqeWyddOZFEA26OsOE9hqcYK81CUoi0wa6gBpbj3jfWW9kJagSW/YHtdPkTJM4mCO9ZgyawhNogijWOg3l3mt84tym92ybKYSKNccwxSmzj/cj0fP2J1iY9/yM4QatJu0dQfCdjYVTKbOxpNUfH4Npjqa67hQNGHuwQay5FDLwfPEFEfbBLMuHGzM4eeKvXrv/xcymhlmWD7p2CHac3cmGFDaTurcsBHACqlIidY85A3m7eeJgBfvP3bmpGyzkhGPTLOODQ4bvIIhPKFKWbCg+xYw3DCLeYbYj5pZAuLojEIK1bE2on+vheOWSaayM6Cq3TnuRM3javXE=----ATTACHMENT:----NDI4MTk4OTc4MDMzODk2IDkyMDQwMzQ3MzkzNTc3NzYgMTQ5ODE3NTQxMjAzNjMxMQ==