Will create and reuse an instance of UserLibrary
@return UserLibrary
966580
public function getUserLibraryInstance()
    {
        if ($this->userLibrary === null) {
            $this->userLibrary = new UserLibraryImpl($this);
        }
        return $this->userLibrary;
    }
798076
function createTemporaryVersion()
    {
        $db = eZDB::instance();
        $db->begin();

        $newRole = eZRole::createNew();
        $this->copyPolicies( $newRole->attribute( 'id' ) );
        $newRole->setAttribute( 'name', $this->attribute( 'name' ) );
        $newRole->setAttribute( 'version', $this->attribute( 'id' ) );
        $newRole->store();

        $db->commit();
        return $newRole;
    }
1332198
public function CloneInstance()
	{
		$result = new IDFilterNodeIterator( $this->context, $this->type );
		$result->IDRef = $this->IDRef;
		$result->iterator = $this->iterator->CloneInstance();
		$result->Reset();
		return $result;
	}
1230330
public function create()
    {
        $instance = self::createCollection($this);
        $this->setId($instance->getId());
        return $instance;
    }
1039197
public function create() {

		if(false === $this -> file -> getExists()) {
			
			fopen($this -> file -> getBasepath(), 'w+');

			$this -> refresh();
		}

		return $this;
	}
58954
public static function instance()
    {
        if (null === self::$_instance) {
            $logger = new Monolog(Config::read('app.id'));
            $file_handler = new StreamHandler(self::getFilepath());
            $logger->pushHandler($file_handler);

            self::$_instance = $logger;
        }
        return self::$_instance;
    }
776024
public function createUserMenu()
    {
        $menu = $this->factory->createItem('root');

        if ($this->accountEnabled) {
            if (null !== $token = $this->tokenStorage->getToken()) {
                if ($this->authorization->isGranted('IS_AUTHENTICATED_FULLY') || $this->authorization->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
                    /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $user */
                    $user = $token->getUser();
                    $item = $menu->addChild($user->getEmail(), ['uri' => '#']);
                    $item->addChild('ekyna_user.account.menu.my_profile', ['route' => 'fos_user_profile_show']);
                    if ($this->authorization->isGranted('ROLE_ADMIN')) {
                        $item->addChild('ekyna_user.account.menu.backend', ['route' => 'ekyna_admin']);
                    }
                    $item->addChild('ekyna_user.account.menu.logout', ['route' => 'fos_user_security_logout']);
                    return $menu;
                }
            }
            $menu->addChild('ekyna_user.account.menu.login', ['route' => 'fos_user_security_login']);
        }

        return $menu;
    }
1302254
public function getUserService()
    {
        if (null === $this->userService) {
            $this->userService = new UserService(
                $this->client,
                $this->inputDispatcher,
                $this->outputVisitor,
                $this->requestParser
            );
        }

        return $this->userService;
    }
1189066
public function currentUser(): User
    {
        if (BunqContext::getUserContext()->isOnlyUserCompanySet()) {
            return new User(BunqContext::getUserContext()->getUserCompany());
        }

        if (BunqContext::getUserContext()->isOnlyUserPersonSet()) {
            return new User(BunqContext::getUserContext()->getUserPerson());
        }

        throw new RuntimeException('Unexpected user type received.');
    }
937377
public static function instance()
    {
        if ( self::$instance === null )
        {
            $serviceContainer = ezpKernel::instance()->getServiceContainer();
            self::$instance = new self( $serviceContainer->get( 'ezpublish.api.repository' ) );
        }

        return self::$instance;
    }
311644
public function create()
    {
        $instance = self::createFreeItemCoupon($this);
        $this->setId($instance->getId());
        return $instance;
    }
98571
protected function createResourceFromUser(UserEntity $user)
    {
        $resource = new Resource(
            $this->generateReadUrl($user->getUsernameCanonical()),
            array(
                 'username'   => $user->getUsernameCanonical(),
                 'email'      => $user->getEmail(),
                 'last_login' => $user->getLastLogin() ? $user->getLastLogin()->format('c') : null,
            )
        );

        return $resource;
    }
286378
private function createUsers()
    {
        if($this->option('users')
            || $this->option('users_per_role')
            || $this->option('all')
        ) {

            $this->comment('Creating dummy users...');
            $output = (new \UserSeeder())
                ->setCommand($this)
                ->run(
                    $this->getDefaultOption('users'),
                    $this->getDefaultOption('users_per_role'),
                    $this->getDefaultOption('role_id')
                );
            $this->info($output);
        }
        return $this;
    }
791605
public function getDefaultPageLibraryInstance()
    {
        if ($this->defaultPageLibrary === null) {
            $this->defaultPageLibrary = new DefaultPageLibraryImpl($this);
        }

        return $this->defaultPageLibrary;
    }
939949
public static function load() : SearchIndexStore
    {
        if (is_null(self::$instance)) {
            self::$instance = new SearchIndexStore(Connection::get());
        }

        return self::$instance;
    }
629982
public function makeUse()
    {
        ++$this->used;

        if ($this->count > 0 && $this->count <= $this->used) {
            $this->enabled = false;
        }

        return $this;
    }
724985
public function addToLibrary(User $user, File $file)
    {
        $folder = new FolderImpl($this->filesDir->getAbsolutePath()."/".$user->getUniqueId());
        $ext = $file->getExtension() == ""?"":".".$file->getExtension();
        $name = str_replace(".", "", uniqid("",true)).$ext;
        return $this->addToLibraryHelper($folder, $file, $name);
    }