mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Created SurveyChoice object
This commit is contained in:
		
							
								
								
									
										40
									
								
								classes/models/SurveyChoice.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								classes/models/SurveyChoice.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * Survey choice model
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
class SurveyChoice extends BaseUniqueObject {
 | 
			
		||||
 | 
			
		||||
	//Private fields
 | 
			
		||||
	private $name;
 | 
			
		||||
	private $responses;
 | 
			
		||||
 | 
			
		||||
	//Set and get name
 | 
			
		||||
	public function set_name(string $name){
 | 
			
		||||
		$this->name = $name == "" ? null : $name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function has_name() : bool {
 | 
			
		||||
		return $this->name != null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function get_name() : string {
 | 
			
		||||
		return $this->name != null ? $this->name : "null";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//Set and get the number of responses
 | 
			
		||||
	public function set_responses(int $responses){
 | 
			
		||||
		$this->responses = $responses;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function has_responses() : bool {
 | 
			
		||||
		return $this->responses > 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function get_responses() : int {
 | 
			
		||||
		return $this->responses;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user