2014-02-09 16:43:47 +00:00
|
|
|
<h1 style="background-color:#282521; color: #EBD1B7;">Earthsong Contrast</h1>
|
2014-02-09 15:13:42 +00:00
|
|
|
<pre style="font-family:Monaco, monospace; padding:2em; background-color: #12100f; color: #EBD1B7;">
|
|
|
|
<?php
|
|
|
|
|
|
|
|
<span style="color: #95CC5E;">namespace</span> Illuminate\Container;
|
|
|
|
|
|
|
|
<span style="color: #95CC5E;">use</span> Closure;
|
|
|
|
<span style="color: #95CC5E;">use</span> ArrayAccess;
|
|
|
|
|
|
|
|
<span style="color: #7A7267;">/**
|
|
|
|
* Theme: Earthsong Contrast
|
|
|
|
* Nothing to do with Michael Jackson.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 Dayle Rees
|
|
|
|
*/</span>
|
|
|
|
<span style="color: #95CC5E;">class</span> Container <span style="color: #DB784D;">implements</span> ArrayAccess
|
|
|
|
{
|
|
|
|
<span style="color: #7A7267;">/**
|
|
|
|
* An array of the types that have been resolved.
|
|
|
|
*
|
|
|
|
* <span style="color: #9a9082;">@var</span> array
|
|
|
|
*/</span>
|
|
|
|
<span style="color: #DB784D;">protected</span> <span style="color: ;">$resolved</span> <span style="color: #95CC5E;">=</span> <span style="color: #95CC5E;">array</span>();
|
|
|
|
|
|
|
|
<span style="color: #7A7267;">/**
|
|
|
|
* Determine if a given type is shared.
|
|
|
|
*
|
|
|
|
* <span style="color: #9a9082;">@param</span> string $abstract
|
|
|
|
* <span style="color: #9a9082;">@return</span> bool
|
|
|
|
*/</span>
|
|
|
|
<span style="color: #DB784D;">public</span> <span style="color: #95CC5E;">function</span> <span style="color: #60A365;">isShared</span>(<span style="color: ;">$abstract</span>)
|
|
|
|
{
|
|
|
|
<span style="color: #DB784D;">if</span> (<span style="color: #95CC5E;">isset</span>(<span style="color: ;">$this</span><span style="color: #DB784D;">-></span><span style="color: ;">bindings</span>[<span style="color: ;">$abstract</span>][<span style="color: #F8BB39;">'shared'</span>]))
|
|
|
|
{
|
|
|
|
<span style="color: ;">$shared</span> <span style="color: #DB784D;">=</span> <span style="color: ;">$this</span><span style="color: #DB784D;">-></span><span style="color: ;">bindings</span>[<span style="color: ;">$abstract</span>][<span style="color: #F8BB39;">'shared'</span>];
|
|
|
|
}
|
|
|
|
<span style="color: #DB784D;">else</span>
|
|
|
|
{
|
|
|
|
<span style="color: ;">$shared</span> <span style="color: #DB784D;">=</span> <span style="color: #DB784D;">false</span>;
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #DB784D;">return</span> <span style="color: #95CC5E;">isset</span>(<span style="color: ;">$this</span><span style="color: #DB784D;">-></span><span style="color: ;">instances</span>[<span style="color: ;">$abstract</span>]) <span style="color: #DB784D;">||</span> <span style="color: ;">$shared</span> <span style="color: #DB784D;">===</span> <span style="color: #DB784D;">true</span>;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
</pre>
|