52 lines
		
	
	
		
			970 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			970 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace ManiaControl\Callbacks\Structures;
 | |
| 
 | |
| use ManiaControl\ManiaControl;
 | |
| use ManiaControl\Players\Player;
 | |
| 
 | |
| class CaptureStructure {
 | |
| 	/*
 | |
| 	 * Private properties
 | |
| 	 */
 | |
| 	private $playerArray;
 | |
| 	/** @var ManiaControl $maniaControl */
 | |
| 	private $maniaControl;
 | |
| 
 | |
| 	/**
 | |
| 	 * Construct a new Capture Structure
 | |
| 	 *
 | |
| 	 * @param ManiaControl $maniaControl
 | |
| 	 * @param array        $data
 | |
| 	 */
 | |
| 	public function __construct(ManiaControl $maniaControl, array $data) {
 | |
| 		$this->maniaControl = $maniaControl;
 | |
| 		$this->playerArray  = $data;
 | |
| 	}
 | |
| 
 | |
| 	/**
 | |
| 	 * Get the logins
 | |
| 	 *
 | |
| 	 * @return array
 | |
| 	 */
 | |
| 	public function getLoginArray() {
 | |
| 		return $this->playerArray;
 | |
| 	}
 | |
| 
 | |
| 	/**
 | |
| 	 * Get the players
 | |
| 	 *
 | |
| 	 * @return Player[]
 | |
| 	 */
 | |
| 	public function getPlayerArray() {
 | |
| 		$playerArray = array();
 | |
| 		foreach ($this->playerArray as $login) {
 | |
| 			$player = $this->maniaControl->getPlayerManager()->getPlayer($login);
 | |
| 			if($player){
 | |
| 				$playerArray[$login] = $player;
 | |
| 			}
 | |
| 		}
 | |
| 		return $playerArray;
 | |
| 	}
 | |
| }
 |