<?php $freetime = $totalTime - $studyTime - $workTime - $timeForOtherStuffs; $websiteProgress = 60; // percents $startMovingBlogPosts = false; $estimatedDaysForBlogPostsImport = 4; // days $importBlogPostsDone = false; $websiteManager = $this->container->get('WebsiteManager'); foreach($freetime as $day){ if($startMovingBlogPosts){ $websiteManager->startImportingBlogPosts(); $estimatedDaysForBlogPostsImport -= 1; if(estimatedDaysForBlogPostsImport <= 0){ $importBlogPostsDone = true; $blogManager =$this->container->get('Blog'); $dummyPost = $blogManager->findBy(array( 'name' => 'Moving in progress' 'author' => 'hoangnd' )); $blogManager->remove($dummyPost); } }else{ $websiteManager->startUpdatingWebsite(); if($day->getLength()=="full day"){ $websiteProgress += 10; }else{ $websiteProgress += 5; } if($websiteProgress >= 100) $startMovingBlogPosts = true; } }