Last active
July 29, 2017 10:14
-
-
Save ArtemioVegas/d10baf49444729fa1d41f4e89ffc0a1d to your computer and use it in GitHub Desktop.
Задачи на ООП в PHP. Часть 1_1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Worker{ | |
private $name; | |
private $age; | |
private $salary; | |
public __construct() | |
{ | |
$this->name = $name; | |
$this->age = $age; | |
$this->salary = $salary; | |
} | |
public function getName($name,$age,$salary) | |
{ | |
return $this->name; | |
} | |
public function setName($name) | |
{ | |
$this->name = $name; | |
} | |
public function getAge() | |
{ | |
return $this->age; | |
} | |
public function setAge($age) | |
{ | |
if($this->checkAge($age)){ | |
$this->age = $age; | |
} | |
} | |
public function getSalary() | |
{ | |
return $this->salary; | |
} | |
public function setSalary($salary) | |
{ | |
$this->salary = $salary; | |
} | |
private function checkAge($age) | |
{ | |
return in_array($age, range(1, 100)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment