Skip to content

Commit

Permalink
Format for PSR2
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmackay committed Mar 30, 2017
1 parent 95150c8 commit e7575c3
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/App/Acl.php
@@ -1,4 +1,4 @@
<?php defined('SYSPATH') or die('No direct script access');
<?php

/**
* Ushahidi Acl
Expand Down
2 changes: 1 addition & 1 deletion src/App/FileReader/CSV.php
Expand Up @@ -42,7 +42,7 @@ public function process($file)

// Filter out empty rows
$nbColumns = count($reader->fetchOne());
$reader->addFilter(function($row) use ($nbColumns) {
$reader->addFilter(function ($row) use ($nbColumns) {
return count($row) == $nbColumns;
});

Expand Down
2 changes: 1 addition & 1 deletion src/App/FileReader/CSVReaderFactory.php
@@ -1,4 +1,4 @@
<?php defined('SYSPATH') or die('No direct script access');
<?php

/**
* Ushahidi Reader Factory
Expand Down
2 changes: 1 addition & 1 deletion src/App/Filesystem.php
@@ -1,4 +1,4 @@
<?php defined('SYSPATH') or die('No direct script access');
<?php

/**
* Ushahidi Filesystem
Expand Down
1 change: 0 additions & 1 deletion src/App/FilesystemAdapter/Local.php
Expand Up @@ -29,4 +29,3 @@ public function getAdapter()
return new LocalAdapter($this->config['media_upload_dir']);
}
}

3 changes: 1 addition & 2 deletions src/App/FilesystemAdapter/Rackspace.php
Expand Up @@ -34,10 +34,9 @@ public function getAdapter()
'apiKey' => $this->config['apiKey'],
));

$store = $client->objectStoreService(null,$this->config['region']);
$store = $client->objectStoreService(null, $this->config['region']);
$container = $store->getContainer($this->config['container']);

return new Adapter($container);
}
}

44 changes: 18 additions & 26 deletions src/App/Init.php
Expand Up @@ -24,39 +24,32 @@
// Currently supported: Local filesysten, AWS S3 v3, Rackspace
// the naming scheme must match the cdn type set in config/cdn
$di->set('adapter.local', $di->lazyNew(
'Ushahidi\App\FilesystemAdapter\Local',
[
'config' => $di->lazyGet('cdn.config')
]
)
);
'Ushahidi\App\FilesystemAdapter\Local',
['config' => $di->lazyGet('cdn.config')]
));

$di->set('adapter.aws', $di->lazyNew(
'Ushahidi\App\FilesystemAdapter\AWS',
[
'config' => $di->lazyGet('cdn.config')
]
)
);
'Ushahidi\App\FilesystemAdapter\AWS',
['config' => $di->lazyGet('cdn.config')]
));

$di->set('adapter.rackspace', $di->lazyNew(
'Ushahidi\App\FilesystemAdapter\Rackspace',
[
'config' => $di->lazyGet('cdn.config')
]
)
);
'Ushahidi\App\FilesystemAdapter\Rackspace',
['config' => $di->lazyGet('cdn.config')]
));

// Media Filesystem
// The Ushahidi filesystem adapter returns a flysystem adapter for a given
// cdn type based on the provided configuration
$di->set('tool.filesystem', $di->lazyNew('Ushahidi\App\Filesystem'));
$di->params['Ushahidi\App\Filesystem'] = [
'adapter' => $di->lazy(function () use ($di) {
$adapter_type = $di->get('cdn.config');
$fsa = $di->get('adapter.' . $adapter_type['type']);
$adapter_type = $di->get('cdn.config');
$fsa = $di->get('adapter.' . $adapter_type['type']);

return $fsa->getAdapter();
})
];
return $fsa->getAdapter();
})
];

// Defined memcached
$di->set('memcached', $di->lazy(function () use ($di) {
Expand Down Expand Up @@ -96,7 +89,7 @@
];

// Rate limit storage cache
$di->set('ratelimiter.cache', function() use ($di) {
$di->set('ratelimiter.cache', function () use ($di) {
$config = $di->get('ratelimiter.config');
$cache = $config['cache'];

Expand All @@ -105,8 +98,7 @@
$di->lazyGet('memcached');

return $di->newInstance('Doctrine\Common\Cache\MemcachedCache');
}
elseif ($cache === 'filesystem') {
} elseif ($cache === 'filesystem') {
$di->params['Doctrine\Common\Cache\FilesystemCache'] = [
'directory' => $config['filesystem']['directory'],
];
Expand Down
2 changes: 1 addition & 1 deletion src/App/RateLimiter.php
@@ -1,4 +1,4 @@
<?php defined('SYSPATH') or die('No direct script access');
<?php

/**
* Ushahidi Rate Limiter
Expand Down
2 changes: 1 addition & 1 deletion src/App/Reader.php
@@ -1,4 +1,4 @@
<?php defined('SYSPATH') or die('No direct script access');
<?php

/**
* Ushahidi Reader
Expand Down

0 comments on commit e7575c3

Please sign in to comment.