Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   1  <?php
   2  
   3  namespace ScssPhp\ScssPhp\Exception;
   4  
   5  /**
   6   * An exception thrown by SassScript.
   7   *
   8   * This class does not implement SassException on purpose, as it should
   9   * never be returned to the outside code. The compilation will catch it
  10   * and replace it with a SassException reporting the location of the
  11   * error.
  12   */
  13  class SassScriptException extends \Exception
  14  {
  15      /**
  16       * Creates a SassScriptException with support for an argument name.
  17       *
  18       * This helper ensures a consistent handling of argument names in the
  19       * error message, without duplicating it.
  20       *
  21       * @param string      $message
  22       * @param string|null $name    The argument name, without $
  23       *
  24       * @return SassScriptException
  25       */
  26      public static function forArgument($message, $name = null)
  27      {
  28          $varDisplay = !\is_null($name) ? "\${$name}: " : '';
  29  
  30          return new self($varDisplay . $message);
  31      }
  32  }