Class: PHP::Operator::Binary

Inherits:
PHP::Operator show all
Defined in:
lib/php/syntax/operator.rb

Instance Attribute Summary

Instance Method Summary

Methods inherited from PHP::Operator

for, #operator, #to_a

Methods inherited from PHP::Node

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

Constructor Details

- (Binary) initialize(lhs, rhs)

A new instance of Binary

Parameters:



106
107
108
# File 'lib/php/syntax/operator.rb', line 106

def initialize(lhs, rhs)
  @lhs, @rhs = lhs, rhs
end

Instance Attribute Details

- (Expression) lhs

Returns:



97
98
99
# File 'lib/php/syntax/operator.rb', line 97

def lhs
  @lhs
end

- (Expression) rhs

Returns:



101
102
103
# File 'lib/php/syntax/operator.rb', line 101

def rhs
  @rhs
end

Instance Method Details

- (Array(Expression, Expression)) operands

Returns the operands for this operation.

Returns:



114
115
116
# File 'lib/php/syntax/operator.rb', line 114

def operands
  [lhs, rhs]
end

- (String) to_php

Returns the PHP representation of this operation.

Returns:



122
123
124
# File 'lib/php/syntax/operator.rb', line 122

def to_php
  "#{lhs} #{operator} #{rhs}"
end