<commit_before><?php
namespace App\Controllers;

use App\Framework\Mvc\Controller\BasicController;
use App\Services\Instagram\InstagramService;


class HomeController extends BasicController {

    public function indexAction($hashtag)
    {
        // If there is no hashtag parameter, $tag is assigned as "Salvador"
        $hashtag = (empty($hashtag["_GET"]["hashtag"])) ? "Salvador" : $hashtag["_GET"]["hashtag"];

        $this->app->container->singleton('InstagramService', function () {
            return new InstagramService();
        });

        $instagram = $this->app->InstagramService;
        $result = $instagram->getPhotosBasedOnTag($hashtag);

        // Show hashtag name
        echo "<b>Hashtag:</b> #" . $hashtag . "<br />";

        // Show 20 photos
        foreach ($result->data as $data)
        {
            echo "<img src=".$data->images->low_resolution->url." alt=".$data->caption->text.">";
        }
    }

}<commit_msg>Add comment to indexAction in Home controller<commit_after><?php
namespace App\Controllers;

use App\Framework\Mvc\Controller\BasicController;
use App\Services\Instagram\InstagramService;


class HomeController extends BasicController {

    /**
     * Request photos based on hashtag
     *
     * @param string $hashtag
     * @return array
     */
    public function indexAction($hashtag)
    {

        // If there is no hashtag parameter, $tag is assigned as "Salvador"
        $hashtag = (empty($hashtag["_GET"]["hashtag"])) ? "Salvador" : $hashtag["_GET"]["hashtag"];

        $this->app->container->singleton('InstagramService', function () {
            return new InstagramService();
        });

        $instagram = $this->app->InstagramService;
        $result = $instagram->getPhotosBasedOnTag($hashtag);


        // Show hashtag name
        echo "<b>Hashtag:</b> #" . $hashtag . "<br />";

        $result = json_decode($result, true);

        // Show 20 photos
        foreach ($result["data"] as $data)
        {
            echo "<img src=".$data["images"]["low_resolution"]["url"]." alt=".$data["caption"]["text"].">";
        }
    }

}
{'fraction_non_alphanumeric': 0.1584673604541154, 'fraction_numerical': 0.001892147587511826, 'mean_word_length': 2.743362831858407, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5544230', 'n_tokens_mistral': 644, 'n_tokens_neox': 632, 'n_words': 131}