<commit_before><?php

namespace Bolt\Storage\Entity;

use Bolt\Legacy\AppSingleton;
use Silex\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
 * Trait class for ContentType routing.
 *
 * This is a breakout of the old Bolt\Content class and serves two main purposes:
 *   * Maintain backward compatibility for Bolt\Content through the remainder of
 *     the 2.x development/release life-cycle
 *   * Attempt to break up former functionality into sections of code that more
 *     resembles Single Responsibility Principles
 *
 * These traits should be considered transitional, the functionality in the
 * process of refactor, and not representative of a valid approach.
 *
 * @author <NAME> <<EMAIL>>
 */
trait ContentRouteTrait
{
    /**
     * Creates a link to EDIT this record, if the user is logged in.
     *
     * @return string
     */
    public function editlink()
    {
        $perm = 'contenttype:' . $this->contenttype['slug'] . ':edit:' . $this->id;

        if ($this->app['users']->isAllowed($perm)) {
            return $this->app->generatePath('editcontent', ['contenttypeslug' => $this->contenttype['slug'], 'id' => $this->id ]);
        } else {
            return false;
        }
    }

    /**
     * Creates a URL for the content record.
     *
     * @param int $referenceType
     *
     * @return string|null
     */
    public function link($referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)<commit_msg>Removed app::generatePath usage...how did that get through.<commit_after><?php

namespace Bolt\Storage\Entity;

use Bolt\Legacy\AppSingleton;
use Silex\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
 * Trait class for ContentType routing.
 *
 * This is a breakout of the old Bolt\Content class and serves two main purposes:
 *   * Maintain backward compatibility for Bolt\Content through the remainder of
 *     the 2.x development/release life-cycle
 *   * Attempt to break up former functionality into sections of code that more
 *     resembles Single Responsibility Principles
 *
 * These traits should be considered transitional, the functionality in the
 * process of refactor, and not representative of a valid approach.
 *
 * @author <NAME> <<EMAIL>>
 */
trait ContentRouteTrait
{
    /**
     * Creates a link to EDIT this record, if the user is logged in.
     *
     * @return string
     */
    public function editlink()
    {
        $perm = 'contenttype:' . $this->contenttype['slug'] . ':edit:' . $this->id;

        if ($this->app['users']->isAllowed($perm)) {
            return $this->app['url_generator']->generate('editcontent', ['contenttypeslug' => $this->contenttype['slug'], 'id' => $this->id ]);
        } else {
            return false;
        }
    }

    /**
     * Creates a URL for the content record.
     *
     * @param int $referenceType
     *
     * @return string|null
     */
    public function link($referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
{'fraction_non_alphanumeric': 0.11375041820006691, 'fraction_numerical': 0.0006691201070592171, 'mean_word_length': 2.9919893190921227, 'pattern_counts': {'":': 0, '<': 11, '<?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': '4613545', 'n_tokens_mistral': 845, 'n_tokens_neox': 833, 'n_words': 269}