| @@ 41-68 (lines=28) @@ | ||
| 38 | * |
|
| 39 | * @return Loader |
|
| 40 | */ |
|
| 41 | public function make($host) |
|
| 42 | { |
|
| 43 | $host = $this->resolver->resolve($host, '/'); |
|
| 44 | $hash = md5($host); |
|
| 45 | ||
| 46 | if (isset($this->instances[$hash])) { |
|
| 47 | return $this->instances[$hash]; |
|
| 48 | } |
|
| 49 | ||
| 50 | $dir = sprintf( |
|
| 51 | '%s/%s', |
|
| 52 | rtrim($this->cacheDir, '/'), |
|
| 53 | $hash |
|
| 54 | ); |
|
| 55 | $instance = new Loader( |
|
| 56 | new FileCache(sprintf( |
|
| 57 | '%s/definitions.php', |
|
| 58 | $dir |
|
| 59 | )), |
|
| 60 | $this->resolver, |
|
| 61 | $this->builder, |
|
| 62 | $this->http, |
|
| 63 | $this->validator |
|
| 64 | ); |
|
| 65 | $this->instances[$hash] = $instance; |
|
| 66 | ||
| 67 | return $instance; |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| @@ 37-64 (lines=28) @@ | ||
| 34 | * |
|
| 35 | * @return Capabilities |
|
| 36 | */ |
|
| 37 | public function make($host) |
|
| 38 | { |
|
| 39 | $host = $this->resolver->resolve($host, '/'); |
|
| 40 | $hash = md5($host); |
|
| 41 | ||
| 42 | if (isset($this->instances[$hash])) { |
|
| 43 | return $this->instances[$hash]; |
|
| 44 | } |
|
| 45 | ||
| 46 | $dir = sprintf( |
|
| 47 | '%s/%s', |
|
| 48 | rtrim($this->cacheDir, '/'), |
|
| 49 | $hash |
|
| 50 | ); |
|
| 51 | $instance = new Capabilities( |
|
| 52 | $host, |
|
| 53 | $this->http, |
|
| 54 | new FileCache(sprintf( |
|
| 55 | '%s/capabilities.php', |
|
| 56 | $dir |
|
| 57 | )), |
|
| 58 | $this->loader->make($host), |
|
| 59 | $this->resolver |
|
| 60 | ); |
|
| 61 | $this->instances[$hash] = $instance; |
|
| 62 | ||
| 63 | return $instance; |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||