PHP 8.3.31
Preview: Position.php Size: 1.40 KB
/proc/self/root/home/getspomw/itechservicellc.com/vendor/sabberworm/php-css-parser/src/Position/Position.php

<?php

declare(strict_types=1);

namespace Sabberworm\CSS\Position;

/**
 * Provides a standard reusable implementation of `Positionable`.
 *
 * @internal
 *
 * @phpstan-require-implements Positionable
 */
trait Position
{
    /**
     * @var int<1, max>|null
     */
    protected $lineNumber;

    /**
     * @var int<0, max>|null
     */
    protected $columnNumber;

    /**
     * @return int<1, max>|null
     */
    public function getLineNumber()
    {
        return $this->lineNumber;
    }

    /**
     * @return int<0, max>
     */
    public function getLineNo()
    {
        $lineNumber = $this->getLineNumber();

        return $lineNumber !== null ? $lineNumber : 0;
    }

    /**
     * @return int<0, max>|null
     */
    public function getColumnNumber()
    {
        return $this->columnNumber;
    }

    /**
     * @return int<0, max>
     */
    public function getColNo()
    {
        $columnNumber = $this->getColumnNumber();

        return $columnNumber !== null ? $columnNumber : 0;
    }

    /**
     * @param int<0, max>|null $lineNumber
     * @param int<0, max>|null $columnNumber
     */
    public function setPosition($lineNumber, $columnNumber = null)
    {
        // The conditional is for backwards compatibility (backcompat); `0` will not be allowed in future.
        $this->lineNumber = $lineNumber !== 0 ? $lineNumber : null;
        $this->columnNumber = $columnNumber;
    }
}

Directory Contents

Dirs: 0 × Files: 2

Name Size Perms Modified Actions
1.40 KB lrw-r--r-- 2025-10-28 20:23:30
Edit Download
1.17 KB lrw-r--r-- 2025-10-28 20:23:30
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).