i try set many the same methods. The parameter is dependent of array element. If case: 1 - show '1' number, if case: 2 - show '2' number. I presents code:
<?php
    error_reporting(E_ALL); 
    ini_set('display_errors', 1);
    class Test {
        protected $target = array('1' ,'2');
        private $message;
        public function setTarget($target) {
            return $this->target = $target;
        }
        public function getTarget() {
            return $this;
        }   
        public function getMessage() {
            return $this->message;
        }
        public function set($target) {
            switch($target) {
                case '1':
                    $this->message = $this->setTarget($this->target[0]);
                break;
                case '2':
                    $this->message = $this->setTarget($this->target[1]);
                break;
            } 
            return 
                $this->message; $this->target;
        }
    }
    $foo = new Test;
    echo $foo->set(1);
    echo $foo->set(2);
    echo $foo->set(1);
    echo $foo->set(1);
    echo $foo->set(2);
    echo $foo->set(1);
The notice:
1 Notice: Uninitialized string offset: 1 in /opt/lampp/htdocs/oop/test/test.php on line 25
Notice: Uninitialized string offset: 0 in /opt/lampp/htdocs/oop/test/test.php on line 22
Notice: Uninitialized string offset: 0 in /opt/lampp/htdocs/oop/test/test.php on line 22
Notice: Uninitialized string offset: 1 in /opt/lampp/htdocs/oop/test/test.php on line 25
Notice: Uninitialized string offset: 0 in /opt/lampp/htdocs/oop/test/test.php on line 22
How fix this problem?
 
    