47 lines
2.5 KiB
HTML
47 lines
2.5 KiB
HTML
|
<h1 style="background-color:#333333; color: #eeeeee;">Pastel</h1>
|
||
|
<pre style="font-family:Monaco, monospace; padding:2em; background-color: #222222; color: #eeeeee;">
|
||
|
<?php
|
||
|
|
||
|
<span style="color: #9474a9;">namespace</span> Illuminate\Container;
|
||
|
|
||
|
<span style="color: #9474a9;">use</span> Closure;
|
||
|
<span style="color: #9474a9;">use</span> ArrayAccess;
|
||
|
|
||
|
<span style="color: #444444;">/**
|
||
|
* Theme: Pastel
|
||
|
* Pastel.
|
||
|
*
|
||
|
* Copyright (c) 2014 Dayle Rees
|
||
|
*/</span>
|
||
|
<span style="color: #9474a9;">class</span> Container <span style="color: #04C4A5;">implements</span> ArrayAccess
|
||
|
{
|
||
|
<span style="color: #444444;">/**
|
||
|
* An array of the types that have been resolved.
|
||
|
*
|
||
|
* <span style="color: #666666;">@var</span> array
|
||
|
*/</span>
|
||
|
<span style="color: #04C4A5;">protected</span> <span style="color: ;">$resolved</span> <span style="color: #9474a9;">=</span> <span style="color: #E2E060;">array</span>();
|
||
|
|
||
|
<span style="color: #444444;">/**
|
||
|
* Determine if a given type is shared.
|
||
|
*
|
||
|
* <span style="color: #666666;">@param</span> string $abstract
|
||
|
* <span style="color: #666666;">@return</span> bool
|
||
|
*/</span>
|
||
|
<span style="color: #04C4A5;">public</span> <span style="color: #9474a9;">function</span> <span style="color: #C56C6C;">isShared</span>(<span style="color: ;">$abstract</span>)
|
||
|
{
|
||
|
<span style="color: #C5906C;">if</span> (<span style="color: #E2E060;">isset</span>(<span style="color: ;">$this</span><span style="color: #C5906C;">-></span><span style="color: ;">bindings</span>[<span style="color: ;">$abstract</span>][<span style="color: #C56C6C;">'shared'</span>]))
|
||
|
{
|
||
|
<span style="color: ;">$shared</span> <span style="color: #C5906C;">=</span> <span style="color: ;">$this</span><span style="color: #C5906C;">-></span><span style="color: ;">bindings</span>[<span style="color: ;">$abstract</span>][<span style="color: #C56C6C;">'shared'</span>];
|
||
|
}
|
||
|
<span style="color: #C5906C;">else</span>
|
||
|
{
|
||
|
<span style="color: ;">$shared</span> <span style="color: #C5906C;">=</span> <span style="color: #04C4A5;">false</span>;
|
||
|
}
|
||
|
|
||
|
<span style="color: #C5906C;">return</span> <span style="color: #E2E060;">isset</span>(<span style="color: ;">$this</span><span style="color: #C5906C;">-></span><span style="color: ;">instances</span>[<span style="color: ;">$abstract</span>]) <span style="color: #C5906C;">||</span> <span style="color: ;">$shared</span> <span style="color: #C5906C;">===</span> <span style="color: #04C4A5;">true</span>;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
</pre>
|