src/Modify/Encoding/ConvertEncoding.php 1 location
|
@@ 98-109 (lines=12) @@
|
| 95 |
|
* |
| 96 |
|
* @return FileNodeInterface |
| 97 |
|
*/ |
| 98 |
|
public function modify(FileNodeInterface $file, array $options = []) |
| 99 |
|
{ |
| 100 |
|
if (!$this->canModify($file) || !($file instanceof LocalFile)) { |
| 101 |
|
throw new InvalidArgumentException("Supplied: $file is not a valid LocalFile"); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
$this->options = $options; |
| 105 |
|
$encoding = $this->requireOption('encoding'); |
| 106 |
|
unset($options['encoding']); |
| 107 |
|
|
| 108 |
|
return $this->toEncoding($file, $encoding, $options); |
| 109 |
|
} |
| 110 |
|
} |
| 111 |
|
|
src/Modify/Head.php 1 location
|
@@ 50-61 (lines=12) @@
|
| 47 |
|
* |
| 48 |
|
* @return FileNodeInterface |
| 49 |
|
*/ |
| 50 |
|
public function modify(FileNodeInterface $file, array $options = []) |
| 51 |
|
{ |
| 52 |
|
$this->options = $options; |
| 53 |
|
$lines = $this->requireOption('lines'); |
| 54 |
|
unset($options['lines']); |
| 55 |
|
|
| 56 |
|
if (!($file instanceof LocalFile)) { |
| 57 |
|
throw new InvalidArgumentException("Supplied: $file is not a LocalFile"); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
return $this->head($file, $lines, $options); |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
/** |
| 64 |
|
* Tail a file |
src/Modify/Tail.php 1 location
|
@@ 50-61 (lines=12) @@
|
| 47 |
|
* |
| 48 |
|
* @return FileNodeInterface |
| 49 |
|
*/ |
| 50 |
|
public function modify(FileNodeInterface $file, array $options = []) |
| 51 |
|
{ |
| 52 |
|
$this->options = $options; |
| 53 |
|
$lines = $this->requireOption('lines'); |
| 54 |
|
unset($options['lines']); |
| 55 |
|
|
| 56 |
|
if (!($file instanceof LocalFile)) { |
| 57 |
|
throw new InvalidArgumentException("Supplied: $file is not a LocalFile"); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
return $this->tail($file, $lines, $options); |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
/** |
| 64 |
|
* Tail a file |