2015-02-27 17:22:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
2015-09-09 15:32:37 +00:00
|
|
|
class WellProtectedParentClass {
|
|
|
|
|
private $privateParentProperty;
|
|
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
|
$this->privateParentProperty = 9000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function incrementPrivateParentPropertyValue() {
|
|
|
|
|
$this->privateParentProperty++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getPrivateParentProperty() {
|
|
|
|
|
return $this->privateParentProperty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class WellProtectedClass extends WellProtectedParentClass {
|
2015-02-27 17:22:16 +00:00
|
|
|
protected $property;
|
2015-09-09 15:32:37 +00:00
|
|
|
private $privateProperty;
|
2015-02-27 17:22:16 +00:00
|
|
|
|
|
|
|
|
public function __construct() {
|
2015-09-09 15:32:37 +00:00
|
|
|
parent::__construct();
|
2015-02-27 17:22:16 +00:00
|
|
|
$this->property = 1;
|
2015-09-09 15:32:37 +00:00
|
|
|
$this->privateProperty = 42;
|
2015-02-27 17:22:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function incrementPropertyValue() {
|
|
|
|
|
$this->property++;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-09 15:32:37 +00:00
|
|
|
private function incrementPrivatePropertyValue() {
|
|
|
|
|
$this->privateProperty++;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-27 17:22:16 +00:00
|
|
|
public function getProperty() {
|
|
|
|
|
return $this->property;
|
|
|
|
|
}
|
2015-03-26 08:57:33 +00:00
|
|
|
|
2015-09-09 15:32:37 +00:00
|
|
|
public function getPrivateProperty() {
|
|
|
|
|
return $this->privateProperty;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-26 08:57:33 +00:00
|
|
|
protected function whatSecondArg( $a, $b = false ) {
|
|
|
|
|
return $b;
|
|
|
|
|
}
|
2015-02-27 17:22:16 +00:00
|
|
|
}
|