-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dict.php
37 lines (28 loc) · 820 Bytes
/
Dict.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use Minuux\Dict\SimpleDict;
class Dict {
protected $path='';
protected $out='';
function __construct($config) {
empty($config) OR $this->initialize($config);
if (!file_exists($this->out)) {
SimpleDict::make($this->path, $this->out);
}
$this->filter=new SimpleDict($this->out);
}
public function initialize($config = array()) {
foreach ($config as $key => $val) {
if (isset($this->$key)) {
$this->$key = $val;
}
}
return $this;
}
function search($str) {
return $this->filter->search($str);
}
function replace($str, $replace) {
return $this->filter->replace($str, $replace);
}
}