Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   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  }