src/Modify/Encoding/ConvertEncoding.php 1 location
|
@@ 109-120 (lines=12) @@
|
106 |
|
* |
107 |
|
* @return FileNodeInterface |
108 |
|
*/ |
109 |
|
public function modify(FileNodeInterface $file, array $options = []) |
110 |
|
{ |
111 |
|
if (!$this->canModify($file) || !($file instanceof LocalFile)) { |
112 |
|
throw new InvalidArgumentException("Supplied: $file is not a valid LocalFile"); |
113 |
|
} |
114 |
|
|
115 |
|
$this->options = $options; |
116 |
|
$encoding = $this->requireOption('encoding'); |
117 |
|
unset($options['encoding']); |
118 |
|
|
119 |
|
return $this->toEncoding($file, $encoding, $options); |
120 |
|
} |
121 |
|
} |
122 |
|
|
src/Modify/Head.php 1 location
|
@@ 61-72 (lines=12) @@
|
58 |
|
* |
59 |
|
* @return FileNodeInterface |
60 |
|
*/ |
61 |
|
public function modify(FileNodeInterface $file, array $options = []) |
62 |
|
{ |
63 |
|
$this->options = $options; |
64 |
|
$lines = $this->requireOption('lines'); |
65 |
|
unset($options['lines']); |
66 |
|
|
67 |
|
if (!($file instanceof LocalFile)) { |
68 |
|
throw new InvalidArgumentException("Supplied: $file is not a LocalFile"); |
69 |
|
} |
70 |
|
|
71 |
|
return $this->head($file, $lines, $options); |
72 |
|
} |
73 |
|
|
74 |
|
/** |
75 |
|
* Tail a file |
src/Modify/Tail.php 1 location
|
@@ 61-72 (lines=12) @@
|
58 |
|
* |
59 |
|
* @return FileNodeInterface |
60 |
|
*/ |
61 |
|
public function modify(FileNodeInterface $file, array $options = []) |
62 |
|
{ |
63 |
|
$this->options = $options; |
64 |
|
$lines = $this->requireOption('lines'); |
65 |
|
unset($options['lines']); |
66 |
|
|
67 |
|
if (!($file instanceof LocalFile)) { |
68 |
|
throw new InvalidArgumentException("Supplied: $file is not a LocalFile"); |
69 |
|
} |
70 |
|
|
71 |
|
return $this->tail($file, $lines, $options); |
72 |
|
} |
73 |
|
|
74 |
|
/** |
75 |
|
* Tail a file |