Returns the license for a Premium package

@param string $slug

@return array|string
496989
public static function get($slug = null)
    {
        $licenses = self::getLicenseFile();
        $data = (array)$licenses->content();
        $licenses->free();
        $slug = strtolower($slug);

        if (!$slug) {
            return $data['licenses'] ?? [];
        }

        return $data['licenses'][$slug] ?? '';
    }
933922
public function getBySlug($lang, $slug)
    {
        $postType = PostType::collection()->where('slug', $slug);
        if(!$postType->isEmpty()) {
            return $postType->first();
        }
        return [];
    }
11975
function get_available_premium_licenses( $is_localhost = null ) {
            $this->_logger->entrance();

            $licenses = array();
            if ( ! $this->has_paid_plan() ) {
                return $licenses;
            }

            if ( is_array( $this->_licenses ) ) {
                foreach ( $this->_licenses as $license ) {
                    if ( ! $license->can_activate( $is_localhost ) ) {
                        continue;
                    }

                    $licenses[] = $license;
                }
            }

            return $licenses;
        }
863600
public function findOneBySlug($slug)
    {
        // select
        $qb = $this->getQueryBuilder()
            ->select('p.id, t.title, t.description, t.metaTitle, t.metaDescription, t.metaTags, p.active');

        //join
        $qb->leftJoin('p.translations', 't');
        
        $qb->where('t.slug LIKE :slug')
           ->andWhere('p.active LIKE :active')
            ->setParameter('slug', '%'.$slug.'%')
            ->setParameter('active', true);

        return $qb->getQuery()->getSingleResult();
    }
926410
public function bySlug(string $slug, bool $no_cache = false)
    {
        $slug = (string) $slug;

        if (!($slug = (string) $slug)) {
            return null; // Not possible.
        } elseif (!($product_id = $this->idBySlug($slug, $no_cache))) {
            return null; // Not possible.
        } elseif (!($WC_Product = wc_get_product($product_id))) {
            return null; // Not possible.
        } elseif (!$WC_Product->exists()) {
            return null; // Not possible.
        }
        return $WC_Product;
    }
1032351
public function getModulePath($slug)
    {
        if (Str::length($slug) > 3) {
            $module = Str::studly($slug);
        } else {
            $module = Str::upper($slug);
        }

        return $this->getModulesPath() .DS .$module .DS;
    }
279340
protected function rollback($slug)
    {
        if (! $this->packages->exists($slug)) {
            return $this->error('Package does not exist.');
        }

        $this->requireMigrations($slug);

        //
        $this->migrator->setConnection($this->input->getOption('database'));

        $pretend = $this->input->getOption('pretend');

        $this->migrator->rollback($pretend, $slug);

        //
        foreach ($this->migrator->getNotes() as $note) {
            if (! $this->option('quiet')) {
                $this->line($note);
            }
        }
    }
534188
public function get($slug)
    {
        return $this->ports->first(function (Port $port) use ($slug) {
            return $port->slug() === $slug;
        });
    }
713847
public function getExistingSlugs($slug)
    {
        return self::select('slug')->where('slug', 'like', $slug.'%')
            ->when($this->id, function ($query) {
                return $query->where('id', '<>', $this->id);
            })
            ->get();
    }
789519
public function findPublishedTreeForMenu($slug)
    {
        // Find published Menu by its slug
        $builder = $this->createQueryBuilder('m')
                        ->where('m.slug = :slug')->setParameter('slug', $slug)
                        ->andWhere('m.lvl = 0');
        /** @var Menu $menu */
        $menu = $builder->andWhere($builder->expr()->andX(
            $builder->expr()->isNotNull('m.startedAt'),
            $builder->expr()->lte('m.startedAt', ':now'),
            $builder->expr()->orX(
                $builder->expr()->isNull('m.endedAt'),
                $builder->expr()->gte('m.endedAt', ':now')
            )
        ))->setParameter('now', new \DateTime())->getQuery()->setMaxResults(1)->getOneOrNullResult();

        // Cannot find Menu
        if ($menu) {
            return;
        }

        // Build tree from Menu
        $builder = $this->createQueryBuilder('m')
                        ->where('m.root = :root')->setParameter('root', $menu->getId())
                        ->leftJoin('m.article', 'a')->addSelect('a')
                        ->orderBy('m.lft', 'ASC');
        $builder->andWhere($builder->expr()->andX(
            $builder->expr()->isNotNull('m.startedAt'),
            $builder->expr()->lte('m.startedAt', ':now'),
            $builder->expr()->orX(
                $builder->expr()->isNull('m.endedAt'),
                $builder->expr()->gte('m.endedAt', ':now')
            )
        ))->setParameter('now', new \DateTime());

        return $this->buildTree($builder->getQuery()->getArrayResult());
    }
366779
protected function _get($slug = '')
    {
        // Build a url from the slug that was passed in
        $url = $this->urlFromRoute($slug);
        // Send a post request to the API
        $response = $this->orm->uniRequest->get($url, $this->orm->headers);
        // If the token has expired
        if ($response->code == 401) {
            if (isset($response->body->message)) {
                if ($response->body->message == 'Token has expired') {
                    // Authenticate again
                    $this->orm->authenticate();
                    // Try the request again
                    return $this->_get($slug);
                }
            }
            // Return the response
            return $response;
        } else {
            // Return the response
            return $response;
        }
    }
1024015
public function getIndividualLicense(string $license): array
    {
        return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi()
                                                                                                    ->sprintf('/licenses/:license',
                                                                                                        $license));
    }
468930
protected function getLicense(string $path): string
    {
        if (isset($this->licenseMap[$path])) {
            return $this->licenseMap[$path];
        }

        if (!file_exists($path . '.license')) {
            $this->licenseMap[$path] = '';
            return '';
        }

        $license = (string)file_get_contents($path . '.license');
        $this->licenseMap[$path] = $license;

        return $license;
    }
1114313
public function inGroup($slug)
    {
        return $this->groups->contains(function ($group) use ($slug) {
            return $group->slug === $slug || $group->id === $slug;
        });
    }
611704
public static function slug(string $slug): string
    {
        $lettersNumbersSpacesHyphens = '/[^\-\s\pN\pL]+/u';
        $spacesDuplicateHypens = '/[\-\s]+/';

        $slug = preg_replace($lettersNumbersSpacesHyphens, '', $slug);
        $slug = preg_replace($spacesDuplicateHypens, '-', $slug);
        $slug = trim($slug, '-');

        return mb_strtolower($slug, 'UTF-8');
    }
899814
public function getThemePath($slug)
    {
        if (Str::length($slug) > 3) {
            $theme = Str::studly($slug);
        } else {
            $theme = Str::upper($slug);
        }

        return $this->getThemesPath() .DS .$theme .DS;
    }
377242
public static function get($slug)
    {
        $locale = I18n::getLocale();
        $slug = array_filter(explode('/', $slug));
        $cache = sprintf('page_%s_locale_%s', md5(serialize($slug)), $locale);
        $page = Cache::read($cache, 'static_pages');

        if (empty($page)) {
            //Sets the (partial) filename
            $filename = implode(DS, $slug);

            //Sets the filename patterns
            $patterns = [$filename . '-' . $locale];
            if (preg_match('/^(\w+)_\w+$/', $locale, $matches)) {
                $patterns[] = $filename . '-' . $matches[1];
            }
            $patterns[] = $filename;

            //Checks if the page exists in APP
            foreach ($patterns as $pattern) {
                $filename = self::getAppPath() . $pattern . '.ctp';

                if (is_readable($filename)) {
                    $page = DS . 'StaticPages' . DS . $pattern;

                    break;
                }
            }

            //Checks if the page exists in each plugin
            foreach (Plugin::all() as $plugin) {
                foreach ($patterns as $pattern) {
                    $filename = self::getPluginPath($plugin) . $pattern . '.ctp';

                    if (is_readable($filename)) {
                        $page = $plugin . '.' . DS . 'StaticPages' . DS . $pattern;

                        break;
                    }
                }
            }

            Cache::write($cache, $page, 'static_pages');
        }

        return $page;
    }