| 
					
				 | 
			
			
				@@ -13,14 +13,18 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class Mattermost 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     protected $url; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected $token; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected $channelId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     protected $router; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * Mattermost Manager 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public function __construct($url, UrlGeneratorInterface $router) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function __construct($url, $token, $channelId, UrlGeneratorInterface $router) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $this->url = $url; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $this->url = $url . "/api/v4/posts"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $this->token = $token; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $this->channelId = $channelId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $this->router = $router; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -32,8 +36,8 @@ class Mattermost 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // fixe l'URL et les autres options appropriées 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $options = array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             CURLOPT_URL => $this->url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            CURLOPT_HTTPHEADER => array('Content-Type:', 'application/json'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            CURLOPT_POSTFIELDS  =>  '{"text": "' . $message . '"}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CURLOPT_HTTPHEADER => array('Content-Type: application/json', 'Authorization: Bearer ' . $this->token), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CURLOPT_POSTFIELDS  =>  '{"channel_id": "' . $this->channelId . '", "message": "' . $message . '"}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         curl_setopt_array($ch, $options); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -41,6 +45,9 @@ class Mattermost 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // attrape l'URL et la passe au navigateur 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         curl_exec($ch); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dump($ch); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dump($options); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // ferme la ressource cURL et libère les ressources systèmes 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         curl_close($ch); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |