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