| 
									
										
										
										
											2021-09-14 17:15:37 +01:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Plugin\ActivityStreamsTwo\Util\Response; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-18 03:22:27 +01:00
										 |  |  | use App\Entity\Actor; | 
					
						
							| 
									
										
										
										
											2021-09-14 17:15:37 +01:00
										 |  |  | use Exception; | 
					
						
							|  |  |  | use Plugin\ActivityStreamsTwo\Util\Model\EntityToType\GSActorToType; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | abstract class ActorResponse | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2021-09-18 03:22:27 +01:00
										 |  |  |      * @param Actor $gsactor | 
					
						
							|  |  |  |      * @param int   $status  The response status code | 
					
						
							| 
									
										
										
										
											2021-09-14 17:15:37 +01:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2021-09-18 03:22:27 +01:00
										 |  |  |      *@throws Exception | 
					
						
							| 
									
										
										
										
											2021-09-14 17:15:37 +01:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @return TypeResponse | 
					
						
							| 
									
										
										
										
											2021-09-18 03:22:27 +01:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2021-09-14 17:15:37 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2021-09-18 03:22:27 +01:00
										 |  |  |     public static function handle(Actor $gsactor, int $status = 200): TypeResponse | 
					
						
							| 
									
										
										
										
											2021-09-14 17:15:37 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         $gsactor->getLocalUser(); // This throws exception if not a local user, which is intended
 | 
					
						
							|  |  |  |         return new TypeResponse(data: GSActorToType::translate($gsactor), status: $status); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |