PageRenderTime 52ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/Template/src/syntax_trees/ast/nodes/constructs/empty.php

https://github.com/Yannix/zetacomponents
PHP | 67 lines | 18 code | 2 blank | 47 comment | 2 complexity | d78a942e56efd73699d69d29f297cff1 MD5 | raw file
  1. <?php
  2. /**
  3. * File containing the ezcTemplateEmptyAstNode class
  4. *
  5. * Licensed to the Apache Software Foundation (ASF) under one
  6. * or more contributor license agreements. See the NOTICE file
  7. * distributed with this work for additional information
  8. * regarding copyright ownership. The ASF licenses this file
  9. * to you under the Apache License, Version 2.0 (the
  10. * "License"); you may not use this file except in compliance
  11. * with the License. You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing,
  16. * software distributed under the License is distributed on an
  17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  18. * KIND, either express or implied. See the License for the
  19. * specific language governing permissions and limitations
  20. * under the License.
  21. *
  22. * @package Template
  23. * @version //autogen//
  24. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  25. * @access private
  26. */
  27. /**
  28. * Represents an empty construct.
  29. *
  30. * @package Template
  31. * @version //autogen//
  32. * @access private
  33. */
  34. class ezcTemplateEmptyAstNode extends ezcTemplateStatementAstNode
  35. {
  36. /**
  37. * The expression to output when evaluated.
  38. * @var ezcTemplateAstNode
  39. */
  40. public $expression;
  41. /**
  42. * Initialize with function name code and optional arguments
  43. *
  44. * @param ezcTemplateAstNode $expression
  45. */
  46. public function __construct( ezcTemplateAstNode $expression = null )
  47. {
  48. parent::__construct();
  49. $this->expression = $expression;
  50. }
  51. /**
  52. * Validates the expression against its constraints.
  53. *
  54. * @throws ezcTemplateInternalException if the constraints are not met.
  55. * @return void
  56. */
  57. public function validate()
  58. {
  59. if ( $this->expression === null )
  60. {
  61. throw new ezcTemplateInternalException( "Missing expression for class <" . get_class( $this ) . ">." );
  62. }
  63. }
  64. }
  65. ?>