TYPO3  7.6
Opcodes.php
Go to the documentation of this file.
1 <?php
2 
20 
22 
26 class Opcodes implements OpcodesInterface
27 {
31  protected $opcodes = array();
32 
36  public function getOpcodes()
37  {
38  return $this->opcodes;
39  }
40 
44  public function setOpcodes(array $opcodes)
45  {
46  $this->opcodes = array();
47 
48  // Ensure that all elements of the array
49  // are of the correct type
50  foreach ($opcodes as $opcode) {
51  if (!is_a($opcode, 'cogpowered\FineDiff\Parser\Operations\OperationInterface')) {
52  throw new OperationException('Invalid opcode object');
53  }
54 
55  $this->opcodes[] = $opcode->getOpcode();
56  }
57  }
58 
62  public function generate()
63  {
64  return implode('', $this->opcodes);
65  }
66 
70  public function __toString()
71  {
72  return $this->generate();
73  }
74 }