SinSquare/silex-doctrine-cache-provider

View on GitHub

Showing 22 of 22 total issues

Method register has 149 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function register(Container $app)
{
//initialize and validate options
$app['doctrine.cache.options.initializer'] = $app->protect(function () use ($app) {
static $initialized = false;
Severity: Major
Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 5 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    $app['doctrine.cache.factory.filesystem'] = $app->protect(function ($cacheOptions) {
    if (empty($cacheOptions['directory'])) {
    throw new \RuntimeException('FilesystemCache directory not defined');
    }
    Severity: Major
    Found in src/Sins/Cache/DoctrineCacheServiceProvider.php and 1 other location - About 2 hrs to fix
    src/Sins/Cache/DoctrineCacheServiceProvider.php on lines 162..173

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    $app['doctrine.cache.factory.phpfile'] = $app->protect(function ($cacheOptions) {
     
    if (empty($cacheOptions['directory'])) {
    throw new \RuntimeException('FilesystemCache directory not defined');
    }
    Severity: Major
    Found in src/Sins/Cache/DoctrineCacheServiceProvider.php and 1 other location - About 2 hrs to fix
    src/Sins/Cache/DoctrineCacheServiceProvider.php on lines 111..122

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    $app['doctrine.cache.factory.memcached'] = $app->protect(function ($cacheOptions) {
    if (empty($cacheOptions['host']) || empty($cacheOptions['port'])) {
    throw new \RuntimeException('Host and port options need to be specified for memcached cache');
    }
     
     
    Severity: Major
    Found in src/Sins/Cache/DoctrineCacheServiceProvider.php and 1 other location - About 1 hr to fix
    src/Sins/Cache/DoctrineCacheServiceProvider.php on lines 128..141

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    $app['doctrine.cache.factory.memcache'] = $app->protect(function ($cacheOptions) {
    if (empty($cacheOptions['host']) || empty($cacheOptions['port'])) {
    throw new \RuntimeException('Host and port options need to be specified for memcache cache');
    }
     
     
    Severity: Major
    Found in src/Sins/Cache/DoctrineCacheServiceProvider.php and 1 other location - About 1 hr to fix
    src/Sins/Cache/DoctrineCacheServiceProvider.php on lines 147..160

    Avoid too many return statements within this method.
    Open

    return new \Memcached();
    Severity: Major
    Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

      return $app['doctrine.cache.locator']($name, $options);
      Severity: Major
      Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

        return $cache;
        Severity: Major
        Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

          return $app['doctrine.cache.'.$name];
          Severity: Major
          Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

            return new VoidCache();
            Severity: Major
            Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

              return new ChainCache($caches);
              Severity: Major
              Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                return $cache;
                Severity: Major
                Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                  return new \Memcache();
                  Severity: Major
                  Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                    return new ApcuCache();
                    Severity: Major
                    Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                      return new ArrayCache();
                      Severity: Major
                      Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                        return $cache;
                        Severity: Major
                        Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                          return $caches;
                          Severity: Major
                          Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                            return;
                            Severity: Major
                            Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                              return $app[$cacheFactoryKey]($cacheOptions);
                              Severity: Major
                              Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                return new FilesystemCache($directory, $extension, $umask);
                                Severity: Major
                                Found in src/Sins/Cache/DoctrineCacheServiceProvider.php - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language