<commit_before><?php

/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
abstract class PluginMenuItem extends BaseMenuItem
{
  protected
    $_breadcrumbs = null,
    $_allPermissions;

  public function getAllPermissions()
  {
    if (!$this->_allPermissions)
    {
      $this->_allPermissions = array();
      foreach ($this->Groups as $group)
      {
        foreach ($group->Permissions as $permission)
        {
          $this->_allPermissions[] = $permission->name;
        }
      }
      foreach ($this->Permissions as $permission)
      {
        $this->_allPermissions[] = $permission->name;
      }
    }
    return $this->_allPermissions;
  }

  public function getMainContent()
  {
    $content = $this->getMasterContent();
    if ($content && $content instanceof Doctrine_Record && $content->exists())
    {
      return $content;
    } else {
      $content = $this->getContent();
      if ($content && $content instanceof Doctrine_Record && $content->exists())
      {
        return $content;
      } else {
        return false;
      }
    }
  }

  public function getParentId()
  {
    $node = $this->getNode();

    if (!$node->isValidNode() || $node->isRoot())
    {      
      return null;
    }

    $parent = $node->getParent();

    return $parent['id'];
  }
  
  public function getIndentedName()
  {
    return str_repeat('-', $this->getLevel()) . ' ' . $this->getLabel().($this->getLevel() == 0 ? ' ('.$this->getSlug().')':null);
  }

  public function preValidate($event)
  {
    $invoker = $event->getInvoker();
    $modified = $invoker->getModified();
    if (isset($modified['is_published']) && $modified['is_published'] && !isset($modified['date_published']))
    {
      $invoker->date_published = new Doctrine_Expression('NOW()');
    }

    if (sfContext::hasInstance())
    {
      $invoker->site_id = sfSympalContext::getInstance()->getSite()->getId();
    }
  }

  public function __toString()
  {
    return $this->getIndentedName();
  }

  public function publish()
  {
    $this->is_published = true;
    $this->date_published = new Doctrine_Expression('NOW()');
    $this->save();
    $this->refresh();
  }

  public function unpublish()
  {
    $this->is_published = false;
    $this->date_published = null;
    $this->save();
  }

  public function getLabel()
  {
    return $this->_get('label') ? $this->_get('label'):$this->name;
  }

  public function getIndented()
  {
    return (string) $this;
  }

  public function getContent()
  {
    return $this->getRelatedContent();
  }

  public function setContent(Content $content)
  {
    $this->RelatedContent = $content;
  }

  public function getRoute()
  {<commit_msg>[1.4][sfSympalPlugin] Fixing double call of label getter<commit_after><?php

/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
abstract class PluginMenuItem extends BaseMenuItem
{
  protected
    $_breadcrumbs = null,
    $_allPermissions;

  public function getAllPermissions()
  {
    if (!$this->_allPermissions)
    {
      $this->_allPermissions = array();
      foreach ($this->Groups as $group)
      {
        foreach ($group->Permissions as $permission)
        {
          $this->_allPermissions[] = $permission->name;
        }
      }
      foreach ($this->Permissions as $permission)
      {
        $this->_allPermissions[] = $permission->name;
      }
    }
    return $this->_allPermissions;
  }

  public function getMainContent()
  {
    $content = $this->getMasterContent();
    if ($content && $content instanceof Doctrine_Record && $content->exists())
    {
      return $content;
    } else {
      $content = $this->getContent();
      if ($content && $content instanceof Doctrine_Record && $content->exists())
      {
        return $content;
      } else {
        return false;
      }
    }
  }

  public function getParentId()
  {
    $node = $this->getNode();

    if (!$node->isValidNode() || $node->isRoot())
    {      
      return null;
    }

    $parent = $node->getParent();

    return $parent['id'];
  }
  
  public function getIndentedName()
  {
    return str_repeat('-', $this->getLevel()) . ' ' . $this->getLabel().($this->getLevel() == 0 ? ' ('.$this->getSlug().')':null);
  }

  public function preValidate($event)
  {
    $invoker = $event->getInvoker();
    $modified = $invoker->getModified();
    if (isset($modified['is_published']) && $modified['is_published'] && !isset($modified['date_published']))
    {
      $invoker->date_published = new Doctrine_Expression('NOW()');
    }

    if (sfContext::hasInstance())
    {
      $invoker->site_id = sfSympalContext::getInstance()->getSite()->getId();
    }
  }

  public function __toString()
  {
    return $this->getIndentedName();
  }

  public function publish()
  {
    $this->is_published = true;
    $this->date_published = new Doctrine_Expression('NOW()');
    $this->save();
    $this->refresh();
  }

  public function unpublish()
  {
    $this->is_published = false;
    $this->date_published = null;
    $this->save();
  }

  public function getLabel()
  {
    $label = $this->_get('label');
    return $label ? $label:$this->name;
  }

  public function getIndented()
  {
    return (string) $this;
  }

  public function getContent()
  {
    return $this->getRelatedContent();
  }

  public function setContent(Content $content)
  {
    $this->RelatedContent = $content;
  }

  public function getRoute()
  {
{'fraction_non_alphanumeric': 0.16256429096252756, 'fraction_numerical': 0.0007347538574577516, 'mean_word_length': 2.8183730715287516, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 84, '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': '6963088', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1670, 'n_words': 332}