<?php $qb = new QuickBibleCli(); $qb->getLastOptions(); $qb->parseCli(); if ($qb->getQuery() == "") { $qb->simpleParseCli(); } $qb->putOptions(); try { $qb->validateBible(); } catch (Exception $e) { echo $e->getMessage(); exit; } $qb->determinePath(); class QuickBibleCli { protected $base_dir; protected $bible; protected $options = array('q' => ''); protected $bible_path = ''; protected $cfg_file = ''; public function getQuery() { if (!isset($this->options['q'])) { $this->options['q'] = ''; } return $this->options['q']; } public function __construct()
<?php /** * For example php qb.php nkjv love * */ $qb = new QuickBibleCli(); if (!$qb->parseCli()) { $qb->simpleParseCli(); } $qb->validateBible(); $qb->searchBible(); //scroll down for class class QuickBibleCli { protected $base_dir; protected $bible; protected $options = array(); protected $bible_path = ''; public function __construct() { //defaults $this->base_dir = "C:\\Program Files (x86)\\QuickBible\\Bibles"; $this->bible = 'kjvr'; } public function simpleParseCli() { global $argv; //qb <bible> <search-query> if (isset($argv[1])) { $this->bible = $argv[1];