/**
  * Generates the provided enumeration(s)
  *
  * @param array|bool $filter $filter The filter
  */
 protected function generateEnumeration($filter = false)
 {
     if ($this->enumeration->hasEducations() === false && $this->enumeration->hasBranches() === false) {
         $_educations = array();
         $_branches = array();
         // we can only filter the enumeration from the jobs
         $result = $this->request($this->getBaseUrl() . 'job_search?size=2000', array(), false);
         if (isset($result->hits)) {
             foreach ($result->hits->hits as $job) {
                 $_educations = array_merge($_educations, explode('/', $job->_source->education_level));
                 $_branches = array_merge($_branches, array($job->_source->sector));
             }
         }
         $_educations = array_unique($_educations);
         $_branches = array_unique($_branches);
         $this->enumeration->setEducations($_educations);
         $this->enumeration->setBranches($_branches);
     }
 }
 /**
  * Creates branch filter part
  *
  * @param array $_filter The filter array
  * @param array|string $branch The branch(es)
  */
 public function createBranchFilter(&$_filter, $branch)
 {
     $branches = $this->enumeration->getBranches();
     if ($branch !== null) {
         if (is_array($branch)) {
             foreach ($branch as $_branch) {
                 if (!in_array($_branch, $branches)) {
                     $this->failed = true;
                 }
             }
             array_push($_filter, 'sector=' . implode(',', $branch));
         }
         if (is_string($branch)) {
             if (!in_array($branch, $branches)) {
                 $this->failed = true;
             }
             array_push($_filter, 'sector=' . $branch);
         }
     }
 }