<commit_before><?php

namespace OrcaServices\Heartbeat\Heartbeat\Sensor;

use OrcaServices\Heartbeat\Heartbeat\Sensor;
use Cake\Datasource\ConnectionManager;

/**
 * DB Connection Sensor
 */
class DBConnection extends Sensor
{

    /**
     * @inheritdoc
     */
    protected function _getStatus()
    {
        try {
            $connection = ConnectionManager::get('default');
            return $connection->connect();
        } catch (\Exception $e) {
            $hasDBConnection = false;
        }

        return $hasDBConnection;
    }

}<commit_msg>Return early and add documentation<commit_after><?php

namespace OrcaServices\Heartbeat\Heartbeat\Sensor;

use OrcaServices\Heartbeat\Heartbeat\Sensor;
use Cake\Datasource\ConnectionManager;

/**
 * DB Connection Sensor
 *
 * Returns true if a connection to the database server can be established
 * or false otherwise.
 */
class DBConnection extends Sensor
{

    /**
     * @inheritdoc
     */
    protected function _getStatus()
    {
        try {
            $connection = ConnectionManager::get('default');
            return $connection->connect();
        } catch (\Exception $e) {
            return false;
        }
    }

}
{'fraction_non_alphanumeric': 0.10561609388097234, 'fraction_numerical': 0.0, 'mean_word_length': 2.543026706231454, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5921117', 'n_tokens_mistral': 334, 'n_tokens_neox': 325, 'n_words': 77}