TYPO3  7.6
Insert.php
Go to the documentation of this file.
1 <?php
2 
19 namespace cogpowered\FineDiff\Parser\Operations;
20 
24 class Insert implements OperationInterface
25 {
31  public function __construct($text)
32  {
33  $this->text = $text;
34  }
35 
39  public function getFromLen()
40  {
41  return 0;
42  }
43 
47  public function getToLen()
48  {
49  return strlen($this->text);
50  }
51 
55  public function getText()
56  {
57  return $this->text;
58  }
59 
63  public function getOpcode()
64  {
65  $to_len = strlen($this->text);
66 
67  if ( $to_len === 1 ) {
68  return "i:{$this->text}";
69  }
70 
71  return "i{$to_len}:{$this->text}";
72  }
73 }