<commit_before><?php
use lib\ApiResponse;
///*******************             router        ****************************/
//set json Content-Type
$app->group('/api/v1', function () use ($app) {
    $app->group('/volume', function () use ($app) {
        $app->map('/down', function () use ($app) {
            $app->response->headers->set('Content-Type', 'application/json');
            $status = system('amixer -c 0 -q set Master 3%- unmute');
            if ($status !== false) {
                $status = 200;
            } else {
                $status = 500;
            }
            $app->halt(200, (new ApiResponse(array(), array(compact('status')))));
        })
            ->via('GET');

        $app->map('/up', function () use ($app) {
            $app->response->headers->set('Content-Type', 'application/json');
            $status = system('amixer -c 0 -q set Master 3%+ unmute');
            if ($status !== false) {
                $status = 200;
            } else {
                $status = 500;
            }
            $app->halt(200, (new ApiResponse(array(), array(compact('status')))));
        })
            ->via('GET');
    });

    $app->group('/key', function () use ($app) {
        $app->map('/space', function () use ($app) {
            $app->response->headers->set('Content-Type', 'application/json');
            $XAUTHORITY = 'export XAUTHORITY=/home/' . USER . '/.Xauthority; ';
            $status = system($XAUTHORITY . 'export DISPLAY=:0.0; xdotool key space');
            if ($status !== false) {
                //$status = 200;
            } else {
                //$status = 500;
            }
                echo "<pre>";var_dump(
                $status
                );die;
            $app->halt(200, (new ApiResponse(array(), array(compact('status')))));
        })
            ->via('GET');<commit_msg>[#]  master Work stage 2016-02-12 00:32:12  M src/router/api.php<commit_after><?php
use lib\ApiResponse;
///*******************             router        ****************************/
//set json Content-Type
$app->group('/api/v1', function () use ($app) {
    $app->group('/volume', function () use ($app) {
        $app->map('/down', function () use ($app) {
            $app->response->headers->set('Content-Type', 'application/json');
            $status = system('amixer -c 0 -q set Master 3%- unmute');
            if ($status !== false) {
                $status = 200;
            } else {
                $status = 500;
            }
            $app->halt(200, (new ApiResponse(array(), array(compact('status')))));
        })
            ->via('GET');

        $app->map('/up', function () use ($app) {
            $app->response->headers->set('Content-Type', 'application/json');
            $status = system('amixer -c 0 -q set Master 3%+ unmute');
            if ($status !== false) {
                $status = 200;
            } else {
                $status = 500;
            }
            $app->halt(200, (new ApiResponse(array(), array(compact('status')))));
        })
            ->via('GET');
    });

    $app->group('/key', function () use ($app) {
        $app->map('/space', function () use ($app) {
            $app->response->headers->set('Content-Type', 'application/json');
            $XAUTHORITY = 'export XAUTHORITY=/home/' . USER . '/.Xauthority; ';
            $status = system($XAUTHORITY . 'export DISPLAY=:0; xdotool key space');
            if ($status !== false) {
                //$status = 200;
            } else {
                //$status = 500;
            }
                echo "<pre>";var_dump(
                $status
                );die;
            $app->halt(200, (new ApiResponse(array(), array(compact('status')))));
        })
            ->via('GET');
{'fraction_non_alphanumeric': 0.21388815266366287, 'fraction_numerical': 0.02146832759077657, 'mean_word_length': 1.6540084388185654, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 47, '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': '1830975', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1048, 'n_words': 226}