Pass Craft Instance to A Vendor PHP File I created my own class file that I include in one of my Craft Services files. Is there any way I can access the craft instance inside of this file?

For example, inside my Craft service I create a new instance of my class like:

$wally = new Wally();

Inside of the actual Wally class file, I'd like to be able to create a variable in my constructor that gives me access to stuff like this:

craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);


For further clarification:

class Wally {
   function __construct($craftInstance) {
      $this-&gt;craft = $craftInstance;
   }
}


If it sounds like I don't know what I'm doing, I probably don't. Any help would be appreciated. Using Craft 2.6 btw.
You don't need to pass anything in there.

The function craft() is just a public function that returns the static app. It does not matter if you call it inside a plugin or somewhere else. 

namespace Craft; //&lt;----- added namespace
class Wally {
   function __construct() {
      $criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
   }
}


If you don't want to be in the same namespace you can do

class Wally {
   function __construct() {
      $criteria = \Craft\craft()-&gt;elements-&gt;getCriteria(\Craft\ElementType::Entry);
   }
}


If you really want to save the app in an extra variable for whatever reasons you would do

new Wally(craft());