protected function findSettingByName($haystack, $needle)
    {
        foreach ($haystack as $setting) {
            if ($setting->getName() === $needle) {
                return $setting;
            }
        }
    }
protected function findSettingByName($haystack, $needle)
    {
        foreach ($haystack as $setting) {
            if ($setting->getName() === $needle) {
                return $setting;
            }
        }
    }
protected function findSettingByName ( $ haystack , $ needle ) { foreach ( $ haystack as $ setting ) { if ( $ setting -> getName ( ) === $ needle ) { return $ setting ; } } }
Find a setting by name form an array of settings.

@param Setting[] $haystack
@param string $needle

@return Setting|null
Find a setting by name form an array of settings .