Skip to content

Instantly share code, notes, and snippets.

@duskohu
Created June 23, 2017 12:44
Show Gist options
  • Save duskohu/82b0ab349e751db55e3ffe659d6aee4c to your computer and use it in GitHub Desktop.
Save duskohu/82b0ab349e751db55e3ffe659d6aee4c to your computer and use it in GitHub Desktop.
Samozrejme zalezi od konkretneho pripadu, ale podmienku by som rozdelil do mensich AOP casti
<?php
/**
* @param array $settings
* @return bool
*/
public function isModuleUploads($settings = array()) {
if (isset($settings['module-uploads']) && $settings['module-uploads']) {
return TRUE;
}
return FALSE;
}
/**
* @param string $key
* @param array $keys
* @return bool
*/
public function isValidKey($key, $keys = array()) {
if (in_array($key, $keys)) {
return TRUE;
}
return FALSE;
}
$keys = array('copy-to-ceph', 'serve-from-ceph');
if ($this->isModuleUploads($settings) && $this->isValidKey($key, $keys)) {
return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment