@throws Exception

@return string
553155
public function render()
    {
        foreach ($this->data as $key => $var_data) {
            $$key = $var_data;
        }

        ob_start();

        $app_template_file = CORDILLERA_APP_DIR.$this->_template.'.php';
        $cordillera_template_file = CORDILLERA_DIR.$this->_template.'.php';

        if (is_file($app_template_file)) {
            require_once $app_template_file;
        } elseif (!is_file($app_template_file) && is_file($cordillera_template_file)) {
            require_once $cordillera_template_file;
        } else {
            throw new Exception(
                translate('The view %s not found', [$this->_template]),
                500,
                Exception::VIEW
            );
        }

        $this->_output = ob_get_contents();

        ob_end_clean();

        if ($this->layout && !app()->request->isAjax() && !app()->controller->is_rest && app()->controller->response_type != 'json') {
            $this->_output = $this->layout->render($this->_output);
        }

        return $this->_output;
    }
222438
protected function getAdapter()
    {
        $type = strtolower($this->options['type']);
        if (!$this->adapter) {
            if ($this->options['class']) {
                $adapterClass = $this->options['class'];
            } else {
                $adapterClass = '\\Wslim\\Security\\Crypt\\' . ucfirst($type) . 'Adapter';
            }
            
            if (!class_exists($adapterClass)) {
                throw new Exception('crypt type is not exists: ' . $type . ' .');
            }
            $this->adapter = new $adapterClass();
        }
        return $this->adapter;
    }
44643
public function __getKey()
    {
        $rule = ModelManager::getKeyRule($this);
        $result = $rule->rule;
        foreach($rule->paramNames as $paramName)
        {
            if(!isset($this[$paramName]))
            {
                throw new \Exception(sprintf('__getKey param %s does not exists', $paramName));
            }
            $result = str_replace('{' . $paramName . '}', $this[$paramName], $result);
        }
        return $result;
    }
430504
public function parse() {
		$fp = fopen($this->file, "r");
		if (!$fp) {
			throw new Exception("Could not open XML input file");
		}

		$data = fread($fp, 4096);
		while ($data) {
			if (!xml_parse($this->xmlParser, $data, feof($fp))) {
				$errorString = xml_error_string(xml_get_error_code($this->xmlParser));
				$errorLineNo = xml_get_current_line_number($this->xmlParser);
				$msg = sprintf("Warning: XML error: %s at line %d", $errorString, $errorLineNo);
				echo $msg;
				$this->config = array();
			}

			$data = fread($fp, 4096);
		}
	}
284015
public function get($url) {
		$reporting = error_reporting(0);
		$context = $this->_createContext();
		$contents = file_get_contents($url, false, $context);
		error_reporting($reporting);

		if ($contents === false) {
			$code = isset($http_response_header[0])
				? $this->_extractHttpCode($http_response_header[0])
				: $this->_defaultCode;

			throw new Exception($url, $code);
		}

		return $contents;
	}
1355921
public function getGender() {

    if (empty($this->firstName)) {
      throw new Exception('Property firstName cannot be empty');
    }

    if (!extension_loaded('Gender')) {
      throw new Exception('PHP extension Gender is not loaded');
    }

    $this->firstName = mb_convert_case($this->firstName, MB_CASE_LOWER, "UTF-8");
    $this->lastName  = mb_convert_case($this->lastName,  MB_CASE_LOWER, "UTF-8");

    $this->country   = strtolower($this->country);

    $alias = array(
      'gb' => 1,
      'ie' => 2,
      'us' => 3,
      'es' => 4,
      'pt' => 5,
      'it' => 6,
      'mt' => 7,
      'fr' => 8,
      'be' => 9,
      'lu' => 10,
      'nl' => 11,
      'de' => 12,
      'at' => 14,
      'ch' => 15,
      'is' => 16,
      'dk' => 17,
      'no' => 18,
      'se' => 19,
      'fi' => 20,
      'ee' => 21,
      'lv' => 22,
      'lt' => 23,
      'pl' => 24,
      'cz' => 25,
      'sk' => 26,
      'hu' => 27,
      'ro' => 28,
      'bg' => 29,
      'ba' => 30,
      'hr' => 31,
      'mk' => 33,
      'me' => 34,
      'rs' => 35,
      'si' => 36,
      'al' => 37,
      'gr' => 38,
      'ru' => 39,
      'by' => 40,
      'md' => 41,
      'ua' => 42,
      'am' => 43,
      'az' => 44,
      'ge' => 45,
      'kz' => 46,
      'uz' => 46,
      'tr' => 47,
      'sa' => 48,
      'il' => 49,
      'cn' => 50,
      'in' => 51,
      'jp' => 52,
      'kr' => 53,
    );

    if (array_key_exists($this->country, $alias)) {
      $countryNum = $alias[$this->country];
    }
    else {
      $countryNum = 0;
    }

    $genObj = new Gender;
    $result = $genObj->get($this->firstName, $countryNum);

    switch ($result) {
      case Gender::IS_FEMALE:
        return 'F';
      case Gender::IS_MOSTLY_FEMALE:
        return 'F';
      case Gender::IS_MALE:
        return 'M';
      case Gender::IS_MOSTLY_MALE:
        return 'M';
    }

    #############################################################

    if (preg_match('/\S+á$/', $this->lastName)) {
      return 'F';
    }

    # Borrowed from <https://github.com/petewarden>
    if (preg_match('/^joh?n/', $this->firstName)) return 'M';
    if (preg_match('/^th?o(m|b)/', $this->firstName)) return 'M';
    if (preg_match('/^frank/', $this->firstName)) return 'M';
    if (preg_match('/^bil/', $this->firstName)) return 'M';
    if (preg_match('/^hans/', $this->firstName)) return 'M';
    if (preg_match('/^ron/', $this->firstName)) return 'M';
    if (preg_match('/^ro(z|s)/', $this->firstName)) return 'F';
    if (preg_match('/^walt/', $this->firstName)) return 'M';
    if (preg_match('/^krishna/', $this->firstName)) return 'M';
    if (preg_match('/^tri(c|sh)/', $this->firstName)) return 'F';
    if (preg_match('/^pas(c|qu)al$/', $this->firstName)) return 'M';
    if (preg_match('/^ellie/', $this->firstName)) return 'F';
    if (preg_match('/^anfernee/', $this->firstName)) return 'M';
    # most names ending in a/e/i/y are female
    if (preg_match('/^.*[aeiy]$/', $this->firstName)) return 'F';
    # allison and variations
    if (preg_match('/^all?[iy]((ss?)|z)on$/', $this->firstName)) return 'F';
    # cathleen, eileen, maureen
    if (preg_match('/een$/', $this->firstName)) return 'F';
    # barry, larry, perry
    if (preg_match('/^[^s].*r[rv]e?y?$/', $this->firstName)) return 'M';
    # clive, dave, steve
    if (preg_match('/^[^g].*v[ei]$/', $this->firstName)) return 'M';
    # carolyn, gwendolyn, vivian
    if (preg_match('/^[^bd].*(b[iy]|y|via)nn?$/', $this->firstName)) return 'F';
    # dewey, stanley, wesley
    if (preg_match('/^[^ajklmnp][^o][^eit]*([glrsw]ey|lie)$/', $this->firstName)) return 'M';
    # heather, ruth, velvet
    if (preg_match('/^[^gksw].*(th|lv)(e[rt])?$/', $this->firstName)) return 'F';
    # gregory, jeremy, zachary
    if (preg_match('/^[cgjwz][^o][^dnt]*y$/', $this->firstName)) return 'M';
    # leroy, murray, roy
    if (preg_match('/^.*[rlr][abo]y$/', $this->firstName)) return 'M';
    # abigail, jill, lillian
    if (preg_match('/^[aehjl].*il.*$/', $this->firstName)) return 'F';
    # duane, eugene, rene
    if (preg_match('/^.*[grguw][ae]y?ne$/', $this->firstName)) return 'M';
    # fleur, lauren, muriel
    if (preg_match('/^[flm].*ur(.*[^eotuy])?$/', $this->firstName)) return 'F';
    # lance, quincy, vince
    if (preg_match('/^[clmqtv].*[^dl][in]c.*[ey]$/', $this->firstName)) return 'M';
    # margaret, marylou, miri;
    if (preg_match('/^m[aei]r[^tv].*([^cklnos]|([^o]n))$/', $this->firstName)) return 'F';
    # clyde, kyle, pascale
    if (preg_match('/^.*[ay][dl]e$/', $this->firstName)) return 'M';
    # blake, luke, mi;
    if (preg_match('/^[^o]*ke$/', $this->firstName)) return 'M';
    # carol, karen, shar;
    if (preg_match('/^[cks]h?(ar[^lst]|ry).+$/', $this->firstName)) return 'F';
    # pam, pearl, rachel
    if (preg_match('/^[pr]e?a([^dfju]|qu)*[lm]$/', $this->firstName)) return 'F';
    # annacarol, leann, ruthann
    if (preg_match('/^.*[aa]nn.*$/', $this->firstName)) return 'F';
    # deborah, leah, sarah
    if (preg_match('/^.*[^cio]ag?h$/', $this->firstName)) return 'F';
    # frances, megan, susan
    if (preg_match('/^[^ek].*[grsz]h?an(ces)?$/', $this->firstName)) return 'F';
    # ethel, helen, gretchen
    if (preg_match('/^[^p]*([hh]e|[ee][lt])[^s]*[ey].*[^t]$/', $this->firstName)) return 'F';
    # george, joshua, theodore
    if (preg_match('/^[^el].*o(rg?|sh?)?(e|ua)$/', $this->firstName)) return 'M';
    # delores, doris, precious
    if (preg_match('/^[dp][eo]?[lr].*s$/', $this->firstName)) return 'F';
    # anthony, henry, rodney
    if (preg_match('/^[^jpswz].*[denor]n.*y$/', $this->firstName)) return 'M';
    # karin, kim, kristin
    if (preg_match('/^k[^v]*i.*[mns]$/', $this->firstName)) return 'F';
    # bradley, brady, bruce
    if (preg_match('/^br[aou][cd].*[ey]$/', $this->firstName)) return 'M';
    # agnes, alexis, glynis
    if (preg_match('/^[acgk].*[deinx][^aor]s$/', $this->firstName)) return 'F';
    # ignace, lee, wallace
    if (preg_match('/^[ilw][aeg][^ir]*e$/', $this->firstName)) return 'M';
    # juliet, mildred, millicent
    if (preg_match('/^[^agw][iu][gl].*[drt]$/', $this->firstName)) return 'F';
    # ari, bela, ira
    if (preg_match('/^[abeiuy][euz]?[blr][aeiy]$/', $this->firstName)) return 'M';
    # iris, lois, phyllis
    if (preg_match('/^[egilp][^eu]*i[ds]$/', $this->firstName)) return 'F';
    # randy, timothy, tony
    if (preg_match('/^[art][^r]*[dhn]e?y$/', $this->firstName)) return 'M';
    # beatriz, bridget, harriet
    if (preg_match('/^[bhl].*i.*[rtxz]$/', $this->firstName)) return 'F';
    # antoine, jerome, tyrone
    if (preg_match('/^.*oi?[mn]e$/', $this->firstName)) return 'M';
    # danny, demetri, dondi
    if (preg_match('/^d.*[mnw].*[iy]$/', $this->firstName)) return 'M';
    # pete, serge, shane
    if (preg_match('/^[^bg](e[rst]|ha)[^il]*e$/', $this->firstName)) return 'M';
    # angel, gail, isabel
    if (preg_match('/^[adfgim][^r]*([bg]e[lr]|il|wn)$/', $this->firstName)) return 'F';
    #------------------------------
    if (in_array($this->firstName, $this->male)) return 'M';
    #------------------------------
    if (in_array($this->firstName, $this->female)) return 'F';
    #---- End of borrowed code ----
    return 'N';
  }
597002
public function display()
    {
        $this->output = $this->content;

        //if content is an exception then
        //handle
        if ($this->content instanceof Exception) {
            $data = array();
            $data['code'] = $this->content->getCode();
            $data['message'] = (string) $this->content->getMessage();
            if ($this->content instanceof AnErrorException) {
                $data['errors'] = $this->_toData($this->content->getErrors());
            }
           //Encode data
            $this->output = json_encode($data);
        }

        return $this->output;
    }
1159132
public function readString() {

            $strref = $this->readU29();

            if (($strref & 0x01) == 0) {
                $strref = $strref >> 1;
                if ($strref>=count($this->storedStrings)) {
                    throw new Exception('Undefined string reference: ' . $strref);
                    return false;
                }
                return $this->storedStrings[$strref];
            } else {
                $strlen = $strref >> 1; 
                $str = $this->stream->readBuffer($strlen);
                if ($str != "") $this->storedStrings[] = $str;
                return $str;
            }

        }
817662
protected function getExceptionMessage(): string
    {
        $exception = $this->getException();

        if ($exception instanceof UserException) {
            return $exception->getMessage();
        }

        return $this->getDefaultMessage();
    }
1311668
public function execute()
    {
        $this->_setOptions();

        $sResponse = $this->_execute();
        $this->_saveStatusCode();

        $iCurlErrorNumber = $this->_getErrorNumber();

        $this->_close();

        if ($iCurlErrorNumber) {
            $host = $this->getUrl();
            $parameters = http_build_query($this->getParameters(), "", "&");
            $message = $this->_getErrorMessage($iCurlErrorNumber);
            throw new Exception("cURL failed with message '$message' when calling '$host?$parameters'");
        }

        return $sResponse;
    }
893799
protected function getExceptionCode()
    {
        $exception = $this->getException();

        $code = $exception->getCode();
        if ($exception instanceof \ErrorException) {
            // ErrorExceptions wrap the php-error types within the 'severity' property
            $code = Misc::translateErrorCode($exception->getSeverity());
        }

        return (string) $code;
    }
633549
public function getRuntimePath(): string
    {
        if ($this->_runtimePath !== null) {
            return $this->_runtimePath;
        }
        $runtimePath = Yii::getAlias('@runtime');

        if ($runtimePath === false) {
            throw new Exception('There was a problem getting the vendor path.');
        }
        return $this->_runtimePath = FileHelper::normalizePath($runtimePath);
    }
547310
public function toArray()
    {
        $fn = 'toArray' . ucfirst($this->presentation);
        if (!method_exists($this, $fn)) {
            throw new \Exception('There is no method ' . $fn . '.');
        }
        return $this->$fn();
    }
1188359
protected function getFormat()
    {
        if (!isset($this->config['mp3']['format'])) {
            throw new \Exception(
                $this->translate->translate(
                    'format is not currently set',
                    'mp3'
                )
            );
        }

        return $this->config['mp3']['format'];
    }
833394
public function getStatusCode()
    {
        if (method_exists($this->exception, 'getStatusCode')) {
            $httpCode = $this->exception->getStatusCode();
        } else {
            $httpCode = config($this->configFile.'.http_code');
        }

        return $httpCode;
    }
496713
public function getSettingsKey(): string
    {
        $key = $this->settingsKey;

        if (empty($this->$key)) {
            throw new Exception("No settings key is set on the constructor");
        }

        return $this->$key;
    }
1184720
public function getIndexName(): string
    {
        $name = trim($this->indexNameStrategy->get());
        if ($name === '') {
            throw new Exception('Index name can not be null');
        }

        return $name;
    }