Write a PHP scope resolution operator (::) in the current stream.

@throws StreamAccessException If an error occurs while writing the scope resolution operator.
178532
public function writeScopeResolution()
    {
        try {
            $this->getStream()->write('::');
        } catch (StreamException $e) {
            $msg = "An error occured while writing a scope resolution operator (::).";
            throw new StreamAccessException($msg, $this, 0, $e);
        }
    }
950891
public function process()
    {
        $operands = $this->getOperands();

        if ($operands->containsNull() === true) {
            return null;
        }

        if ($operands->exclusivelySingle() === false) {
            $msg = "The Equal operator only accepts operands with a single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->exclusivelyNumeric() === false) {
            $msg = "The Equal operator only accepts operands with an integer or float baseType";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $operand1 = $operands[0];
        $operand2 = $operands[1];
        $expression = $this->getExpression();

        if ($expression->getToleranceMode() === ToleranceMode::EXACT) {
            return new QtiBoolean($operand1->getValue() == $operand2->getValue());
        } else {
            $tolerance = $expression->getTolerance();

            if (gettype($tolerance[0]) === 'string') {
                $strTolerance = $tolerance;
                $tolerance = array();

                // variableRef to handle.
                $state = $this->getState();
                $tolerance0Name = Utils::sanitizeVariableRef($strTolerance[0]);
                $varValue = $state[$tolerance0Name];

                if (is_null($varValue)) {
                    $msg = "The variable with name '${tolerance0Name}' could not be resolved.";
                    throw new OperatorProcessingException($msg, $this, OperatorProcessingException::NONEXISTENT_VARIABLE);
                } elseif (!$varValue instanceof QtiFloat) {
                    $msg = "The variable with name '${tolerance0Name}' is not a float.";
                    throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_VARIABLE_BASETYPE);
                }

                $tolerance[] = $varValue->getValue();

                if (isset($strTolerance[1]) && gettype($strTolerance[1]) === 'string') {
                    // A second variableRef to handle.
                    $tolerance1Name = Utils::sanitizeVariableRef($strTolerance[1]);

                    if (($varValue = $state[$tolerance1Name]) !== null && $varValue instanceof QtiFloat) {
                        $tolerance[] = $varValue->getValue();
                    }
                }
            }

            if ($expression->getToleranceMode() === ToleranceMode::ABSOLUTE) {

                $t0 = $operand1->getValue() - $tolerance[0];
                $t1 = $operand1->getValue() + ((isset($tolerance[1])) ? $tolerance[1] : $tolerance[0]);

                $moreThanLower = ($expression->doesIncludeLowerBound()) ? $operand2->getValue() >= $t0 : $operand2->getValue() > $t0;
                $lessThanUpper = ($expression->doesIncludeUpperBound()) ? $operand2->getValue() <= $t1 : $operand2->getValue() < $t1;

                return new QtiBoolean($moreThanLower && $lessThanUpper);
            } else {
                // Tolerance mode RELATIVE
                $tolerance = $expression->getTolerance();
                $t0 = $operand1->getValue() * (1 - $tolerance[0] / 100);
                $t1 = $operand1->getValue() * (1 + ((isset($tolerance[1])) ? $tolerance[1] : $tolerance[0]) / 100);

                $moreThanLower = ($expression->doesIncludeLowerBound()) ? $operand2->getValue() >= $t0 : $operand2->getValue() > $t0;
                $lessThanUpper = ($expression->doesIncludeUpperBound()) ? $operand2->getValue() <= $t1 : $operand2->getValue() < $t1;

                return new QtiBoolean($moreThanLower && $lessThanUpper);
            }
        }
    }
762344
public function marshall()
    {
        $ctx = $this->getContext();
        $streamAccess = $ctx->getStreamAccess();

        try {
            $scalar = $this->getToMarshall();
            $varName = $this->getContext()->generateVariableName($scalar);

            $streamAccess->writeVariable($varName);
            $streamAccess->writeEquals($ctx->mustFormatOutput());
            $streamAccess->writeScalar($scalar);
            $streamAccess->writeSemicolon($ctx->mustFormatOutput());

            $ctx->pushOnVariableStack($varName);
        } catch (StreamAccessException $e) {
            $msg = "An error occured while marshalling the scalar value '${scalar}'.";
            throw new PhpMarshallingException($msg, PhpMarshallingException::STREAM, $e);
        }
    }
478401
public function writeVarint(Stream $stream, $value)
    {
        // Small values do not need to be encoded
        if ($value >= 0 && $value < 0x80) {
            $this->writeByte($stream, $value);

            return;
        }

        $values = null;

        // Build an array of bytes with the encoded values
        if ($value > 0) {
            $values = [];

            while ($value > 0) {
                $values[] = 0x80 | ($value & 0x7f);
                $value    = $value >> 7;
            }
        }

        if ($values === null) {
            $values = $this->negativeEncoder->encodeVarint($value);
        }

        // Remove the MSB flag from the last byte
        $values[count($values) - 1] &= 0x7f;

        // Convert the byte sized ints to actual bytes in a string
        $values = array_merge(['C*'], $values);
        $bytes  = call_user_func_array('pack', $values);

        $this->writeBytes($stream, $bytes);
    }
725677
protected function writeToIPCSegment()
    {
        if (shmop_read($this->internalSemaphoreKey, 1, 1) === 1) {
            return;
        }

        $serialized_IPC_array = serialize($this->internalIPCArray);
        $shm_bytes_written = shmop_write($this->internalIPCKey, $serialized_IPC_array, 0);

        if ($shm_bytes_written !== strlen($serialized_IPC_array)) {
            throw new Exception(
                'Fatal exception writing SHM segment (shmop_write)'.strlen($serialized_IPC_array).
                '-'.shmop_size($this->internalIPCKey)
            );
        }
    }
857661
@Override
  public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    request.writeTo(out);

    if (filteringAliases == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      out.writeStringArray(filteringAliases);
    }
  }
57317
public static function afterExpressionAnalysis(
        PhpParser\Node\Expr $expr,
        Context $context,
        StatementsSource $statements_source,
        Codebase $codebase,
        array &$file_replacements = []
    ) {
        if ($expr instanceof PhpParser\Node\Expr\Assign
            && isset($expr->inferredType)
            && $expr->inferredType->hasFloat()
        ) {
            if (\Psalm\IssueBuffer::accepts(
                new NoFloatAssignment(
                    'Don’t assign to floats',
                    new CodeLocation($statements_source, $expr)
                ),
                $statements_source->getSuppressedIssues()
            )) {
                // fall through
            }
        }
    }
881132
public function writeSpace()
    {
        try {
            $this->getStream()->write(' ');
        } catch (StreamException $e) {
            $msg = "An error occured while writing a white space ( ).";
            throw new StreamAccessException($msg, $this, 0, $e);
        }
    }
1351760
function process( $tpl, &$value, $nspace, $current_nspace )
    {
        $named_params = array();
        $param_list = $tpl->operatorParameterList( $this->Name );
        $i = 0;
        foreach ( $param_list as $param_name => $param_type )
        {
            if ( !isset( $this->Params[$i] ) or
                 $this->Params[$i]["type"] == "null" )
            {
                if ( $param_type["required"] )
                {
                    $tpl->warning( "eZTemplateOperatorElement", "Parameter '$param_name' ($i) missing" );
                    $named_params[$param_name] = $param_type["default"];
                }
                else
                {
                    $named_params[$param_name] = $param_type["default"];
                }
            }
            else
            {
                $param_data = $this->Params[$i];
                $named_params[$param_name] = $tpl->elementValue( $param_data, $nspace );
            }
            ++$i;
        }
        if ( $param_list !== null )
            $tpl->doOperator( $this, $nspace, $current_nspace, $value, $this->Name, $this->Params, $named_params );
        else
            $tpl->doOperator( $this, $nspace, $current_nspace, $value, $this->Name, $this->Params );
    }
410081
public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string
    {
        if (1 !== preg_match(self::$filePattern, $filePath)) {
            return $this->decoratedScoper->scope($filePath, $contents, $prefix, $patchers, $whitelist);
        }

        $decodedJson = json_decode($contents);

        $decodedJson = $this->prefixLockPackages((array) $decodedJson, $prefix, $whitelist);

        return json_encode(
            $decodedJson,
            JSON_PRETTY_PRINT
        );
    }
711935
private Object readResolve() throws ObjectStreamException {
		Constructor<?> compatible = null;
		for (final Constructor<?> candidate : this.proxyType.getDeclaredConstructors()) {
			if (candidate != null && isCompatible(candidate)) {
				if (compatible != null) {
					throw new IllegalStateException();
				}
				compatible = candidate;
			}
		}
		if (compatible != null) {
			if (!compatible.isAccessible()) {
				compatible.setAccessible(true);
			}
			try {
				final Object[] arguments = new Object[this.values.length + 1];
				System.arraycopy(this.values, 0, arguments, 1, this.values.length);
				return compatible.newInstance(arguments);
			} catch (Exception exception) {
				throw new WriteAbortedException(exception.getLocalizedMessage(), exception);
			}
		}
		throw new InvalidClassException("compatible constructor not found"); //$NON-NLS-1$
	}
1210530
public function writeClosingParenthesis()
    {
        try {
            $this->getStream()->write(')');
        } catch (StreamException $e) {
            $msg = "An error occured while writing a closing parenthesis ()).";
            throw new StreamAccessException($msg, $this, 0, $e);
        }
    }
234659
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $methodProperties = $phpcsFile->getMethodProperties($stackPtr);
        if ($methodProperties['scope'] !== 'public') {
            return;
        }

        parent::process($phpcsFile, $stackPtr);
    }
46682
function _stream_seek($offset, $whence)
    {
        switch ($whence) {
            case SEEK_SET:
                if ($offset >= $this->size || $offset < 0) {
                    return false;
                }
                break;
            case SEEK_CUR:
                $offset+= $this->pos;
                break;
            case SEEK_END:
                $offset+= $this->size;
        }

        $this->pos = $offset;
        $this->eof = false;
        return true;
    }
1285284
private void writeCachedResultToStream(HttpServletResponse res) throws IOException {

        List<Object> elements = m_cachedEntry.elements();
        int count = 0;
        if (elements != null) {
            for (int i = 0; i < elements.size(); i++) {
                Object o = elements.get(i);
                if (o instanceof byte[]) {
                    res.getOutputStream().write((byte[])o);
                } else {
                    if ((m_includeResults != null) && (m_includeResults.size() > count)) {
                        // make sure that we don't run behind end of list (should never happen, though)
                        res.getOutputStream().write(m_includeResults.get(count));
                        count++;
                    }
                    // skip next entry, which is the parameter map for this include call
                    i++;
                    // skip next entry, which is the attribute map for this include call
                    i++;
                }
            }
        }
961511
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
    {
        $methodName = $phpcsFile->getDeclarationName($stackPtr);
        if ($methodName === null) {
            // Ignore closures.
            return;
        }

        $className = $phpcsFile->getDeclarationName($currScope);

        // Is this a magic method. i.e., is prefixed with "__"?
        if (preg_match('|^__[^_]|', $methodName) !== 0) {
            $magicPart = strtolower(substr($methodName, 2));
            if (isset(Common::$magicMethods[$magicPart]) === false) {
                $errorData = array($className.'::'.$methodName);
                $error     = 'Method name "%s" is invalid; only PHP magic methods should be prefixed with a double underscore';
                $phpcsFile->addError($error, $stackPtr, 'MethodDoubleUnderscore', $errorData);
            }

            return;
        }

        // Get the method name without underscore prefix if it exists.
        if (strrpos($methodName, '_') === 0) {
            $namePart = substr($methodName, 1);
        } else {
            $namePart = $methodName;
        }

        // Naming check.
        if (Common::isCamelCaps($namePart, false, true, false) === false) {
            $errorData = array($methodName);
            $error     = 'Method "%s" must be lowerCamelCase';
            $phpcsFile->addError($error, $stackPtr, 'MethodNotLowerCamelCase', $errorData);
        }

        // Methods must not be prefixed with an underscore except those in publicMethodNames.
        if (strrpos($methodName, '_') === 0) {
            if (isset(Common::$publicMethodNames[$methodName]) === false) {
                $methodProps = $phpcsFile->getMethodProperties($stackPtr);
                $scope       = $methodProps['scope'];
                $errorData   = array($className.'::'.$methodName);
                $error       = ucfirst($scope).' method "%s" must not be prefixed with an underscore';
                $phpcsFile->addError($error, $stackPtr, 'MethodMustNotHaveUnderscore', $errorData);
            }
        }

        // Warn if method name is over 50 chars.
        $warningLimit = 50;
        if (strlen($methodName) > $warningLimit) {
            $errorData = array(
                          $methodName,
                          $warningLimit,
                         );

            $warning = 'Method "%s" is over "%s" chars';
            $phpcsFile->addWarning($warning, $stackPtr, 'MethodNameIsLong', $errorData);
        }

    }
329282
public function writeByteStream(Stream $stream, Stream $value)
    {
        $length = $value->getSize();

        $value->seek(0);
        $this->writeVarint($stream, $length);
        $stream->writeStream($value, $length);
    }