34 lines
679 B
PHP
34 lines
679 B
PHP
<?php
|
|
|
|
class SportObject
|
|
{
|
|
public $name;
|
|
public $height;
|
|
public $avoirdupois;
|
|
|
|
/**
|
|
* @param $name
|
|
* @param $height
|
|
* @param $avoirdupois
|
|
*/
|
|
public function __construct($name, $height, $avoirdupois)
|
|
{
|
|
$this->name = $name;
|
|
$this->height = $height;
|
|
$this->avoirdupois = $avoirdupois;
|
|
}
|
|
|
|
public function bootFootBall(): string
|
|
{
|
|
if ($this->height < 185 and $this->avoirdupois < 85) {
|
|
return $this->name . '符合要求';
|
|
} else {
|
|
return $this->name . '不符合要求';
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
$sport = new SportObject('明日', 185,80);
|
|
echo $sport->bootFootBall();
|