Class: PHP::Literal::Array

Inherits:
PHP::Literal show all
Defined in:
lib/php/syntax/literal.rb

Overview

See Also:

Instance Method Summary

Methods inherited from PHP::Literal

#<=>

Methods inherited from PHP::Node

#<<, #<=>, #children?, #each, #indent, #indent=, #to_s

Constructor Details

- (Array) initialize(*elements)

A new instance of Array

Parameters:



54
55
56
# File 'lib/php/syntax/literal.rb', line 54

def initialize(*elements)
  @children = elements
end

Instance Method Details

- (String) to_php

Returns the PHP representation of this array literal.

Returns:

  • (String)


62
63
64
# File 'lib/php/syntax/literal.rb', line 62

def to_php
  "array(#{children.join(', ')})"
end