| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * @copyright Copyright (c) 2018 Robin Appelman <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @license GNU AGPL version 3 or any later version | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * This program is free software: you can redistribute it and/or modify | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * it under the terms of the GNU Affero General Public License as | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * published by the Free Software Foundation, either version 3 of the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * License, or (at your option) any later version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * This program is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * GNU Affero General Public License for more details. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * You should have received a copy of the GNU Affero General Public License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | namespace Icewind\SMB; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | abstract class AbstractServer implements IServer { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 	const LOCALE = 'en_US.UTF-8'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	/** @var string */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 	protected $host; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	/** @var IAuth */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	protected $auth; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	/** @var ISystem */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 	protected $system; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	/** @var ITimeZoneProvider */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	protected $timezoneProvider; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	/** @var IOptions */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	protected $options; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	 * @param string $host | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	 * @param IAuth $auth | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	 * @param ISystem $system | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 	 * @param ITimeZoneProvider $timeZoneProvider | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	 * @param IOptions $options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 	public function __construct(string $host, IAuth $auth, ISystem $system, ITimeZoneProvider $timeZoneProvider, IOptions $options) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 		$this->host = $host; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		$this->auth = $auth; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 		$this->system = $system; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 		$this->timezoneProvider = $timeZoneProvider; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 		$this->options = $options; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 992 |  | 	public function getAuth(): IAuth { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 | 992 |  | 		return $this->auth; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 992 |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 | 992 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 | 992 |  | 	public function getHost(): string { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 | 992 |  | 		return $this->host; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 992 |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 65 | 988 |  | 	public function getTimeZone(): string { | 
            
                                                                        
                            
            
                                    
            
            
                | 66 | 988 |  | 		return $this->timezoneProvider->get($this->host); | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 988 |  | 	public function getSystem(): ISystem { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 988 |  | 		return $this->system; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 | 488 |  | 	public function getOptions(): IOptions { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 | 488 |  | 		return $this->options; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 76 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 77 |  |  |  |