public function occurrences(string $needle): array
    {
        $offset = 0;
        $allPositions = [];

        while (($position = strpos($this->string, $needle, $offset)) !== false) {
            $offset = $position + 1;
            $allPositions[] = $position;
        }

        return $allPositions;
    }