public function parseRandom($regionId = self::REGION_EUW, OutputInterface $output = null)
    {
        $hasOutput = null != $output;
        if ($hasOutput) {
            $output->write("Parsing homepage...\t\t\t");
        }

        $buzz = new Browser();
        $response = $buzz->get('http://www.lolnexus.com/recent-games?filter-region=' . $regionId . '&filter-sort=1');

        if (!preg_match('/<a class="green-button scouter-button" href="\/' . self::$serverNames[$regionId - 1] . '\/search\?name=(.*)">Live Game<\/a>/', $response->getContent(), $matches)) {
            throw new \RuntimeException('Cannot parse LoL Nexus website, maybe down ?');
        }

        if ($hasOutput) {
            $output->writeln('<info>OK</info>');
        }

        $this->parsePlayer($regionId, $matches[1], $output, $buzz);
    }
public function parseRandom($regionId = self::REGION_EUW, OutputInterface $output = null)
    {
        $hasOutput = null != $output;
        if ($hasOutput) {
            $output->write("Parsing homepage...\t\t\t");
        }

        $buzz = new Browser();
        $response = $buzz->get('http://www.lolnexus.com/recent-games?filter-region=' . $regionId . '&filter-sort=1');

        if (!preg_match('/<a class="green-button scouter-button" href="\/' . self::$serverNames[$regionId - 1] . '\/search\?name=(.*)">Live Game<\/a>/', $response->getContent(), $matches)) {
            throw new \RuntimeException('Cannot parse LoL Nexus website, maybe down ?');
        }

        if ($hasOutput) {
            $output->writeln('<info>OK</info>');
        }

        $this->parsePlayer($regionId, $matches[1], $output, $buzz);
    }
public function parseRandom ( $ regionId = self :: REGION_EUW , OutputInterface $ output = null ) { $ hasOutput = null != $ output ; if ( $ hasOutput ) { $ output -> write ( "Parsing homepage...\t\t\t" ) ; } $ buzz = new Browser ( ) ; $ response = $ buzz -> get ( 'http://www.lolnexus.com/recent-games?filter-region=' . $ regionId . '&filter-sort=1' ) ; if ( ! preg_match ( '/<a class="green-button scouter-button" href="\/' . self :: $ serverNames [ $ regionId - 1 ] . '\/search\?name=(.*)">Live Game<\/a>/' , $ response -> getContent ( ) , $ matches ) ) { throw new \ RuntimeException ( 'Cannot parse LoL Nexus website, maybe down ?' ) ; } if ( $ hasOutput ) { $ output -> writeln ( '<info>OK</info>' ) ; } $ this -> parsePlayer ( $ regionId , $ matches [ 1 ] , $ output , $ buzz ) ; }
Select the first player in the recent games list for a selected region

@param int             $regionId
@param OutputInterface $output
Select the first player in the recent games list for a selected region