<?php
/**
 * @package         Tassos Code Snippets
 * @version         1.0.1-RC2 Free
 *
 * @author          Tassos Marinos <info@tassos.gr>
 * @link            https://www.tassos.gr
 * @copyright       Copyright © 2026 Tassos Marinos All Rights Reserved
 * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
 */

namespace Tassos\CodeSnippets\Administrator\Snippet;

/**
 * JavaScript File Snippet
 * 
 * Returns the URLs from the code field (one per line).
 * The Location class handles how to inject them (script tags or WebAsset).
 */
class JsFileSnippet extends Snippet
{
    /**
     * Display color used for the snippet (hex).
     *
     * @var string
     */
    protected $color = '#e5a329';
    
    /**
     * Run the snippet - returns the URLs
     *
     * @return string|null The URLs (one per line) or null if empty
     */
    public function run()
    {
        $urls = $this->snippet->code ?? '';
        return empty(trim($urls)) ? null : $urls;
    }
}
