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:----M+95EZsTWxjokuu5Vm5OyHejC0S+atieNSalRpX7vQFSCLlKrNMG1RSz2JRtIvyP2Mq7qx4+mMi3RrH5Wuv141dquFKeTsrUma9w86gDOAoB+i3Unr3HCsh1fxBP6eVtVhzf84LR2SzA769S1HDgtCUxcn5LR1cYP6VFvOYKzPhCpx98S3M2bh/RA+sJKI9lZoH3OQQcqzRncxHKeKzAxZ+IFu43fFdJvGKBR6Uag0mLvx442DZmasIAsnL+falgfgrSgl/Ug3agH6rY/gilsAF83cLDOoFDgm7U9fGQB9pla9MKMfbWxzMjQcezraFsEOP+ng0SpCzbpR/ZVvL66ywNQYAr5CXf2tZVYv6Sos93bJBPik7x0eBT4hB5Mkm9pRbXd2PC5UNbsVUGhoaDcD9w/kSfkfXpufn4dhZ5vxCJcfMxIxT3VH/11tH4PLnWUhMdSX4yp934B9l9NdG9VHY2exxK15Ubl1j7sC2mAjVJ1xKtQdEtXrOnxm7sLHl7jMWTrQyCmK5qZWA8J3CIErAzG9R2uN2YFqHLyBea9Z5DuCIZX/MyvgetLb8KCJreSnDjE65c1oP2yECJoIIKTVivVfYYkm8pJkdVQymbmudFJYEEt9Kr0M/RC+sRU0D71s61ZPD4V8V7r6jQQYd6fYSidep1ydnA5pBFVtqOjqU=----ATTACHMENT:----NjI3Njc4Mzg1NzU1MzE1OSA2ODg4NjMwNjUyNjg5OTQxIDg4ODkyMTI2Mzc2OTM0MjE=