<?php

use IndeedJobs\Provider;
require_once __DIR__ . '/../vendor/autoload.php';
include_once "templates/base.php";
echo pageHeader("Simple Job Search Example");
// Set up client with configuration
$config = (include __DIR__ . '/../config.php');
try {
    $client = Provider::createClient($config);
} catch (Exception $e) {
    echo "<pre>";
    print_r($e);
    echo "</pre>";
}
// If the client was created, proceed to get job listings
if (isset($client)) {
    $client->setQuery('engineering');
    $collection = $client->getJobs();
    if ($collection && !$collection->getErrors()) {
        echo "<h3>Attributes: </h3><pre>";
        print_r($collection->getAttributes());
        echo "</pre>";
        echo "<h3>Jobs: </h3>";
        foreach ($collection->all() as $job) {
            echo "<h4>Job: </h4><pre>";
            print_r($job);
            echo "</pre>";
        }
    } elseif ($collection && $collection->getErrors()) {
        echo "<pre>";
 public function createJobObject($input)
 {
     $attributes = ['id' => $this->getId($input), 'title' => $this->getTitle($input), 'description' => $this->getDescription($input), 'source' => $this->getSource($input), 'query' => $this->getQuery($input), 'type' => $this->getType($input), 'url' => $this->getUrl($input), 'companies' => $this->getCompanies($input), 'locations' => $this->getLocations($input), 'industries' => $this->getIndustries($input), 'dates' => $this->getDates($input), 'salaries' => $this->getSalaries($input), 'codes' => $this->getCodes($input)];
     return Provider::createJob($attributes);
 }