# ivyforms/1.4/backend/src/Services/Form/Style/CssBuilder.php

The Innovative Form Builder – IvyForms, version 1.4. 69 lines.

- Page: https://pluginprobe.com/plugins/ivyforms/1.4/code/backend/src/Services/Form/Style/CssBuilder.php
- Raw: https://pluginprobe.com/plugins/ivyforms/1.4/raw/backend/src/Services/Form/Style/CssBuilder.php
- Modified: 2026-05-06T08:31:02+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ivyforms/1.4/code/backend/src/Services/Form/Style/CssBuilder.php#L10-L20`.

```php
<?php

/**
 * @copyright © Melograno Venture Studio. All rights reserved.
 * @licence   See LICENCE.md for license details.
 */

namespace IvyForms\Services\Form\Style;

// phpcs:disable PSR1.Files.SideEffects
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

/**
 * Class CssBuilder
 *
 * Helper for building CSS rules
 *
 * @package IvyForms\Services\Form\StyleHelpers
 */
class CssBuilder
{
    /**
     * @var string[]
     */
    private array $css = [];

    /**
     * Add a CSS rule block
     *
     * @param string|string[] $selectors
     * @param string[] $properties
     * @return void
     */
    public function addRule($selectors, array $properties): void
    {
        if (empty($properties)) {
            return;
        }

        $selectorString = is_array($selectors) ? implode(',', $selectors) : $selectors;
        $this->css[] = $selectorString . ' {';
        $this->css = array_merge($this->css, $properties);
        $this->css[] = '}';
    }

    /**
     * Add raw CSS lines
     *
     * @param string[] $lines
     * @return void
     */
    public function addLines(array $lines): void
    {
        $this->css = array_merge($this->css, $lines);
    }

    /**
     * Get the generated CSS
     *
     * @return string
     */
    public function build(): string
    {
        return implode("\n", $this->css);
    }
}

```
