/** * Test total word count from text reader. * * @return void */ public function testWordCount() { $reader = new BuzzwordReader(); $reader->readTextContent("win-win, synergy, agile, test some more"); $wordCount = $reader->getTotalWordCount(); $this->assertEquals(6, $wordCount); }
// Default state. if ($options['file']) { $file = $options['file']; } $buzzwords = $buzzwordReader->readFileContent($file); } elseif (isset($options['url'])) { $url = "https://nerdery.com"; // Default state. if ($options['url']) { $url = $options['url']; } $buzzwords = $buzzwordReader->readUrlContent($url); } else { $buzzwordText = (string) isset($argv[1]) ? $argv[1] : false; if ($buzzwordText) { $buzzwords = $buzzwordReader->readTextContent($buzzwordText); } } $help = (bool) isset($options['h']) ? true : false; if ($help || count($buzzwords) < 1) { echo <<<HELP Usage: \$ php buzzwords.php <text> \$ php buzzwords.php --file[=<file>] \$ php buzzwords.php --url[=<url>] -h Help --file=<file> Parse file as having a box dimension on each line --url=<url> Parse file as having a box dimension on each line