Skip to content

Commit 1d3c84d

Browse files
committed
Allow repo config object to be used as an array
1 parent 4d5c441 commit 1d3c84d

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/Repository/Config/RepositoryConfig.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Composer\Repository\RepositoryInterface;
1313

1414

15-
class RepositoryConfig implements RepositoryConfigInterface {
15+
class RepositoryConfig implements RepositoryConfigInterface, \ArrayAccess {
1616

1717
const repoType = null;
1818
protected $config;
@@ -135,4 +135,32 @@ function getRepo() {
135135
return $this->repo;
136136
}
137137

138+
/**
139+
* @see ArrayAccess
140+
*/
141+
function offsetExists( $offset ) {
142+
return isset( $this->config[ $offset ] );
143+
}
144+
145+
/**
146+
* @see ArrayAccess
147+
*/
148+
function offsetGet( $offset ) {
149+
return $this->get( $offset );
150+
}
151+
152+
/**
153+
* @see ArrayAccess
154+
*/
155+
function offsetSet( $offset, $value ) {
156+
return $this->set( $offset, $value );
157+
}
158+
159+
/**
160+
* @see ArrayAccess
161+
*/
162+
function offsetUnset( $offset ) {
163+
unset( $this->config[ $offset ] );
164+
}
165+
138166
}

0 commit comments

Comments
 (0)