LoginSignup
40
14

More than 5 years have passed since last update.

わーい、すごーい

Last updated at Posted at 2017-02-10

なんか気付いたら書いていたので、ここに供養します。

<?php
class Friends
{
    private $message = null;
    public function __construct()
    {
        $this->message = '';
    }

    public function wai()
    {
        $this->message .= "わーい\n";
        return $this;
    }

    public function sugoi()
    {
        $this->message .= "すごーい\n";
        return $this;
    }

    public function tanoshii()
    {
        $this->message .= "たのしー\n";
        return $this;
    }

    public function friends($skill)
    {
        $this->message .= '君は' . $skill . 'がとくいな、フレンズなんだね!!' . "\n";
        return $this;

    }

    public function __toString()
    {
        $message = $this->message;
        $this->message = '';
        return $message;
    }
}

echo (new Friends())
    ->wai()
    ->sugoi()
    ->tanoshii()
    ->friends('クソリプ');
40
14
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
40
14