src/Maths/Algebra/Matrix.php
public function set($index, $value)
    {
        try {
            if (is_string($index)) {
                if ($this->getWalkFlag() & self::WALK_X) {
                    $this->setX($index, $value);
                } elseif ($this->getWalkFlag() & self::WALK_Y) {
                    $this->setY($index, $value);
                } else {
                    $this->setXY($index, $value);
                }
            } else {
                $this->setInt($index, $value);
            }
        } catch (InvalidArgumentException $e) {
            throw $e;
        } catch (OutOfRangeException $e) {
            throw $e;
        }
        return $this;
    }
public function set($index, $value)
    {
        try {
            if (is_string($index)) {
                if ($this->getWalkFlag() & self::WALK_X) {
                    $this->setX($index, $value);
                } elseif ($this->getWalkFlag() & self::WALK_Y) {
                    $this->setY($index, $value);
                } else {
                    $this->setXY($index, $value);
                }
            } else {
                $this->setInt($index, $value);
            }
        } catch (InvalidArgumentException $e) {
            throw $e;
        } catch (OutOfRangeException $e) {
            throw $e;
        }
        return $this;
    }
Set a value by index according to matrix's flags

@param   string|int   $index
@param   mixed        $value
@return  $this
@throws  OutOfRangeException if the index is out of range
@throws  InvalidArgumentException if the argument is malformed
@see     self::setX()
@see     self::setY()
@see     self::setXY()
@see     self::setInt()