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:----hyk+XxLkCGfz8ug26pGZNwpul192vUb+/Co0iI9r/VYSz+abSsb646WamzszbbuNKApVGH9obhGzvbUthvxiMhn3xuRVpohEvPOmB/x0VzETG8metXeOORFqm4rMzN6KxHpf9Ljhj3bn1+LY5E2BZeTe8SCH6D3XmP/Q0NqzLW2Pt2V98M9yUtM21McU7lZLDAV8d+Qlg4840NZpN0Swepur3rLuHdST3hGLhqqfDSUcz5TzLkzIpGaHb8qhHPA8nGhj584pmfXi+g/ON2aw7bRIlcX61gdNxADJn16iyRigFGpVRcthtUGA7BVGrsgX0GvBVFKqR5ZNmh0RSVK8Tsv7bLMvbwnPjlhsYWvMvlGTIghcBsEqSc0RieqPYA8qx2MXctV4YnSFl2DN4mmSZINt4GW6+wLdVxgqZgUkIQCZDUc/3NHnKKltMGlPy/F9FvTsLQUXsFPj9gl7uqiKrY8HQWxkdkf2xJ67h6JFCQTRDC53++Ck8xIYePB1aMWGQwK348NnXPCamIdnIPmT+ZvrquiPUotflHC7wOiKZ61D+vtAqDGHrG+Q7rF1U/v16/6PFmiYT1SOA/7nbjdTmxvjKEQNHqRfkJ8I5TnBUZnC2bO3+yxcjD7xUe19e0cUeEnvQEr1ZGn9SqqNC0AXICuxyaJO9JYYgJpIfQODg/Y=----ATTACHMENT:----NjMxODQ3ODkzNjI0Mzc4MyA0MzE5OTIwMjgyMDIwODY3IDM2ODczOTYxNjA2NzA4ODE=