Skip to content

Instantly share code, notes, and snippets.

@ArtemioVegas
Last active July 29, 2017 10:14
Show Gist options
  • Save ArtemioVegas/d10baf49444729fa1d41f4e89ffc0a1d to your computer and use it in GitHub Desktop.
Save ArtemioVegas/d10baf49444729fa1d41f4e89ffc0a1d to your computer and use it in GitHub Desktop.
Задачи на ООП в PHP. Часть 1_1
<?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