public static function queued($mailable, $callback = null)
        {
                        /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */
                        return $instance->queued($mailable, $callback);
        }

/**
         * Get all of the queued mailables matching a truth-test callback.
         *
         * @param string|\Closure $mailable
         * @param callable|null $callback
         * @return \Illuminate\Support\Collection
         * @static
         */


public static function getMimeTypes($format)
        {            //Method inherited from \Symfony\Component\HttpFoundation\Request
                        return \Illuminate\Http\Request::getMimeTypes($format);
        }

/**
         * Gets the mime types associated with the format.
         *
         * @return string[]
         * @static
         */


public static function action($action, $parameters = [], $absolute = true)
        {
                        /** @var \Illuminate\Routing\UrlGenerator $instance */
                        return $instance->action($action, $parameters, $absolute);
        }

/**
         * Get the URL to a controller action.
         *
         * @param string|array $action
         * @param mixed $parameters
         * @param bool $absolute
         * @return string
         * @throws \InvalidArgumentException
         * @static
         */


final private function natlangElementYear($elem)
    {
        if (! $elem['hasInterval']) {
            return $elem['number1'];
        }

        $txt = $this->natlangApply('elemYear: every_consecutive_year'.($elem['interval'] == 1 ? '' : '_plural'), $elem['interval']);
        if (($elem['number1'] != $this->_cronMonths['rangeMin']) || ($elem['number2'] != $this->_cronMonths['rangeMax'])) {
            $txt .= ' ('.$this->natlangApply('elemYear: from_X_through_Y', $elem['number1'], $elem['number2']).')';
        }

        return $txt;
    }

//
// Function:    natlangElementYear
//
// Description:    Converts an entry from the year specification to natural language.
//


public function up()
    {
        Schema::table('activity_log', function (Blueprint $table) {
            $table->uuid('batch_uuid')->nullable()->after('properties');
        });
        Schema::table('activity_log_archives', function (Blueprint $table) {
            $table->uuid('batch_uuid')->nullable()->after('properties');
        });
    }

/**
     * Run the migrations.
     *
     * @return void
     */


public function create(array $queryParams = []): Response
    {
        return $this->client->execute(
            $this->createRequest('POST', '/snapshots' . $this->queryBuild($queryParams))
        );
    }

/**
     * # Create storage snapshot
     * Create new snapshot of the whole storage
     *
     * @throws InvalidArgumentException
     */


public function detail(int $id)
    {
        $goods = Goods::query()
            ->with(['coupon','goods_sub'])
            ->withCount(['carmis' => function($query) {
                $query->where('status', Carmis::STATUS_UNSOLD);
            }])->where('id', $id)->first();
        return $goods;
    }

/**
     * 商品详情
     *
     * @param int $id 商品id
     * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
     *
     * @author    assimon<ashang@utf8.hk>
     * @copyright assimon<ashang@utf8.hk>
     * @link      http://utf8.hk/
     */


public function getId(): string
    {
        return 'filament-jobs-monitor';
    }

/**
     * Get the plugin identifier.
     */


public function expired(): self
    {
        return $this->state([
            'status' => Subscription::STATUS_EXPIRED,
        ]);
    }

/**
     * Mark the subscription as expired
     */


public function load(): array
    {
        $text = file_get_contents($this->filePath->getRealPath());
        $metadata = ['source' => $this->filePath->getRealPath()];
        return [new Document(pageContent:$text, metadata: $metadata)];
    }

/**
     * Load from file path.
     *
     * @return Document[]
     */


protected static function newFactory(): CommentFactory
    {
        return CommentFactory::new();
    }

/**
     * @return CommentFactory
     */


function edit_category(){
    if(empty($_POST['name'])){
        msg(-1,'分类名称不能为空');
    }elseif(!preg_match('/^(fa fa-|layui-icon layui-icon-)([A-Za-z0-9]|-)+$/',$_POST['font_icon'])){
        $_POST['font_icon'] = 'fa fa-star-o';
    }
    //父分类不能是自己
    if($_POST['id'] == $_POST['fid']){
        msg(-1,'父分类不能是自己');
    }
    //查CID是否存在
    if(!get_db('user_categorys','cid',['uid'=>UID ,"cid" => intval($_POST['id'])])){
        msg(-1,'分类不存在');
    }
    //分类名查重(排除自身)
    if(get_db('user_categorys','cid',['uid'=>UID,'cid[!]'=>intval($_POST['id']),"name" => $_POST['name']])){
        msg(-1,'分类名称已存在');
    }
    //父分类不能是二级分类
    if(intval($_POST['fid']) !=0 && get_db('user_categorys','fid',['uid'=>UID ,"cid" => intval($_POST['fid']) ]) !=0  ){
        msg(-1,'父分类不能是二级分类');
    }
    //分类下存在子分类,禁止修改父分类
    if( $_POST['fid']!=0  && count_db('user_categorys',['uid'=>UID,'fid'=>$_POST['id']])>0){
        msg(-1,'该分类下已存在子分类！');
    }
    //查父分类是否存在
    if( $_POST['fid'] !=0  && !get_db('user_categorys','cid',['uid'=>UID ,"cid" => intval($_POST['fid'])])){
        msg(-1,'父分类不存在');
    }
    //长度检测
    $length_limit = unserialize(get_db("global_config","v",["k"=>"length_limit"]));
    if($length_limit['c_name'] > 0 && strlen($_POST['name']) > $length_limit['c_name'] ){
        msg(-1,'名称长度不能大于'.$length_limit['c_name'].'个字节');
    }
    if($length_limit['c_desc'] > 0 && strlen($_POST['description']) > $length_limit['c_desc'] ){
        msg(-1,'名称长度不能大于'.$length_limit['c_desc'].'个字节');
    }

    //更新数据
    $data = [
        'fid'=>$_POST['fid'],
        'property'=>intval($_POST['property']??'0'),
        'name'=>$_POST['name'],
        'up_time'=>time(),
        'description'=>$_POST['description']??'',
        'font_icon'=>$_POST['font_icon'],
        ];
    if(!isset($_POST['fid'])){ //为空时不修改父id,避免二级变一级
        unset($data['fid']);
    }
    if(!isset($_POST['font_icon'])){
        unset($data['font_icon']);
    }
    update_db('user_categorys',$data,['uid'=>UID ,"cid"=>intval($_POST['id'])],[0,'successful']);
}


function update_db($table,$data,$where,$rp = []){
    global $db;
    try {
        $db->update($table,$data,$where);
        if(empty($rp)){
            return true;
        }else{
            msg($rp[0],$rp[1]);
        }
    }catch (Exception $e) {
        if(Debug){
            msgA(['code'=>-1,'msg'=>'更新数据失败','Message'=>$e->getMessage(),'debug'=>debug_backtrace()]);
        }else{
            Amsg(-1,'更新数据失败');
        }
    }
}


function is_apply(){
    $apply_user = unserialize( get_db("user_config", "v", ["k" => "apply","uid"=>UID]));
    return ($GLOBALS['global_config']['apply'] == 1 && $apply_user['apply'] > 0);
}


public function getTableData(string $tableName): JsonResponse
    {
        return response()->json(array(
            "data" => $this->tableRules($tableName)
        ));
    }

/**
     * Get table data
     * @param string $tableName
     * @return JsonResponse
     */


public function getFallbackFor($code)
    {
        $this->loadLanguage($code);
        return $this->cache[$code]['fallback'];
    }

/**
     * Returns the fallback language for language
     * @note Loads the original language into cache
     * @param string $code language code
     * @return string|bool
     */


protected static function CDATACallback($matches)
    {
        // not exactly sure why the character set is needed, but whatever
        return htmlspecialchars($matches[1], ENT_COMPAT, 'UTF-8');
    }

/**
     * Callback function for escapeCDATA() that does the work.
     *
     * @warning Though this is public in order to let the callback happen,
     *          calling it directly is not recommended.
     * @param array $matches PCRE matches array, with index 0 the entire match
     *                  and 1 the inside of the CDATA section.
     * @return string Escaped internals of the CDATA section.
     */


protected function _findUnused($hash)
    {
        $accessed = $hash->getAccessed();
        foreach ($hash as $k => $v) {
            if (!isset($accessed[$k])) {
                trigger_error("String hash key '$k' not used by builder", E_USER_NOTICE);
            }
        }
    }

/**
     * Triggers errors for any unused keys passed in the hash; such keys
     * may indicate typos, missing values, etc.
     * @param HTMLPurifier_StringHash $hash Hash to check.
     */


protected function heavyHeader($text, $num = 1)
    {
        $ret = '';
        $ret .= $this->start('tr');
        $ret .= $this->element('th', $text, array('colspan' => $num, 'class' => 'heavy'));
        $ret .= $this->end('tr');
        return $ret;
    }

/**
     * Creates a heavy header row
     * @param string $text
     * @param int $num
     * @return string
     */


static function UseDefaultValues($bool=null)
	{
	global $ADODB_ACTIVE_DEFVALS;
		if (isset($bool)) {
			$ADODB_ACTIVE_DEFVALS = $bool;
		}
		return $ADODB_ACTIVE_DEFVALS;
	}

// CFR: class name when in a relationship


function &readcache($filename, &$err, $secs2cache, $rsClass) {
			$rs = csv2rs($filename,$err,$secs2cache,$rsClass);
			return $rs;
		}

// load serialised recordset and unserialise it


function GetActiveRecordsClass(
			$class, $table,$whereOrderBy=false,$bindarr=false, $primkeyArr=false,
			$extra=array(),
			$relations=array())
	{
		global $_ADODB_ACTIVE_DBS;
		## reduce overhead of adodb.inc.php -- moved to adodb-active-record.inc.php
		## if adodb-active-recordx is loaded -- should be no issue as they will probably use Find()
		if (!isset($_ADODB_ACTIVE_DBS)) {
			include_once(ADODB_DIR.'/adodb-active-record.inc.php');
		}
		return adodb_GetActiveRecordsClass($this, $class, $table, $whereOrderBy, $bindarr, $primkeyArr, $extra, $relations);
	}

/**
	 * GetActiveRecordsClass Performs an 'ALL' query
	 *
	 * @param mixed $class This string represents the class of the current active record
	 * @param mixed $table Table used by the active record object
	 * @param mixed $whereOrderBy Where, order, by clauses
	 * @param mixed $bindarr
	 * @param mixed $primkeyArr
	 * @param array $extra Query extras: limit, offset...
	 * @param mixed $relations Associative array: table's foreign name, "hasMany", "belongsTo"
	 * @access public
	 * @return void
	 */


function SelectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $secs2cache = 0)
	{
		global $ADODB_FETCH_MODE;

		$nrows = (int) $nrows;
		$offset = (int) $offset;
		$url = $this->_url.'?sql='.urlencode($sql)."&nrows=$nrows&fetch=".
			(($this->fetchMode !== false)?$this->fetchMode : $ADODB_FETCH_MODE).
			"&offset=$offset";
		$err = false;
		$rs = csv2rs($url,$err,false);

		if ($this->debug) print "$url
$err
";

		$at = strpos($err,'::::');
		if ($at === false) {
			$this->_errorMsg = $err;
			$this->_errorNo = (integer)$err;
		} else {
			$this->_errorMsg = substr($err,$at+4,1024);
			$this->_errorNo = -9999;
		}
		if ($this->_errorNo)
			if ($fn = $this->raiseErrorFn) {
				$fn($this->databaseType,'EXECUTE',$this->ErrorNo(),$this->ErrorMsg(),$sql,'');
			}

		if (is_object($rs)) {

			$rs->databaseType='csv';
			$rs->fetchMode = ($this->fetchMode !== false) ?  $this->fetchMode : $ADODB_FETCH_MODE;
			$rs->connection = $this;
		}
		return $rs;
	}

// parameters use PostgreSQL convention, not MySQL


function Parameter(&$stmt, &$var, $name, $isOutput=false, $maxLen=0, $type=0)
	{
		if ( $this->odbc_driver == ODB_DRIVER_JET ) {
			$name = '['.$name.']';
			if( !$type && $this->_useUnicodeSQL
				&& @odbtp_param_bindtype($stmt[1], $name) == ODB_CHAR )
			{
				$type = ODB_WCHAR;
			}
		}
		else {
			$name = '@'.$name;
		}
		return @odbtp_attach_param($stmt[1], $name, $var, $type, $maxLen);
	}

/*
	Usage:
		$stmt = $db->PrepareSP('SP_RUNSOMETHING'); -- takes 2 params, @myid and @group

		# note that the parameter does not have @ in front!
		$db->Parameter($stmt,$id,'myid');
		$db->Parameter($stmt,$group,'group',false,64);
		$db->Parameter($stmt,$group,'photo',false,100000,ODB_BINARY);
		$db->Execute($stmt);

		@param $stmt Statement returned by Prepare() or PrepareSP().
		@param $var PHP variable to bind to. Can set to null (for isNull support).
		@param $name Name of stored procedure variable name to bind to.
		@param [$isOutput] Indicates direction of parameter 0/false=IN  1=OUT  2= IN/OUT. This is ignored in odbtp.
		@param [$maxLen] Holds an maximum length of the variable.
		@param [$type] The data type of $var. Legal values depend on driver.

		See odbtp_attach_param documentation at http://odbtp.sourceforge.net.
	*/


public function encodeHeader($str, $position = 'text')
    {
        $matchcount = 0;
        switch (strtolower($position)) {
            case 'phrase':
                if (!preg_match('/[\200-\377]/', $str)) {
                    // Can't use addslashes as we don't know the value of magic_quotes_sybase
                    $encoded = addcslashes($str, "\0..\37\177\\\"");
                    if (($str == $encoded) and !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
                        return $encoded;
                    }

                    return "\"$encoded\"";
                }
                $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
                break;
            /* @noinspection PhpMissingBreakStatementInspection */
            case 'comment':
                $matchcount = preg_match_all('/[()"]/', $str, $matches);
            //fallthrough
            case 'text':
            default:
                $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
                break;
        }

        //RFCs specify a maximum line length of 78 chars, however mail() will sometimes
        //corrupt messages with headers longer than 65 chars. See #818
        $lengthsub = 'mail' == $this->Mailer ? 13 : 0;
        $maxlen = static::STD_LINE_LENGTH - $lengthsub;
        // Try to select the encoding which should produce the shortest output
        if ($matchcount > strlen($str) / 3) {
            // More than a third of the content will need encoding, so B encoding will be most efficient
            $encoding = 'B';
            //This calculation is:
            // max line length
            // - shorten to avoid mail() corruption
            // - Q/B encoding char overhead ("` =?<charset>?[QB]?<content>?=`")
            // - charset name length
            $maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
            if ($this->hasMultiBytes($str)) {
                // Use a custom function which correctly encodes and wraps long
                // multibyte strings without breaking lines within a character
                $encoded = $this->base64EncodeWrapMB($str, "\n");
            } else {
                $encoded = base64_encode($str);
                $maxlen -= $maxlen % 4;
                $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
            }
            $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
        } elseif ($matchcount > 0) {
            //1 or more chars need encoding, use Q-encode
            $encoding = 'Q';
            //Recalc max line length for Q encoding - see comments on B encode
            $maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
            $encoded = $this->encodeQ($str, $position);
            $encoded = $this->wrapText($encoded, $maxlen, true);
            $encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
            $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
        } elseif (strlen($str) > $maxlen) {
            //No chars need encoding, but line is too long, so fold it
            $encoded = trim($this->wrapText($str, $maxlen, false));
            if ($str == $encoded) {
                //Wrapping nicely didn't work, wrap hard instead
                $encoded = trim(chunk_split($str, static::STD_LINE_LENGTH, static::$LE));
            }
            $encoded = str_replace(static::$LE, "\n", trim($encoded));
            $encoded = preg_replace('/^(.*)$/m', ' \\1', $encoded);
        } else {
            //No reformatting needed
            return $str;
        }

        return trim(static::normalizeBreaks($encoded));
    }

/**
     * Encode a header value (not including its label) optimally.
     * Picks shortest of Q, B, or none. Result includes folding if needed.
     * See RFC822 definitions for phrase, comment and text positions.
     *
     * @param string $str      The header value to encode
     * @param string $position What context the string will be used in
     *
     * @return string
     */


public function hasMultiBytes($str)
    {
        if (function_exists('mb_strlen')) {
            return strlen($str) > mb_strlen($str, $this->CharSet);
        }

        // Assume no multibytes (we can't handle without mbstring functions anyway)
        return false;
    }

/**
     * Check if a string contains multi-byte characters.
     *
     * @param string $str multi-byte text to wrap encode
     *
     * @return bool
     */


public function encodeQP($string)
    {
        return static::normalizeBreaks(quoted_printable_encode($string));
    }

/**
     * Encode a string in quoted-printable format.
     * According to RFC2045 section 6.7.
     *
     * @param string $string The text to encode
     *
     * @return string
     */


protected function lang($key)
    {
        if (count($this->language) < 1) {
            $this->setLanguage('en'); // set the default language
        }

        if (array_key_exists($key, $this->language)) {
            if ('smtp_connect_failed' == $key) {
                //Include a link to troubleshooting docs on SMTP connection failure
                //this is by far the biggest cause of support questions
                //but it's usually not PHPMailer's fault.
                return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
            }

            return $this->language[$key];
        }

        //Return the key as a fallback
        return $key;
    }

/**
     * Get an error message in the current language.
     *
     * @param string $key
     *
     * @return string
     */


public function setEscapeHtml($escape_html)
    {
        $this->escape_html = $escape_html;
    }

/**
     * @param boolean $escape_html
     */


function smarty_modifiercompiler_count_words($params)
{
    if (Smarty::$_MBSTRING) {
        // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
        // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
        return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' .
               $params[ 0 ] . ', $tmp)';
    }
    // no MBString fallback
    return 'str_word_count(' . $params[ 0 ] . ')';
}

/**
 * Smarty plugin
 *
 * @package    Smarty
 * @subpackage PluginsModifierCompiler
 */
/**
 * Smarty count_words modifier plugin
 * Type:     modifier
 * Name:     count_words
 * Purpose:  count the number of words in a text
 *
 * @link   http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
 * @author Uwe Tews
 *
 * @param array $params parameters
 *
 * @return string with compiled code
 */


function smarty_modifiercompiler_from_charset($params)
{
    if (!Smarty::$_MBSTRING) {
        // FIXME: (rodneyrehm) shouldn't this throw an error?
        return $params[ 0 ];
    }

    if (!isset($params[ 1 ])) {
        $params[ 1 ] = '"ISO-8859-1"';
    }

    return 'mb_convert_encoding(' . $params[ 0 ] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[ 1 ] . ')';
}

/**
 * Smarty plugin
 *
 * @package    Smarty
 * @subpackage PluginsModifierCompiler
 */
/**
 * Smarty from_charset modifier plugin
 * Type:     modifier
 * Name:     from_charset
 * Purpose:  convert character encoding from $charset to internal encoding
 *
 * @author Rodney Rehm
 *
 * @param array $params parameters
 *
 * @return string with compiled code
 */


public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
    {
        // check and get attributes
        $_attr = $this->getAttributes($compiler, $args);

        if ($_attr[ 'nocache' ] === true) {
            $compiler->trigger_template_error('nocache option not allowed', null, true);
        }
        unset($_attr[ 'nocache' ]);
        $_name = trim($_attr[ 'name' ], '\'"');
        $compiler->parent_compiler->tpl_function[ $_name ] = array();
        $save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code,
                      $compiler->template->caching);
        $this->openTag($compiler, 'function', $save);
        // Init temporary context
        $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
        $compiler->template->compiled->has_nocache_code = false;
        $compiler->saveRequiredPlugins(true);
        return true;
    }

/**
     * Compiles code for the {function} tag
     *
     * @param  array                                $args     array with attributes from parser
     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
     *
     * @return bool true
     * @throws \SmartyCompilerException
     */


public function end_cache(Smarty_Internal_Template $template)
    {
        $key = $this->get_key($template);
        $this->template_data[ $this->index ][ $key ][ 'cache_time' ] +=
            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
    }

/**
     * End logging of cache time
     *
     * @param \Smarty_Internal_Template $template cached template
     */


public function register(): void
    {
        $this->reportable(function (Throwable $e) {
            //
        });
    }

/**
     * Register the exception handling callbacks for the application.
     */


public function viewAny(User $user): bool
    {
        return false;
    }

/**
     * Determine whether the user can view any models.
     */


public function setStatus($status)
    {
        if (is_null($status)) {
            throw new \InvalidArgumentException('non-nullable status cannot be null');
        }
        $allowedValues = $this->getStatusAllowableValues();
        if (!in_array($status, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'status', must be one of '%s'",
                    $status,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['status'] = $status;

        return $this;
    }

/**
     * Sets status
     *
     * @param string $status status
     *
     * @return self
     */


public function setShortNotes($short_notes)
    {
        if (is_null($short_notes)) {
            throw new \InvalidArgumentException('non-nullable short_notes cannot be null');
        }
        $this->container['short_notes'] = $short_notes;

        return $this;
    }

/**
     * Sets short_notes
     *
     * @param string $short_notes short_notes
     *
     * @return self
     */


public static function openAPIFormats()
    {
        return self::$openAPIFormats;
    }

/**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */


public static function isNullable(string $property): bool
    {
        return self::openAPINullables()[$property] ?? false;
    }

/**
     * Checks if a property is nullable
     *
     * @param string $property
     * @return bool
     */


public function getDataGb()
    {
        return $this->container['data_gb'];
    }

/**
     * Gets data_gb
     *
     * @return float
     */


private function setIfExists(string $variableName, array $fields, $defaultValue): void
    {
        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
            $this->openAPINullablesSetToNull[] = $variableName;
        }

        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
    }

/**
    * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
    * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
    * $this->openAPINullablesSetToNull array
    *
    * @param string $variableName
    * @param array  $fields
    * @param mixed  $defaultValue
    */


public function getModelName()
    {
        return self::$openAPIModelName;
    }

/**
     * The original name of the model.
     *
     * @return string
     */


public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['status'] === null) {
            $invalidProperties[] = "'status' can't be null";
        }
        if ($this->container['transaction_id'] === null) {
            $invalidProperties[] = "'transaction_id' can't be null";
        }
        return $invalidProperties;
    }

/**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */


public function setCurrency($currency)
    {
        if (is_null($currency)) {
            throw new \InvalidArgumentException('non-nullable currency cannot be null');
        }
        $this->container['currency'] = $currency;

        return $this;
    }

/**
     * Sets currency
     *
     * @param string $currency currency
     *
     * @return self
     */


public function __toString()
    {
        return json_encode(
            ObjectSerializer::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT
        );
    }

/**
     * Gets the string presentation of the object
     *
     * @return string
     */


public function testMessageWithoutNamespace()
    {
        $m = new TestMessage();
        $n = new NoNameSpaceMessage();
        $m->setOptionalNoNamespaceMessage($n);
        $repeatedNoNamespaceMessage = $m->getRepeatedNoNamespaceMessage();
        $repeatedNoNamespaceMessage[] = new NoNameSpaceMessage();
        $m->setRepeatedNoNamespaceMessage($repeatedNoNamespaceMessage);

        // test nested messages
        $sub = new NoNamespaceMessage\NestedMessage();
        $n->setNestedMessage($sub);

        $this->assertTrue(true);
    }


public function testConstructorWithMapWrapperType($wrapperField, $getter, $value)
    {
        $actualInstance = new TestWrapperSetters([$wrapperField => $value]);
        foreach ($actualInstance->$getter() as $key => $actualWrapperValue) {
            $actualInnerValue = $actualWrapperValue->getValue();
            $expectedElement = $value[$key];
            if (is_object($expectedElement) && is_a($expectedElement, '\Google\Protobuf\StringValue')) {
                $expectedInnerValue = $expectedElement->getValue();
            } elseif (is_object($expectedElement) && is_a($expectedElement, '\Google\Protobuf\Internal\MapEntry')) {
                $expectedInnerValue = $expectedElement->getValue()->getValue();
            } else {
                $expectedInnerValue = $expectedElement;
            }
            $this->assertEquals($expectedInnerValue, $actualInnerValue);
        }
    }

/**
     * @dataProvider constructorWithMapWrapperTypeDataProvider
     */


public function up()
    {
        Schema::create('stocks', function (Blueprint $table) {
            $table->increments('id');
            $table->string('product_code');
            $table->integer('product_id');
            $table->integer('category_id');
            $table->integer('vendor_id');
            $table->integer('user_id');
            $table->string('chalan_no');
            $table->double('buying_price');
            $table->double('selling_price');
            $table->double('discount')->default(0);
            $table->integer('stock_quantity');
            $table->integer('current_quantity')->default(0);
            $table->text('note')->nullable();
            $table->tinyInteger('status')->default(1);
            $table->timestamps();
        });
    }

/**
     * Run the migrations.
     *
     * @return void
     */


public function getHomeConfigDir()
    {
        $path = getenv('XDG_CONFIG_HOME') ?: $this->getHomeDir() . DIRECTORY_SEPARATOR . '.config';

        return $path;
    }


public function __construct()
    {
        throw new BadMethodCallException('Not supposed to be called!');
    }

/**
     * Constructor - should not be called
     *
     * @throws BadMethodCallException
     */


public static function buildingNumber()
    {
        return static::numerify(static::randomElement(static::$buildingNumber));
    }


public static function country()
    {
        return static::randomElement(static::$country);
    }


public static function bankAccountNumber($prefix = '', $countryCode = 'DE', $length = null)
    {
        return static::iban($countryCode, $prefix, $length);
    }

/**
     * International Bank Account Number (IBAN)
     * @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
     * @param  string  $prefix      for generating bank account number of a specific bank
     * @param  string  $countryCode ISO 3166-1 alpha-2 country code
     * @param  integer $length      total length without country code and 2 check digits
     * @return string
     */


public static function randomPostcodeLetter()
    {
        return static::randomElement(static::$postcodeLetters);
    }

/**
     * Returns a postalcode-safe letter
     * @example A1B 2C3
     */


public static function citySuffix()
    {
        return static::randomElement(static::$citySuffix);
    }

/**
     * @example '-des-Sables'
     */


public static function firstNameMaleChristian()
    {
        return static::randomElement(static::$firstNameMaleChristian);
    }

/**
     * Return a Christian male name
     *
     * @example 'Aaron'
     *
     * @return string
     */


protected function resolve($name)
    {
        $config = $this->getConfig($name);

        if (is_null($config)) {
            throw new InvalidArgumentException("Auth guard [{$name}] is not defined.");
        }

        if (isset($this->customCreators[$config['driver']])) {
            return $this->callCustomCreator($name, $config);
        }

        $driverMethod = 'create'.ucfirst($config['driver']).'Driver';

        if (method_exists($this, $driverMethod)) {
            return $this->{$driverMethod}($name, $config);
        }

        throw new InvalidArgumentException("Auth guard driver [{$name}] is not defined.");
    }

/**
     * Resolve the given guard.
     *
     * @param  string  $name
     * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard
     *
     * @throws \InvalidArgumentException
     */


public function retrieveByToken($identifier, $token)
    {
        $model = $this->createModel();

        $model = $model->where($model->getAuthIdentifierName(), $identifier)->first();

        if (! $model) {
            return null;
        }

        $rememberToken = $model->getRememberToken();

        return $rememberToken && hash_equals($rememberToken, $token) ? $model : null;
    }

/**
     * Retrieve a user by their unique identifier and "remember me" token.
     *
     * @param  mixed  $identifier
     * @param  string  $token
     * @return \Illuminate\Contracts\Auth\Authenticatable|null
     */


protected function cycleRememberToken(AuthenticatableContract $user)
    {
        $user->setRememberToken($token = Str::random(60));

        $this->provider->updateRememberToken($user, $token);
    }

/**
     * Refresh the "remember me" token for the user.
     *
     * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
     * @return void
     */


public function resolvePolicy($class)
    {
        return $this->container->make($class);
    }

/**
     * Build a policy class instance of the given type.
     *
     * @param  object|string  $class
     * @return mixed
     */


protected function deleteForeverKeys()
    {
        $this->deleteKeysByReference(self::REFERENCE_KEY_FOREVER);
    }

/**
     * Delete all of the items that were stored forever.
     *
     * @return void
     */


protected function getMinutes($duration)
    {
        $duration = $this->parseDateInterval($duration);

        if ($duration instanceof DateTimeInterface) {
            $duration = Carbon::now()->diffInSeconds(Carbon::createFromTimestamp($duration->getTimestamp()), false) / 60;
        }

        return (int) ($duration * 60) > 0 ? $duration : null;
    }

/**
     * Calculate the number of minutes with the given duration.
     *
     * @param  \DateTimeInterface|\DateInterval|float|int  $duration
     * @return float|int|null
     */


public function run(InputInterface $input, OutputInterface $output)
    {
        return parent::run(
            $this->input = $input, $this->output = new OutputStyle($input, $output)
        );
    }

/**
     * Run the console command.
     *
     * @param  \Symfony\Component\Console\Input\InputInterface  $input
     * @param  \Symfony\Component\Console\Output\OutputInterface  $output
     * @return int
     */


public function insert($query, $bindings = [])
    {
        return $this->statement($query, $bindings);
    }

/**
     * Run an insert statement against the database.
     *
     * @param  string  $query
     * @param  array   $bindings
     * @return bool
     */


public function getSchemaBuilder()
    {
        if (is_null($this->schemaGrammar)) {
            $this->useDefaultSchemaGrammar();
        }

        return new SqlServerBuilder($this);
    }

/**
     * Get a schema builder instance for the connection.
     *
     * @return \Illuminate\Database\Schema\SqlServerBuilder
     */


public function __construct(Migrator $migrator)
    {
        parent::__construct();

        $this->migrator = $migrator;
    }

/**
     * Create a new migration rollback command instance.
     *
     * @param  \Illuminate\Database\Migrations\Migrator $migrator
     * @return void
     */


public function findOrFail($id, $columns = ['*'])
    {
        $result = $this->find($id, $columns);

        if (is_array($id)) {
            if (count($result) == count(array_unique($id))) {
                return $result;
            }
        } elseif (! is_null($result)) {
            return $result;
        }

        throw (new ModelNotFoundException)->setModel(get_class($this->related));
    }

/**
     * Find a related model by its primary key or throw an exception.
     *
     * @param  mixed  $id
     * @param  array  $columns
     * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection
     *
     * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
     */


public function getResults()
    {
        return $this->query->get();
    }

/**
     * Get the results of the relationship.
     *
     * @return mixed
     */


protected function addDynamic($segment, $connector, $parameters, $index)
    {
        // Once we have parsed out the columns and formatted the boolean operators we
        // are ready to add it to this query as a where clause just like any other
        // clause on the query. Then we'll increment the parameter index values.
        $bool = strtolower($connector);

        $this->where(Str::snake($segment), '=', $parameters[$index], $bool);
    }

/**
     * Add a single dynamic where clause statement to the query.
     *
     * @param  string  $segment
     * @param  string  $connector
     * @param  array   $parameters
     * @param  int     $index
     * @return void
     */


protected function dateBasedWhere($type, Builder $query, $where)
    {
        $value = $this->parameter($where['value']);

        return $type.'('.$this->wrap($where['column']).') '.$where['operator'].' '.$value;
    }

/**
     * Compile a date based where clause.
     *
     * @param  string  $type
     * @param  \Illuminate\Database\Query\Builder  $query
     * @param  array  $where
     * @return string
     */


public function primary($columns, $name = null, $algorithm = null)
    {
        return $this->indexCommand('primary', $columns, $name, $algorithm);
    }

/**
     * Specify the primary key(s) for the table.
     *
     * @param  string|array  $columns
     * @param  string  $name
     * @param  string|null  $algorithm
     * @return \Illuminate\Support\Fluent
     */


protected function typeBoolean(Fluent $column)
    {
        return 'tinyint(1)';
    }

/**
     * Create the column definition for a boolean type.
     *
     * @param  \Illuminate\Support\Fluent  $column
     * @return string
     */


public function assertSee($value)
    {
        PHPUnit::assertContains($value, $this->getContent());

        return $this;
    }

/**
     * Assert that the given string is contained within the response.
     *
     * @param  string  $value
     * @return $this
     */


public function notice($message, array $context = [])
    {
        $this->writeLog(__FUNCTION__, $message, $context);
    }

/**
     * Log a notice to the logs.
     *
     * @param  string  $message
     * @param  array  $context
     * @return void
     */


public function buildViewData()
    {
        $data = $this->viewData;

        foreach ((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
            if ($property->getDeclaringClass()->getName() != self::class) {
                $data[$property->getName()] = $property->getValue($this);
            }
        }

        return $data;
    }

/**
     * Build the view data for the message.
     *
     * @return array
     */


public function __construct(ViewFactory $view, array $options = [])
    {
        $this->view = $view;
        $this->theme = $options['theme'] ?? 'default';
        $this->loadComponentsFrom($options['paths'] ?? []);
    }

/**
     * Create a new Markdown renderer instance.
     *
     * @param  \Illuminate\Contracts\View\Factory  $view
     * @param  array  $options
     * @return void
     */


protected function prepAttachment($attachment, $options = [])
    {
        // First we will check for a MIME type on the message, which instructs the
        // mail client on what type of attachment the file is so that it may be
        // downloaded correctly by the user. The MIME option is not required.
        if (isset($options['mime'])) {
            $attachment->setContentType($options['mime']);
        }

        // If an alternative name was given as an option, we will set that on this
        // attachment so that it will be downloaded with the desired names from
        // the developer, otherwise the default file names will get assigned.
        if (isset($options['as'])) {
            $attachment->setFilename($options['as']);
        }

        $this->swift->attach($attachment);

        return $this;
    }

/**
     * Prepare and attach the given attachment.
     *
     * @param  \Swift_Attachment  $attachment
     * @param  array  $options
     * @return $this
     */


public function __construct($record)
    {
        $this->record = $record;
    }

/**
     * Create a new job record instance.
     *
     * @param  \stdClass  $record
     * @return void
     */


public static function resolve($name, $map, $middlewareGroups)
    {
        // When the middleware is simply a Closure, we will return this Closure instance
        // directly so that Closures can be registered as middleware inline, which is
        // convenient on occasions when the developers are experimenting with them.
        if ($name instanceof Closure) {
            return $name;
        }

        if (isset($map[$name]) && $map[$name] instanceof Closure) {
            return $map[$name];
        }

        // If the middleware is the name of a middleware group, we will return the array
        // of middlewares that belong to the group. This allows developers to group a
        // set of middleware under single keys that can be conveniently referenced.
        if (isset($middlewareGroups[$name])) {
            return static::parseMiddlewareGroup($name, $map, $middlewareGroups);
        }

        // Finally, when the middleware is simply a string mapped to a class name the
        // middleware name will get parsed into the full class name and parameters
        // which may be run using the Pipeline which accepts this string format.
        list($name, $parameters) = array_pad(explode(':', $name, 2), 2, null);

        return ($map[$name] ?? $name).(! is_null($parameters) ? ':'.$parameters : '');
    }

/**
     * Resolve the middleware name to a class name(s) preserving passed parameters.
     *
     * @param  string  $name
     * @param  array  $map
     * @param  array  $middlewareGroups
     * @return \Closure|string|array
     */


protected function getOptionalParameters()
    {
        preg_match_all('/\{(\w+?)\?\}/', $this->route->uri(), $matches);

        return isset($matches[1]) ? array_fill_keys($matches[1], null) : [];
    }

/**
     * Get the optional parameters for the route.
     *
     * @return array
     */


public function read($sessionId)
    {
        return $this->cache->get($sessionId, '');
    }


public function flashInput(array $value)
    {
        $this->flash('_old_input', $value);
    }

/**
     * Flash an input array to the session.
     *
     * @param  array  $value
     * @return void
     */


public function split($numberOfGroups)
    {
        if ($this->isEmpty()) {
            return new static;
        }

        $groupSize = ceil($this->count() / $numberOfGroups);

        return $this->chunk($groupSize);
    }

/**
     * Split a collection into a certain number of groups.
     *
     * @param  int  $numberOfGroups
     * @return static
     */


public function getBag($key)
    {
        return Arr::get($this->bags, $key) ?: new MessageBag;
    }

/**
     * Get a MessageBag instance from the bags.
     *
     * @param  string  $key
     * @return \Illuminate\Contracts\Support\MessageBag
     */


protected static function getFacadeAccessor()
    {
        return 'encrypter';
    }

/**
     * Get the registered name of the component.
     *
     * @return string
     */


protected static function isMock()
    {
        $name = static::getFacadeAccessor();

        return isset(static::$resolvedInstance[$name]) &&
               static::$resolvedInstance[$name] instanceof MockInterface;
    }

/**
     * Determines whether a mock is set as the instance of the facade.
     *
     * @return bool
     */


public function rename($path, $newpath)
    {
        return ftp_rename($this->getConnection(), $path, $newpath);
    }


public function writeStream($path, $resource, Config $config)
    {
        $location = $this->applyPathPrefix($path);
        $this->ensureDirectory(dirname($location));
        $stream = fopen($location, 'w+b');

        if ( ! $stream || stream_copy_to_stream($resource, $stream) === false || ! fclose($stream)) {
            return false;
        }

        $type = 'file';
        $result = compact('type', 'path');

        if ($visibility = $config->get('visibility')) {
            $this->setVisibility($path, $visibility);
            $result['visibility'] = $visibility;
        }

        return $result;
    }


public static function notAnyOf(...$args)
    {
        return new \Mockery\Matcher\NotAnyOf($args);
    }

/**
     * Return instance of NOTANYOF matcher.
     *
     * @param array ...$args
     *
     * @return \Mockery\Matcher\NotAnyOf
     */


public static function withDefaultPasses()
    {
        return new static([
            new CallTypeHintPass(),
            new MagicMethodTypeHintsPass(),
            new ClassPass(),
            new TraitPass(),
            new ClassNamePass(),
            new InstanceMockPass(),
            new InterfacePass(),
            new MethodDefinitionPass(),
            new RemoveUnserializeForInternalSerializableClassesPass(),
            new RemoveBuiltinMethodsThatAreFinalPass(),
            new RemoveDestructorPass(),
            new ConstantsPass(),
        ]);
    }

/**
     * Creates a new StringManipulationGenerator with the default passes
     *
     * @return StringManipulationGenerator
     */


public function testHandlesMethodWithArgumentExpectationWhenCalledWithNestedArray()
    {
        $testArray = array();
        $testArray['a_scalar'] = 2;
        $testArray['an_array'] = array(1, 2, 3);

        $mock = mock('MyTestClass');
        $mock->shouldReceive('foo')->with(array('yourself' => 21));

        $mock->foo($testArray);
    }

/**
     * @expectedException Mockery\Exception\NoMatchingExpectationException
     * @expectedExceptionMessage MyTestClass::foo(['a_scalar' => 2, 'an_array' => [...]])
     */


public function testGroupedOrderingThrowsExceptionWhenCallsDisordered()
    {
        $this->mock->shouldReceive('foo')->ordered('first');
        $this->mock->shouldReceive('bar')->ordered('second');
        $this->mock->bar();
        $this->mock->foo();
        Mockery::close();
    }

/**
     * @expectedException \Mockery\Exception
     */


public function alert($message, array $context = array())
    {
        return $this->addRecord(static::ALERT, $message, $context);
    }

/**
     * Adds a log record at the ALERT level.
     *
     * This method allows for compatibility with common interfaces.
     *
     * @param  string $message The log message
     * @param  array  $context The log context
     * @return bool   Whether the record has been processed
     */


public function formatBatch(array $records)
    {
        $message = '';
        foreach ($records as $record) {
            $message .= $this->format($record);
        }

        return $message;
    }

/**
     * Formats a set of log records.
     *
     * @param  array $records A set of records to format
     * @return mixed The formatted set of records
     */


protected function write(array $record)
    {
        $this->connectIfNotConnected();
        $data = $this->generateDataStream($record);
        $this->writeToSocket($data);
    }

/**
     * Connect (if necessary) and write to the socket
     *
     * @param array $record
     *
     * @throws \UnexpectedValueException
     * @throws \RuntimeException
     */


public function hasRecord($record, $level)
    {
        if (is_string($record)) {
            $record = array('message' => $record);
        }

        return $this->hasRecordThatPasses(function ($rec) use ($record) {
            if ($rec['message'] !== $record['message']) {
                return false;
            }
            if (isset($record['context']) && $rec['context'] !== $record['context']) {
                return false;
            }
            return true;
        }, $level);
    }

/**
     * @param string|array $record Either a message string or an array containing message and optionally context keys that will be checked against all records
     * @param int          $level  Logger::LEVEL constant value
     */


public function testReplacesLogger()
    {
        $log1 = new Logger('test1');
        $log2 = new Logger('test2');

        Registry::addLogger($log1, 'log');

        Registry::addLogger($log2, 'log', true);

        $this->assertSame($log2, Registry::getInstance('log'));
    }

/**
     * @covers Monolog\Registry::addLogger
     */


public function testBatchFormatThrowException()
    {
        $formatter = new ChromePHPFormatter();
        $records = array(
            array(
                'level' => Logger::INFO,
                'level_name' => 'INFO',
                'channel' => 'meh',
                'context' => array(),
                'datetime' => new \DateTime("@0"),
                'extra' => array(),
                'message' => 'log',
            ),
            array(
                'level' => Logger::WARNING,
                'level_name' => 'WARNING',
                'channel' => 'foo',
                'context' => array(),
                'datetime' => new \DateTime("@0"),
                'extra' => array(),
                'message' => 'log2',
            ),
        );

        $this->assertEquals(
            array(
                array(
                    'meh',
                    'log',
                    'unknown',
                    'info',
                ),
                array(
                    'foo',
                    'log2',
                    'unknown',
                    'warn',
                ),
            ),
            $formatter->formatBatch($records)
        );
    }

/**
     * @covers Monolog\Formatter\ChromePHPFormatter::formatBatch
     */


public function testIsDueHandlesDifferentTimezones()
    {
        $cron = CronExpression::factory('0 15 * * 3'); //Wednesday at 15:00
        $date = '2014-01-01 15:00'; //Wednesday
        $utc = new DateTimeZone('UTC');
        $amsterdam =  new DateTimeZone('Europe/Amsterdam');
        $tokyo = new DateTimeZone('Asia/Tokyo');

        date_default_timezone_set('UTC');
        $this->assertTrue($cron->isDue(new DateTime($date, $utc)));
        $this->assertFalse($cron->isDue(new DateTime($date, $amsterdam)));
        $this->assertFalse($cron->isDue(new DateTime($date, $tokyo)));

        date_default_timezone_set('Europe/Amsterdam');
        $this->assertFalse($cron->isDue(new DateTime($date, $utc)));
        $this->assertTrue($cron->isDue(new DateTime($date, $amsterdam)));
        $this->assertFalse($cron->isDue(new DateTime($date, $tokyo)));

        date_default_timezone_set('Asia/Tokyo');
        $this->assertFalse($cron->isDue(new DateTime($date, $utc)));
        $this->assertFalse($cron->isDue(new DateTime($date, $amsterdam)));
        $this->assertTrue($cron->isDue(new DateTime($date, $tokyo)));
    }

/**
     * @covers Cron\CronExpression::isDue
     */


private function getFirstMatchedTypeFilter(array $filterRecords, $var)
    {
        $matched = $this->first(
            $filterRecords,
            function (array $record) use ($var) {
                /* @var TypeMatcher $matcher */
                $matcher = $record['matcher'];

                return $matcher->matches($var);
            }
        );

        return isset($matched) ? $matched['filter'] : null;
    }

/**
     * Returns first filter that matches variable, `null` if no such filter found.
     *
     * @param array $filterRecords Associative array with 2 members: 'filter' with value of type {@see TypeFilter} and
     *                             'matcher' with value of type {@see TypeMatcher}
     * @param mixed $var
     *
     * @return TypeFilter|null
     */


public static function createFromDate($year = null, $month = null, $day = null, $tz = null)
    {
        return static::create($year, $month, $day, null, null, null, $tz);
    }

/**
     * Create a Carbon instance from just a date. The time portion is set to now.
     *
     * @param int|null                  $year
     * @param int|null                  $month
     * @param int|null                  $day
     * @param \DateTimeZone|string|null $tz
     *
     * @throws \InvalidArgumentException
     *
     * @return static
     */


public function subWeekdays($value)
    {
        return $this->addWeekdays(-1 * $value);
    }

/**
     * Remove weekdays from the instance
     *
     * @param int $value
     *
     * @return static
     */


public function copy()
    {
        $date = new static($this->spec());
        $date->invert = $this->invert;

        return $date;
    }

/**
     * Get a copy of the instance.
     *
     * @return static
     */


public static function createFromIso($iso, $options = null)
    {
        $params = static::parseIso8601($iso);

        $instance = static::createFromArray($params);

        if ($options !== null) {
            $instance->setOptions($options);
        }

        return $instance;
    }

/**
     * Create CarbonPeriod from ISO 8601 string.
     *
     * @param string   $iso
     * @param int|null $options
     *
     * @return static
     */


public function isQualified() : bool {
        return false;
    }

/**
     * Checks whether the name is qualified. (E.g. Name\Name)
     *
     * @return bool Whether the name is qualified
     */


public function __construct($name, array $subNodes = [], array $attributes = []) {
        parent::__construct($attributes);
        $this->name = \is_string($name) ? new Node\Identifier($name) : $name;
        $this->extends = $subNodes['extends'] ?? [];
        $this->stmts = $subNodes['stmts'] ?? [];
    }

/**
     * Constructs a class node.
     *
     * @param string|Node\Identifier $name Name
     * @param array  $subNodes   Array of the following optional subnodes:
     *                           'extends' => array(): Name of extended interfaces
     *                           'stmts'   => array(): Statements
     * @param array  $attributes Additional attributes
     */


public function __construct(array $stmts, array $catches, Finally_ $finally = null, array $attributes = []) {
        parent::__construct($attributes);
        $this->stmts = $stmts;
        $this->catches = $catches;
        $this->finally = $finally;
    }

/**
     * Constructs a try catch node.
     *
     * @param Node\Stmt[]   $stmts      Statements
     * @param Catch_[]      $catches    Catches
     * @param null|Finally_ $finally    Optionaly finally node
     * @param array         $attributes Additional attributes
     */


public function testCreate($kind, $lexer, $expected) {
        $this->assertInstanceOf($expected, (new ParserFactory)->create($kind, $lexer));
    }


public function testNoReplaceKeywordsAfterObjectOperator($keyword) {
        $lexer = $this->getLexer();
        $lexer->startLexing('<?php ->' . $keyword);

        $this->assertSame(Tokens::T_OBJECT_OPERATOR, $lexer->getNextToken());
        $this->assertSame(Tokens::T_STRING, $lexer->getNextToken());
        $this->assertSame(0, $lexer->getNextToken());
    }

/**
     * @dataProvider provideTestReplaceKeywords
     */


public function valid() {
        return $this->position < count($this->bundledComponents);
    }


private function __construct(DOMDocument $dom) {
        $this->ensureCorrectDocumentType($dom);

        $this->dom = $dom;
    }

/**
     * ManifestDocument constructor.
     *
     * @param DOMDocument $dom
     */


private function filterTagBlock($tags)
    {
        $tags = trim($tags);
        if (!$tags) {
            return null;
        }

        if ('@' !== $tags[0]) {
            // @codeCoverageIgnoreStart
            // Can't simulate this; this only happens if there is an error with the parsing of the DocBlock that
            // we didn't foresee.
            throw new \LogicException('A tag block started with text instead of an at-sign(@): ' . $tags);
            // @codeCoverageIgnoreEnd
        }

        return $tags;
    }

/**
     * @param $tags
     * @return string
     */


public function __toString()
    {
        return 'mixed';
    }

/**
     * Returns a rendered output of the Type as it would be used in a DocBlock.
     *
     * @return string
     */


public function supports(ClassNode $node)
    {
        return 'ReflectionClass' === $node->getParentClass();
    }

/**
     * Supports ReflectionClass
     *
     * @param ClassNode $node
     *
     * @return bool
     */


public function apply(ClassNode $node)
    {
        foreach ($node->getMethod('newInstance')->getArguments() as $argument) {
            $argument->setDefault(null);
        }
    }

/**
     * Updates newInstance's first argument to make it optional
     *
     * @param ClassNode $node
     */


abstract public function getLinesOfCode();

/**
     * Returns the LOC/CLOC/NCLOC of this node.
     *
     * @return array
     */


protected function renderItem(Node $node, $total = false)
    {
        $data = [
            'numClasses'                   => $node->getNumClassesAndTraits(),
            'numTestedClasses'             => $node->getNumTestedClassesAndTraits(),
            'numMethods'                   => $node->getNumFunctionsAndMethods(),
            'numTestedMethods'             => $node->getNumTestedFunctionsAndMethods(),
            'linesExecutedPercent'         => $node->getLineExecutedPercent(false),
            'linesExecutedPercentAsString' => $node->getLineExecutedPercent(),
            'numExecutedLines'             => $node->getNumExecutedLines(),
            'numExecutableLines'           => $node->getNumExecutableLines(),
            'testedMethodsPercent'         => $node->getTestedFunctionsAndMethodsPercent(false),
            'testedMethodsPercentAsString' => $node->getTestedFunctionsAndMethodsPercent(),
            'testedClassesPercent'         => $node->getTestedClassesAndTraitsPercent(false),
            'testedClassesPercentAsString' => $node->getTestedClassesAndTraitsPercent()
        ];

        if ($total) {
            $data['name'] = 'Total';
        } else {
            if ($node instanceof DirectoryNode) {
                $data['name'] = \sprintf(
                    '%s',
                    $node->getName(),
                    $node->getName()
                );

                $data['icon'] = ' ';
            } else {
                $data['name'] = \sprintf(
                    '%s',
                    $node->getName(),
                    $node->getName()
                );

                $data['icon'] = ' ';
            }
        }

        return $this->renderItemTemplate(
            new \Text_Template($this->templatePath . 'directory_item.html', '{{', '}}'),
            $data
        );
    }

/**
     * @param Node $node
     * @param bool $total
     *
     * @return string
     */


/**
     * @covers NotExistingClass::<public>
     */


public function setBeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState)
    {
        if (null === $this->beStrictAboutChangesToGlobalState && \is_bool($beStrictAboutChangesToGlobalState)) {
            $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState;
        }
    }

/**
     * @param bool $beStrictAboutChangesToGlobalState
     */


function assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = '')
{
    return Assert::assertXmlFileEqualsXmlFile(...\func_get_args());
}

/**
 * Asserts that two XML files are equal.
 *
 * @param string $expectedFile
 * @param string $actualFile
 * @param string $message
 */


public function __construct(Constraint $innerConstraint)
    {
        parent::__construct();
        $this->innerConstraint = $innerConstraint;
    }

/**
     * @param Constraint $innerConstraint
     */


protected function printIncompletes(TestResult $result)
    {
        $this->printDefects($result->notImplemented(), 'incomplete test');
    }

/**
     * @param TestResult $result
     */


public function testExtensionVersionOperatorLessThanEquals()
    {
    }

/**
     * @requires extension testExtOne <= 1.0
     */


public function testThree($dependency)
    {
        $this->assertSame(self::$dependency, $dependency);
    }

/**
     * @depends !clone testOne
     */


public function testAssertEqualsSucceeds($a, $b, $delta = 0.0, $canonicalize = false, $ignoreCase = false)
    {
        $this->assertEquals($a, $b, '', $delta, 10, $canonicalize, $ignoreCase);
    }

/**
     * @dataProvider equalProvider
     */


public static function validInvalidJsonDataprovider()
    {
        return [
            'error syntax in expected JSON' => ['{"Mascott"::}', '{"Mascott" : "Tux"}'],
            'error UTF-8 in actual JSON'    => ['{"Mascott" : "Tux"}', '{"Mascott" : :}'],
        ];
    }

/**
     * @return array<string, string[]>
     */


protected function assertConfigurationEquals(Configuration $expectedConfiguration, Configuration $actualConfiguration)
    {
        $this->assertEquals(
            $expectedConfiguration->getFilterConfiguration(),
            $actualConfiguration->getFilterConfiguration()
        );

        $this->assertEquals(
            $expectedConfiguration->getGroupConfiguration(),
            $actualConfiguration->getGroupConfiguration()
        );

        $this->assertEquals(
            $expectedConfiguration->getListenerConfiguration(),
            $actualConfiguration->getListenerConfiguration()
        );

        $this->assertEquals(
            $expectedConfiguration->getLoggingConfiguration(),
            $actualConfiguration->getLoggingConfiguration()
        );

        $this->assertEquals(
            $expectedConfiguration->getPHPConfiguration(),
            $actualConfiguration->getPHPConfiguration()
        );

        $this->assertEquals(
            $expectedConfiguration->getPHPUnitConfiguration(),
            $actualConfiguration->getPHPUnitConfiguration()
        );

        $this->assertEquals(
            $expectedConfiguration->getTestSuiteConfiguration()->tests(),
            $actualConfiguration->getTestSuiteConfiguration()->tests()
        );
    }

/**
     * Asserts that the values in $actualConfiguration equal $expectedConfiguration.
     *
     * @param Configuration $expectedConfiguration
     * @param Configuration $actualConfiguration
     */


public function log($level, $message, array $context = array())
    {
        // noop
    }

/**
     * Logs with an arbitrary level.
     *
     * @param mixed  $level
     * @param string $message
     * @param array  $context
     *
     * @return void
     */


public function getReadline()
    {
        if (!isset($this->readline)) {
            $className = $this->getReadlineClass();
            $this->readline = new $className(
                $this->getHistoryFile(),
                $this->getHistorySize(),
                $this->getEraseDuplicates()
            );
        }

        return $this->readline;
    }

/**
     * Get the Psy Shell readline service.
     *
     * By default, this service uses (in order of preference):
     *
     *  * GNU Readline
     *  * Libedit
     *  * A transient array-based readline emulation.
     *
     * @return Readline
     */


public function enterNode(Node $node)
    {
        if ($node instanceof Class_ || $node instanceof Trait_) {
            $this->inClass = true;
        } elseif ($node instanceof FuncCall && !$this->inClass) {
            // We'll give any args at all (besides null) a pass.
            // Technically we should be checking whether the args are objects, but this will do for now.
            //
            // @todo switch this to actually validate args when we get context-aware code cleaner passes.
            if (!empty($node->args) && !$this->isNull($node->args[0])) {
                return;
            }

            // We'll ignore name expressions as well (things like `$foo()`)
            if (!($node->name instanceof Name)) {
                return;
            }

            $name = \strtolower($node->name);
            if (\in_array($name, ['get_class', 'get_called_class'])) {
                $msg = \sprintf('%s() called without object from outside a class', $name);
                throw new ErrorException($msg, 0, E_USER_WARNING, null, $node->getLine());
            }
        }
    }

/**
     * @throws ErrorException if get_class or get_called_class is called without an object from outside a class
     *
     * @param Node $node
     */


protected function ensureClassOrInterfaceExists($name, $stmt)
    {
        if (!$this->classExists($name) && !$this->interfaceExists($name)) {
            throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt);
        }
    }

/**
     * Ensure that a referenced class _or interface_ exists.
     *
     * @throws FatalErrorException
     *
     * @param string $name
     * @param Stmt   $stmt
     */


public static function unvis($input)
    {
        $output = \preg_replace_callback(self::UNVIS_RX, 'self::unvisReplace', $input);
        // other escapes & octal are handled by stripcslashes
        return \stripcslashes($output);
    }

/**
     * Decodes a string encoded by libsd's strvis.
     *
     * From `man 3 vis`:
     *
     * Use an ‘M’ to represent meta characters (characters with the 8th bit set),
     * and use a caret ‘^’ to represent control characters (see iscntrl(3)).
     * The following formats are used:
     *
     *      \040    Represents ASCII space.
     *
     *      \240    Represents Meta-space (&nbsp in HTML).
     *
     *      \M-C    Represents character ‘C’ with the 8th bit set.
     *              Spans characters ‘\241’ through ‘\376’.
     *
     *      \M^C    Represents control character ‘C’ with the 8th bit set.
     *              Spans characters ‘\200’ through ‘\237’, and ‘\377’ (as ‘\M^?’).
     *
     *      \^C     Represents the control character ‘C’.
     *              Spans characters ‘\000’ through ‘\037’, and ‘\177’ (as ‘\^?’).
     *
     * The other formats are supported by PHP's stripcslashes,
     * except for the \s sequence (ASCII space).
     *
     * @param string $input The string to decode
     *
     * @return string
     */


public function getNode()
    {
        $node = hexdec(bin2hex(random_bytes(6)));

        // Set the multicast bit; see RFC 4122, section 4.5.
        $node = $node | 0x010000000000;

        return str_pad(dechex($node), 12, '0', STR_PAD_LEFT);
    }

/**
     * Returns the system node ID
     *
     * @return string System node ID as a hexadecimal string
     * @throws \Exception if it was not possible to gather sufficient entropy
     */


public function testAcceptsFails($expected, $actual)
    {
        $this->assertFalse(
          $this->comparator->accepts($expected, $actual)
        );
    }

/**
     * @covers       ::accepts
     * @dataProvider acceptsFailsProvider
     */


public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
    {
        $this->charReaderFactory = $factory;
    }

/**
     * Set the CharacterReaderFactory for multi charset support.
     */


public function clearAll($nsKey)
    {
        if (array_key_exists($nsKey, $this->keys)) {
            foreach ($this->keys[$nsKey] as $itemKey => $null) {
                $this->clearKey($nsKey, $itemKey);
            }
            if (is_dir($this->path.'/'.$nsKey)) {
                rmdir($this->path.'/'.$nsKey);
            }
            unset($this->keys[$nsKey]);
        }
    }

/**
     * Clear all data in the namespace $nsKey if it exists.
     *
     * @param string $nsKey
     */


public function addParameterizedHeader($name, $value = null, $params = [])
    {
        $this->storeHeader($name, $this->factory->createParameterizedHeader($name, $value, $params));
    }

/**
     * Add a new ParameterizedHeader with $name, $value and $params.
     *
     * @param string $name
     * @param string $value
     * @param array  $params
     */


public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt)
    {
        $transportName = get_class($evt->getSource());
        $this->logger->add(sprintf('++ Stopping %s', $transportName));
    }

/**
     * Invoked just before a Transport is stopped.
     */


public function __construct($signCertificate = null, $signPrivateKey = null, $encryptCertificate = null)
    {
        if (null !== $signPrivateKey) {
            $this->setSignCertificate($signCertificate, $signPrivateKey);
        }

        if (null !== $encryptCertificate) {
            $this->setEncryptCertificate($encryptCertificate);
        }

        $this->replacementFactory = Swift_DependencyContainer::getInstance()
            ->lookup('transport.replacementfactory');

        $this->signOptions = PKCS7_DETACHED;
        $this->encryptCipher = OPENSSL_CIPHER_AES_128_CBC;
    }

/**
     * Constructor.
     *
     * @param string|null $signCertificate
     * @param string|null $signPrivateKey
     * @param string|null $encryptCertificate
     */


protected function doMailFromCommand($address)
    {
        $address = $this->addressEncoder->encodeString($address);
        $handlers = $this->getActiveHandlers();
        $params = [];
        foreach ($handlers as $handler) {
            $params = array_merge($params, (array) $handler->getMailParams());
        }
        $paramStr = !empty($params) ? ' '.implode(' ', $params) : '';
        $this->executeCommand(
            sprintf("MAIL FROM:<%s>%s\r\n", $address, $paramStr), [250], $failures, true
            );
    }

/** Overridden to add Extension support */


public function getLastUsedTransport()
    {
        return $this->lastUsedTransport;
    }

/**
     * Get the Transport used in the last successful send operation.
     *
     * @return Swift_Transport
     */


public function getHandledKeyword()
    {
        return '8BITMIME';
    }

/**
     * Get the name of the ESMTP extension this handles.
     *
     * @return string
     */


public function getFormatter()
    {
        return $this->formatter;
    }


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


public function askQuestion(Question $question)
    {
        if ($this->input->isInteractive()) {
            $this->autoPrependBlock();
        }

        if (!$this->questionHelper) {
            $this->questionHelper = new SymfonyQuestionHelper();
        }

        $answer = $this->questionHelper->ask($this->input, $this, $question);

        if ($this->input->isInteractive()) {
            $this->newLine();
            $this->bufferedOutput->write("\n");
        }

        return $answer;
    }


public function getSpecificity()
    {
        return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
    }


public function getSelector()
    {
        return $this->selector;
    }

/**
     * @return NodeInterface
     */


public function testParseExceptions()
    {
        $converter = new CssSelectorConverter();
        $converter->toXPath('h1:');
    }

/**
     * @expectedException \Symfony\Component\CssSelector\Exception\ParseException
     * @expectedExceptionMessage Expected identifier, but <eof at 3> found.
     */


public function getExtension($name)
    {
        if (!isset($this->extensions[$name])) {
            throw new ExpressionErrorException(sprintf('Extension "%s" not registered.', $name));
        }

        return $this->extensions[$name];
    }

/**
     * @param string $name
     *
     * @return Extension\ExtensionInterface
     *
     * @throws ExpressionErrorException
     */


public function addSubscriberService($serviceId, $class)
    {
        @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);

        foreach ($class::getSubscribedEvents() as $eventName => $params) {
            if (\is_string($params)) {
                $this->listenerIds[$eventName][] = array($serviceId, $params, 0);
            } elseif (\is_string($params[0])) {
                $this->listenerIds[$eventName][] = array($serviceId, $params[0], isset($params[1]) ? $params[1] : 0);
            } else {
                foreach ($params as $listener) {
                    $this->listenerIds[$eventName][] = array($serviceId, $listener[0], isset($listener[1]) ? $listener[1] : 0);
                }
            }
        }
    }

/**
     * Adds a service as event subscriber.
     *
     * @param string $serviceId The service ID of the subscriber service
     * @param string $class     The service's class name (which must implement EventSubscriberInterface)
     */


public function __toString()
    {
        if (!$headers = $this->all()) {
            return '';
        }

        ksort($headers);
        $max = max(array_map('strlen', array_keys($headers))) + 1;
        $content = '';
        foreach ($headers as $name => $values) {
            $name = implode('-', array_map('ucfirst', explode('-', $name)));
            foreach ($values as $value) {
                $content .= sprintf("%-{$max}s %s\r\n", $name.':', $value);
            }
        }

        return $content;
    }

/**
     * Returns the headers as a string.
     *
     * @return string The headers
     */


public function getIterator()
    {
        return new \ArrayIterator($this->headers);
    }

/**
     * Returns an iterator for headers.
     *
     * @return \ArrayIterator An \ArrayIterator instance
     */


public function set($name, $value)
    {
        $this->getAttributeBag()->set($name, $value);
    }


public function all()
    {
        $return = $this->peekAll();
        $this->flashes = array();

        return $return;
    }


public function updateTimestamp($sessionId, $data)
    {
        return $this->handler instanceof \SessionUpdateTimestampHandlerInterface ? $this->handler->updateTimestamp($sessionId, $data) : $this->write($sessionId, $data);
    }


public function getCharset()
    {
        return 'UTF-8';
    }


public function process(ContainerBuilder $container)
    {
        if (!$container->has('services_resetter')) {
            return;
        }

        $services = $methods = array();

        foreach ($container->findTaggedServiceIds($this->tagName, true) as $id => $tags) {
            $services[$id] = new Reference($id, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE);
            $attributes = $tags[0];

            if (!isset($attributes['method'])) {
                throw new RuntimeException(sprintf('Tag %s requires the "method" attribute to be set.', $this->tagName));
            }

            $methods[$id] = $attributes['method'];
        }

        if (empty($services)) {
            $container->removeAlias('services_resetter');
            $container->removeDefinition('services_resetter');

            return;
        }

        $container->findDefinition('services_resetter')
            ->setArgument(0, new IteratorArgument($services))
            ->setArgument(1, $methods);
    }


public function testLocateResourceReturnsAllMatchesBis()
    {
        $kernel = $this->getKernel(array('getBundle'));
        $kernel
            ->expects($this->once())
            ->method('getBundle')
            ->will($this->returnValue(array(
                $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'),
                $this->getBundle(__DIR__.'/Foobar'),
            )))
        ;

        $this->assertEquals(
            array(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt'),
            $kernel->locateResource('@Bundle1Bundle/foo.txt', null, false)
        );
    }


public function testNegativeTimeoutFromSetter()
    {
        $p = $this->getProcess('');
        $p->setTimeout(-1);
    }

/**
     * @expectedException \Symfony\Component\Process\Exception\InvalidArgumentException
     */


public function getRegex()
    {
        return $this->regex;
    }

/**
     * Returns the regex.
     *
     * @return string The regex
     */


public function getCondition()
    {
        return $this->condition;
    }

/**
     * Returns the condition.
     *
     * @return string The condition
     */


public function setStyles(array $styles)
    {
        $this->headerIsDumped = false;
        $this->styles = $styles + $this->styles;
    }


public function testCastDateTime($time, $timezone, $xDate, $xTimestamp, $xInfos)
    {
        if ((\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID <= 50509) && preg_match('/[-+]\d{2}:\d{2}/', $timezone)) {
            $this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.');
        }

        $stub = new Stub();
        $date = new \DateTime($time, new \DateTimeZone($timezone));
        $cast = DateCaster::castDateTime($date, array('foo' => 'bar'), $stub, false, 0);

        $xDump = <<<EODUMP
array:1 [
  "\\x00~\\x00date" => $xDate
]
EODUMP;

        $this->assertDumpEquals($xDump, $cast);

        $xDump = <<<EODUMP
Symfony\Component\VarDumper\Caster\ConstStub {
  +type: 1
  +class: "$xDate"
  +value: "%A$xInfos%A"
  +cut: 0
  +handle: 0
  +refCount: 0
  +position: 0
  +attr: []
}
EODUMP;

        $this->assertDumpMatchesFormat($xDump, $cast["\0~\0date"]);
    }

/**
     * @dataProvider provideDateTimes
     */


public function getLine(): int {
        return $this->line;
    }


void BenchmarkVector()
{
	EASTLTest_Printf("Vector\n");

	EA::UnitTest::RandGenT<uint32_t> rng(EA::UnitTest::GetRandSeed());
	EA::StdC::Stopwatch              stopwatch1(EA::StdC::Stopwatch::kUnitsCPUCycles);
	EA::StdC::Stopwatch              stopwatch2(EA::StdC::Stopwatch::kUnitsCPUCycles);

	{
		eastl::vector<uint32_t> intVector(100000);
		eastl::generate(intVector.begin(), intVector.end(), rng);

		for(int i = 0; i < 2; i++)
		{
			StdVectorUint64 stdVectorUint64;
			EaVectorUint64  eaVectorUint64;

			///////////////////////////////
			// Test push_back
			///////////////////////////////

			TestPushBack(stopwatch1, stdVectorUint64, intVector);
			TestPushBack(stopwatch2, eaVectorUint64,  intVector);

			if(i == 1)
				Benchmark::AddResult("vector<uint64>/push_back", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());

			///////////////////////////////
			// Test operator[].
			///////////////////////////////

			TestBracket(stopwatch1, stdVectorUint64);
			TestBracket(stopwatch2, eaVectorUint64);

			if(i == 1)
				Benchmark::AddResult("vector<uint64>/operator[]", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());

			///////////////////////////////
			// Test iteration via find().
			///////////////////////////////

			TestFind(stopwatch1, stdVectorUint64);
			TestFind(stopwatch2, eaVectorUint64);
			TestFind(stopwatch1, stdVectorUint64);
			TestFind(stopwatch2, eaVectorUint64);

			if(i == 1)
				Benchmark::AddResult("vector<uint64>/iteration", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());

			///////////////////////////////
			// Test sort
			///////////////////////////////

			// Currently VC++ complains about our sort function decrementing std::iterator that is already at begin(). In the strictest sense,
			// that's a valid complaint, but we aren't testing std STL here. We will want to revise our sort function eventually.
			#if !defined(_MSC_VER) || !defined(_ITERATOR_DEBUG_LEVEL) || (_ITERATOR_DEBUG_LEVEL < 2)
				TestSort(stopwatch1, stdVectorUint64);
				TestSort(stopwatch2, eaVectorUint64);

				if(i == 1)
					Benchmark::AddResult("vector<uint64>/sort", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
			#endif

			///////////////////////////////
			// Test insert
			///////////////////////////////

			TestInsert(stopwatch1, stdVectorUint64);
			TestInsert(stopwatch2, eaVectorUint64);

			if(i == 1)
				Benchmark::AddResult("vector<uint64>/insert", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());

			///////////////////////////////
			// Test erase
			///////////////////////////////

			TestErase(stopwatch1, stdVectorUint64);
			TestErase(stopwatch2, eaVectorUint64);

			if(i == 1)
				Benchmark::AddResult("vector<uint64>/erase", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());

			///////////////////////////////////////////
			// Test move of MovableType
			// Should be much faster with C++11 move.
			///////////////////////////////////////////

			std::vector<MovableType>   stdVectorMovableType;
			eastl::vector<MovableType> eaVectorMovableType;

			TestMoveReallocate(stopwatch1, stdVectorMovableType);
			TestMoveReallocate(stopwatch2, eaVectorMovableType);

			if(i == 1)
				Benchmark::AddResult("vector<MovableType>/reallocate", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());

			TestMoveErase(stopwatch1, stdVectorMovableType);
			TestMoveErase(stopwatch2, eaVectorMovableType);

			if(i == 1)
				Benchmark::AddResult("vector<MovableType>/erase", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());

			///////////////////////////////////////////
			// Test move of AutoRefCount
			// Should be much faster with C++11 move.
			///////////////////////////////////////////

			std::vector<AutoRefCount<RefCounted> >   stdVectorAutoRefCount;
			eastl::vector<AutoRefCount<RefCounted> > eaVectorAutoRefCount;

			for(size_t a = 0; a < 2048; a++)
			{
				stdVectorAutoRefCount.push_back(AutoRefCount<RefCounted>(new RefCounted));
				eaVectorAutoRefCount.push_back(AutoRefCount<RefCounted>(new RefCounted));
			}

			RefCounted::msAddRefCount  = 0;
			RefCounted::msReleaseCount = 0;
			TestMoveErase(stopwatch1, stdVectorAutoRefCount);
			EASTLTest_Printf("vector<AutoRefCount>/erase std counts: %d %d\n", RefCounted::msAddRefCount, RefCounted::msReleaseCount);

			RefCounted::msAddRefCount  = 0;
			RefCounted::msReleaseCount = 0;
			TestMoveErase(stopwatch2, eaVectorAutoRefCount);
			EASTLTest_Printf("vector<AutoRefCount>/erase EA counts: %d %d\n", RefCounted::msAddRefCount, RefCounted::msReleaseCount);

			if(i == 1)
				Benchmark::AddResult("vector<AutoRefCount>/erase", stopwatch1.GetUnits(), stopwatch1.GetElapsedTime(), stopwatch2.GetElapsedTime());
		}
	}
}


bool wordBreak(string s, vector < string >& wordDict) {
        // Base case: an empty string can always be segmented (as no word is needed).
        if (s.empty()) return true;

        // If the result for the current 's' is already computed, return it to avoid recomputation.
        if (mp.find(s) != mp.end()) return mp[s];

        // Get the size of the word dictionary to use it in the loop.
        int n = wordDict.size();

        // Loop through the words in the dictionary to find a match with the beginning of 's'.
        for (int i = 0; i < n; i++) {
            // Check if the current word from the dictionary matches the start of 's'.
            if (wordDict[i] == s.substr(0, wordDict[i].length())) {
                // If there is a match, recursively check the rest of the string after removing the matched word.
                bool check = wordBreak(s.substr(wordDict[i].length()), wordDict);

                // If the rest of the string can be segmented, update the result for the current 's' to true.
                if (check)
                    return mp[s] = true;
            }
        }

        // If no match is found, update the result for the current 's' to false.
        return mp[s] = false;
    }

// The wordBreak function takes a string 's' and a vector of strings 'wordDict'.
// It returns true if the string 's' can be segmented into words from 'wordDict', false otherwise.

https://github.com/7oSkaaa/LeetCode_DailyChallenge_2023/blob/e00960b9f5cbfaf813572c366e16d4fef5fa6b8d/08- August/04- Word Break/04- Word Break (Ahmed Hossam).cpp#L9-L34


static ImGuiKey ImGui_ImplWin32_VirtualKeyToImGuiKey(WPARAM wParam)
{
    switch (wParam)
    {
        case VK_TAB: return ImGuiKey_Tab;
        case VK_LEFT: return ImGuiKey_LeftArrow;
        case VK_RIGHT: return ImGuiKey_RightArrow;
        case VK_UP: return ImGuiKey_UpArrow;
        case VK_DOWN: return ImGuiKey_DownArrow;
        case VK_PRIOR: return ImGuiKey_PageUp;
        case VK_NEXT: return ImGuiKey_PageDown;
        case VK_HOME: return ImGuiKey_Home;
        case VK_END: return ImGuiKey_End;
        case VK_INSERT: return ImGuiKey_Insert;
        case VK_DELETE: return ImGuiKey_Delete;
        case VK_BACK: return ImGuiKey_Backspace;
        case VK_SPACE: return ImGuiKey_Space;
        case VK_RETURN: return ImGuiKey_Enter;
        case VK_ESCAPE: return ImGuiKey_Escape;
        case VK_OEM_7: return ImGuiKey_Apostrophe;
        case VK_OEM_COMMA: return ImGuiKey_Comma;
        case VK_OEM_MINUS: return ImGuiKey_Minus;
        case VK_OEM_PERIOD: return ImGuiKey_Period;
        case VK_OEM_2: return ImGuiKey_Slash;
        case VK_OEM_1: return ImGuiKey_Semicolon;
        case VK_OEM_PLUS: return ImGuiKey_Equal;
        case VK_OEM_4: return ImGuiKey_LeftBracket;
        case VK_OEM_5: return ImGuiKey_Backslash;
        case VK_OEM_6: return ImGuiKey_RightBracket;
        case VK_OEM_3: return ImGuiKey_GraveAccent;
        case VK_CAPITAL: return ImGuiKey_CapsLock;
        case VK_SCROLL: return ImGuiKey_ScrollLock;
        case VK_NUMLOCK: return ImGuiKey_NumLock;
        case VK_SNAPSHOT: return ImGuiKey_PrintScreen;
        case VK_PAUSE: return ImGuiKey_Pause;
        case VK_NUMPAD0: return ImGuiKey_Keypad0;
        case VK_NUMPAD1: return ImGuiKey_Keypad1;
        case VK_NUMPAD2: return ImGuiKey_Keypad2;
        case VK_NUMPAD3: return ImGuiKey_Keypad3;
        case VK_NUMPAD4: return ImGuiKey_Keypad4;
        case VK_NUMPAD5: return ImGuiKey_Keypad5;
        case VK_NUMPAD6: return ImGuiKey_Keypad6;
        case VK_NUMPAD7: return ImGuiKey_Keypad7;
        case VK_NUMPAD8: return ImGuiKey_Keypad8;
        case VK_NUMPAD9: return ImGuiKey_Keypad9;
        case VK_DECIMAL: return ImGuiKey_KeypadDecimal;
        case VK_DIVIDE: return ImGuiKey_KeypadDivide;
        case VK_MULTIPLY: return ImGuiKey_KeypadMultiply;
        case VK_SUBTRACT: return ImGuiKey_KeypadSubtract;
        case VK_ADD: return ImGuiKey_KeypadAdd;
        case IM_VK_KEYPAD_ENTER: return ImGuiKey_KeypadEnter;
        case VK_LSHIFT: return ImGuiKey_LeftShift;
        case VK_LCONTROL: return ImGuiKey_LeftCtrl;
        case VK_LMENU: return ImGuiKey_LeftAlt;
        case VK_LWIN: return ImGuiKey_LeftSuper;
        case VK_RSHIFT: return ImGuiKey_RightShift;
        case VK_RCONTROL: return ImGuiKey_RightCtrl;
        case VK_RMENU: return ImGuiKey_RightAlt;
        case VK_RWIN: return ImGuiKey_RightSuper;
        case VK_APPS: return ImGuiKey_Menu;
        case '0': return ImGuiKey_0;
        case '1': return ImGuiKey_1;
        case '2': return ImGuiKey_2;
        case '3': return ImGuiKey_3;
        case '4': return ImGuiKey_4;
        case '5': return ImGuiKey_5;
        case '6': return ImGuiKey_6;
        case '7': return ImGuiKey_7;
        case '8': return ImGuiKey_8;
        case '9': return ImGuiKey_9;
        case 'A': return ImGuiKey_A;
        case 'B': return ImGuiKey_B;
        case 'C': return ImGuiKey_C;
        case 'D': return ImGuiKey_D;
        case 'E': return ImGuiKey_E;
        case 'F': return ImGuiKey_F;
        case 'G': return ImGuiKey_G;
        case 'H': return ImGuiKey_H;
        case 'I': return ImGuiKey_I;
        case 'J': return ImGuiKey_J;
        case 'K': return ImGuiKey_K;
        case 'L': return ImGuiKey_L;
        case 'M': return ImGuiKey_M;
        case 'N': return ImGuiKey_N;
        case 'O': return ImGuiKey_O;
        case 'P': return ImGuiKey_P;
        case 'Q': return ImGuiKey_Q;
        case 'R': return ImGuiKey_R;
        case 'S': return ImGuiKey_S;
        case 'T': return ImGuiKey_T;
        case 'U': return ImGuiKey_U;
        case 'V': return ImGuiKey_V;
        case 'W': return ImGuiKey_W;
        case 'X': return ImGuiKey_X;
        case 'Y': return ImGuiKey_Y;
        case 'Z': return ImGuiKey_Z;
        case VK_F1: return ImGuiKey_F1;
        case VK_F2: return ImGuiKey_F2;
        case VK_F3: return ImGuiKey_F3;
        case VK_F4: return ImGuiKey_F4;
        case VK_F5: return ImGuiKey_F5;
        case VK_F6: return ImGuiKey_F6;
        case VK_F7: return ImGuiKey_F7;
        case VK_F8: return ImGuiKey_F8;
        case VK_F9: return ImGuiKey_F9;
        case VK_F10: return ImGuiKey_F10;
        case VK_F11: return ImGuiKey_F11;
        case VK_F12: return ImGuiKey_F12;
        default: return ImGuiKey_None;
    }
}


void MouseCursor::updateMouseClipping()
{
	BW_GUARD;
	if (SimpleGUI::pInstance() != NULL)
	{
		clipCursorToWindow( SimpleGUI::instance().mouseCursor().clipped() );
	}
}

/**
 *	Does a per-frame update of the mouse clipping. It is done per frame rather
 *	than just clipping/unclipping in setFocus because it allows nicer behaviour
 *	when refocusing the window with the mouse while the cursor is clicked.
 */
/*static*/


void SimpleGUI::hwnd( void * h )
{
	hwnd_ = h;
}

/**
 *	This method sets the HWND for the main application window.
 *	SimpleGUI needs this only if the mouse cursor is to be used.
 *
 *	@param h	The HWND for the application
 */


bool SimpleGUIComponent::handleDropEvent( SimpleGUIComponent * dragged,
		const KeyEvent & event )
{
	BW_GUARD;
	return this->invokeMouseEventHandler(
		this->pScriptObject_.getObject(),
		"handleDropEvent", event.cursorPosition(), dragged,
		"SimpleGUIComponent::handleDropEvent: ",
		"EventsSimpleGUIComponent handleDropEvent retval" );
}

/*~ function SimpleGUIComponent.handleDropEvent
 *	@components{ client, tools }
 *
 *	This event handler is triggered a dragged component is dropped overa drop
 *	accepting component. To have this handler triggered, a component must have
 *	dropFocus enabled.
 *
 *	@param	component	The drop target component.
 *	@param	position	mouse position, 2-tuple (x, y).
 *	@param	dropped		The dragged component being dropped.
 *
 *	@return	the return value is always ignored.
 */


void ChunkItemBase::addBorrower( Chunk* pChunk )
{
	borrowers_.insert( pChunk );

#if UMBRA_ENABLE
	if (pUmbraDrawItem_)
	{
		if (this->chunk()->getUmbraCell() == NULL &&
			pChunk->getUmbraCell() != NULL)
		{
			pUmbraDrawItem_->updateCell( pChunk->getUmbraCell() );
		}
	}
#endif // UMBRA_ENABLE
}

// MF_SERVER
/**
 *	This method adds a chunk as a borrower of this item
 *	what this means is that the ChunkItem overlaps this chunk
 *	as well, which means we need to render as part of this chunk
 *	if it exists in a different umbra cell to our own cell
 *	@param pChunk the chunk that is borrowing us
 */


void UmbraChunkItem::init( ChunkItem* pItem, UmbraObjectProxyPtr pObject, const Matrix& transform, Umbra::OB::Cell* pCell )
{
	pItem_ = pItem;

	pObject_ = pObject;
	pObject_->object()->setCell( pCell );
	pObject_->object()->setObjectToCellMatrix( (const Umbra::Matrix4x4&)transform );
	pObject_->object()->setUserPointer( (void*)this );
	pObject_->object()->setBitmask( ChunkUmbra::SCENE_OBJECT );
}

/**
 *	This method inits the UmbraChunkItem
 *	It uses the passed in umbra object
 *	@param pItem the chunk item to use
 *	@param pObject the umbra ubject to use
 *	@param transform the transform of the bounding box
 *	@param pCell the umbra cell to place this item in
 */


bool AssetList::empty() const
{
	return entries_.empty();
}


BinaryFormat::BinaryFormat() :
	pHeader_(NULL),
	pSectionHeaders_(NULL)
{
	memset( &mappedSections_, 0, sizeof(mappedSections_) );
}


void ParticleSystemWriter::addFromChunkParticles(
	const DataSectionPtr& pDS,
	const Matrix& chunkTransform,
	StringTableWriter& stringTable,
	AssetListWriter& assetList )
{
	BW::string resourceID = pDS->readString( "resource" );
	if (resourceID.empty())
	{
		return;
	}

	if (resourceID.find( '/' ) == BW::string::npos)
	{
		resourceID = "particles/" + resourceID;
	}

	DataSectionPtr resourceDS = BWResource::openSection( resourceID );
	if (!resourceDS)
	{
		return;
	}

	// ok, we're committed to loading now.
	ParticleSystemTypes::ParticleSystem data;
	memset( &data, 0, sizeof(data) );

	data.resourceID_ = assetList.addAsset(
		CompiledSpace::AssetListTypes::ASSET_TYPE_DATASECTION,
		resourceID, stringTable );
	data.seedTime_ = resourceDS->readFloat( "seedTime", 0.1f );
	bool isReflectionVisible = pDS->readBool( "reflectionVisible",
		false );

	if (isReflectionVisible)
	{
		data.flags_ |= ParticleSystemTypes::FLAG_REFLECTION_VISIBLE;
	}

	// Transform
	data.worldTransform_ = chunkTransform;
	data.worldTransform_.preMultiply(
		pDS->readMatrix34( "transform", Matrix::identity ) );

	systemData_.push_back( data );
}


void ReplayController::handleFinal()
{
	handler_.onReplayControllerFinish( *this );
}

/**
 *	This method handles the 'finish' replay message, indicating end of replay.
 */


bool Profiler::setNewHistory( const char * historyFileName,
							const char * threadName, BW::string * msgString)
{
	BW_GUARD;
	this->setProfileMode( SORT_BY_NAME, false );

	return csvOutputTask_->setNewHistory( historyFileName,
		threadName, msgString );
}

/**
 *	Set up a new file for CSV profiling output.
 */


void queueWrites()
	{
		for (uint32 i = 1; i <= max_; ++i)
		{
			pWriter_->queueWriteBlob( (const char *)&i, sizeof( i ), i );
		}
	}

/**
	 *	This method queues the writes necessary to write out the integers.
	 */


int PyModel::pySet_motors( PyObject * value )
{
	BW_GUARD;
	// first check arguments...
	if (!PySequence_Check( value ))
	{
		PyErr_SetString( PyExc_TypeError,
			"Model.motors must be set to a sequence of Motors" );
		return -1;
	}

	// ... thoroughly
	bool bad = false;
	for (int i = 0; i < PySequence_Size( value ) && !bad; i++)
	{
		PyObject * pTry = PySequence_GetItem( value, i );

		if (!Motor::Check( pTry ))
		{
			PyErr_Format( PyExc_TypeError, "Element %d of sequence replacing "
				" Model.motors is not a Motor", i );
			bad = true;
		}
		else if (((Motor*)pTry)->pOwner() != NULL)
		{
			PyErr_Format( PyExc_ValueError, "Element %d of sequence replacing "
				"Model.motors is already attached to a Model", i );
			bad = true;
		}

		Py_DECREF( pTry );
	}
	if (bad) return -1;

	// let old motors go
	for (uint i = 0; i < motors_.size(); i++)
	{
		motors_[i]->detach();
		Py_DECREF( motors_[i] );
	}
	motors_.clear();

	// fit new ones
	for (int i = 0; i < PySequence_Size( value ) && !bad; i++)
	{
		Motor * pMotor = (Motor*)PySequence_GetItem( value, i );

		pMotor->attach( this );
		motors_.push_back( pMotor );
		// We keep the reference returned by PySequence_GetItem.
	}

	return 0;
}


bool FixedDictDataType::getDefaultValue( DataSink & output ) const
{
#if defined( SCRIPT_PYTHON )
	const_cast<FixedDictDataType*>(this)->initCustomClassImplOnDemand();
#endif

	if (pDefaultSection_)
	{
		return this->createFromSection( pDefaultSection_, output );
	}
	else if (allowNone_)
	{
		return output.writeNone( /* isNone */ true );
	}

	// TODO: Better than this.
	ScriptObject pDefault = this->createDefaultInstance();
#if defined( SCRIPT_PYTHON )
	if (this->hasCustomClass())
		pDefault = this->createCustomClassFromInstance(
			static_cast<PyFixedDictDataInstance*>(pDefault.get()) );
#endif

	// Eww...
	ScriptDataSink & scriptOutput = static_cast< ScriptDataSink & >( output );
	return scriptOutput.write( pDefault );
}

/**
 *	Overrides the DataType method.
 *
 *	@see DataType::getDefaultValue
 */


ScriptObject FixedDictDataType::attach( ScriptObject pObject,
	PropertyOwnerBase * pOwner, int ownerRef )
{
#if defined( SCRIPT_PYTHON )
	// if it's None and that's ok, just return that
	if (allowNone_ && pObject.isNone())
	{
		return ScriptObject::none();
	}

	initCustomClassImplOnDemand();

	if (this->hasCustomClass())
	{
		// First part of isSameType() check
		if (this->hasCustomIsSameType() && !this->isSameTypeCustom( pObject ))
		{
			ERROR_MSG( "FixedDictDataType::attach: "
					"Trying to attach an invalid custom type\n" );
			return ScriptObject();
		}

		// See if they are referencing our PyFixedDictDataInstance
		ScriptObject pDict = this->getDictFromCustomClass( pObject );

		// Second part of isSameType() check
		if (PyFixedDictDataInstance::isSameType( pDict, *this ))
		{
			// Yay! isSameType() == true
			PyFixedDictDataInstancePtr pInst( pDict );
			if (pInst->hasOwner())
			{
				// Create copy
				pInst = PyFixedDictDataInstancePtr(
					new PyFixedDictDataInstance( this, *pInst ),
					PyFixedDictDataInstancePtr::FROM_NEW_REFERENCE );
				pInst->setOwner( pOwner, ownerRef );
				return this->createCustomClassFromInstance( pInst.get() );
			}
			else
			{
				pInst->setOwner( pOwner, ownerRef );
				return pObject;
			}
		}
		else	// not referencing PyFixedDictDataInstance
		{
			// Third part of isSameType() check, for custom class without
			// isSameType() method and doesn't reference PyFixedDictDataInstance
			if (this->hasCustomIsSameType() ||
				this->createInstanceFromMappingObj( pDict ))
			{
				return pObject;
			}
			else
			{
				return ScriptObject();
			}
		}
	}

	PyFixedDictDataInstancePtr pInst;

	// it's easy if it's the right python + entitydef type
	if (PyFixedDictDataInstance::isSameType( pObject, *this ))
	{
		pInst = pObject;
		if (pInst->hasOwner())
		{
			// Create copy
			pInst = PyFixedDictDataInstancePtr(
				new PyFixedDictDataInstance( this, *pInst ),
				PyFixedDictDataInstancePtr::FROM_NEW_REFERENCE );
			// note: up to caller to check that prop isn't being set back
		}
	}
	else
	{
		pInst = this->createInstanceFromMappingObj( pObject );
	}

	if (pInst)
	{
		pInst->setOwner( pOwner, ownerRef );
	}

	return pInst;
#else
	return pObject;
#endif
}

/**
 *	Overrides the DataType method.
 *
 *	@see DataType::attach
 */


bool GizmoManager::click()
{
	BW_GUARD;

	if (intersectedGizmo_.hasObject())
	{
		intersectedGizmo_->click(lastWorldOrigin_, lastWorldRay_);
		return true;
	}
	return false;
}

/**
 * This method should be called when the user clicks on a gizmo
 */


OmniLight::OmniLight( const D3DXCOLOR& colour, const Vector3& position, float innerRadius, float outerRadius )
: position_( position ),
  innerRadius_( innerRadius ),
  outerRadius_( outerRadius ),
  colour_( (const Colour&)colour ),
  priority_( 0 )
#ifdef EDITOR_ENABLED
  ,multiplier_(1.f)
#endif
{
	// give the worldTransformed attributes default values.
	worldPosition_ = position;
	worldInnerRadius_= innerRadius;
	worldOuterRadius_= outerRadius;
}


bool DynamicShadow::recreateForD3DExDevice() const
    {
        return true;
    }